diff --git a/deployments/base-sepolia/weth/migrations/1711572958_initialize_market.ts b/deployments/base-sepolia/weth/migrations/1711572958_initialize_market.ts new file mode 100644 index 000000000..c65649987 --- /dev/null +++ b/deployments/base-sepolia/weth/migrations/1711572958_initialize_market.ts @@ -0,0 +1,104 @@ +import { DeploymentManager } from '../../../../plugins/deployment_manager/DeploymentManager'; +import { migration } from '../../../../plugins/deployment_manager/Migration'; +import { calldata, exp, getConfigurationStruct, proposal } from '../../../../src/deploy'; + +const baseSepoliaCOMPAddress = '0x2f535da74048c0874400f0371Fba20DF983A56e2'; + +export default migration('1711572958_initialize_market', { + prepare: async (deploymentManager: DeploymentManager) => { + return {}; + }, + + enact: async (deploymentManager: DeploymentManager, govDeploymentManager: DeploymentManager, vars: Vars) => { + const trace = deploymentManager.tracer(); + const ethers = deploymentManager.hre.ethers; + const { utils } = ethers; + + const { + bridgeReceiver, + comet, + cometAdmin, + rewards, + configurator, + } = await deploymentManager.getContracts(); + + const { + baseL1CrossDomainMessenger, + governor, + } = await govDeploymentManager.getContracts(); + + const configuration = await getConfigurationStruct(deploymentManager); + + const setConfigurationCalldata = await calldata( + configurator.populateTransaction.setConfiguration(comet.address, configuration) + ); + const deployAndUpgradeToCalldata = utils.defaultAbiCoder.encode( + ['address', 'address'], + [configurator.address, comet.address] + ); + const setRewardConfigCalldata = utils.defaultAbiCoder.encode( + ['address', 'address'], + [comet.address, baseSepoliaCOMPAddress] + ); + const l2ProposalData = utils.defaultAbiCoder.encode( + ['address[]', 'uint256[]', 'string[]', 'bytes[]'], + [ + [ configurator.address, cometAdmin.address, rewards.address ], + [ 0, 0, 0 ], + [ + 'setConfiguration(address,(address,address,address,address,address,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint104,uint104,uint104,(address,address,uint8,uint64,uint64,uint64,uint128)[]))', + 'deployAndUpgradeTo(address,address)', + 'setRewardConfig(address,address)', + ], + [ + setConfigurationCalldata, + deployAndUpgradeToCalldata, + setRewardConfigCalldata + ] + ] + ); + + const sepoliaActions = [ + // 1. Set Comet configuration, deployAndUpgradeTo new Comet, set reward config + { + contract: baseL1CrossDomainMessenger, + signature: 'sendMessage(address,bytes,uint32)', + args: [ bridgeReceiver.address, l2ProposalData, 2_500_000 ] + }, + ]; + + const description = "# Configure Base-Sepolia cWETHv3 market, set rewards config."; + const txn = await govDeploymentManager.retry(async () => + trace(await governor.propose(...(await proposal(sepoliaActions, description)))) + ); + + const event = txn.events.find(event => event.event === 'ProposalCreated'); + const [proposalId] = event.args; + + trace(`Created proposal ${proposalId}.`); + }, + + async verify(deploymentManager: DeploymentManager, govDeploymentManager: DeploymentManager, preMigrationBlockNumber: number) { + const ethers = deploymentManager.hre.ethers; + await deploymentManager.spider(); // We spider here to pull in Optimism COMP now that reward config has been set + + const { + comet, + rewards, + COMP, + } = await deploymentManager.getContracts(); + + // 1. + const stateChanges = await diffState(comet, getCometConfig, preMigrationBlockNumber); + + expect(stateChanges).to.deep.equal({ + pauseGuardian: '0x6106DA3AcFdEB341808f4DC3D2483eC67c98E728', + baseTrackingSupplySpeed: exp(2 / 86400, 16, 18), + baseTrackingBorrowSpeed: exp(2 / 86400, 16, 18), + baseBorrowMin: exp(100, 18), + cbETH: { + supplyCap: exp(7500, 18) + }, + }); + } +}); \ No newline at end of file diff --git a/deployments/sepolia/weth/relations.ts b/deployments/sepolia/weth/relations.ts index 13f315c2a..ae12a73a5 100644 --- a/deployments/sepolia/weth/relations.ts +++ b/deployments/sepolia/weth/relations.ts @@ -10,4 +10,11 @@ export default { } } }, + baseL1CrossDomainMessenger: { + artifact: 'contracts/bridges/optimism/IL1CrossDomainMessenger.sol:IL1CrossDomainMessenger', + delegates: { + // Not great, but this address shouldn't change and is very difficult to grab on-chain (private methods) + field: async () => '0xC34855F4De64F1840e5686e64278da901e261f20' + } + }, }; diff --git a/deployments/sepolia/weth/roots.json b/deployments/sepolia/weth/roots.json index 825b5a431..851851976 100644 --- a/deployments/sepolia/weth/roots.json +++ b/deployments/sepolia/weth/roots.json @@ -1,7 +1,9 @@ { - "comet": "0x2943ac1216979aD8dB76D9147F64E61adc126e96", - "configurator": "0xc28aD44975C614EaBe0Ed090207314549e1c6624", - "rewards": "0x8bF5b658bdF0388E8b482ED51B14aef58f90abfD", - "bulker": "0xaD0C044425D81a2E223f4CE699156900fead2Aaa", - "fauceteer": "0x68793eA49297eB75DFB4610B68e076D2A5c7646C" + "comet": "0x2943ac1216979aD8dB76D9147F64E61adc126e96", + "configurator": "0xc28aD44975C614EaBe0Ed090207314549e1c6624", + "rewards": "0x8bF5b658bdF0388E8b482ED51B14aef58f90abfD", + "bulker": "0xaD0C044425D81a2E223f4CE699156900fead2Aaa", + "fauceteer": "0x68793eA49297eB75DFB4610B68e076D2A5c7646C", + "baseL1CrossDomainMessenger": "0xC34855F4De64F1840e5686e64278da901e261f20", + "baseL1StandardBridge": "0xfd0Bf71F60660E2f608ed56e1659C450eB113120" } \ No newline at end of file