Skip to content

Commit

Permalink
update configs, deploy and migration before the contract deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriy-woof-software committed Jul 15, 2024
1 parent cfa848a commit f6996e5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
4 changes: 2 additions & 2 deletions deployments/optimism/weth/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"baseToken": "WETH",
"baseTokenAddress": "0x4200000000000000000000000000000000000006",
"pauseGuardian": "0x3fFd6c073a4ba24a113B18C8F373569640916A45",
"borrowMin": "0.1e18",
"borrowMin": "0.000001e18",
"storeFrontPriceFactor": 0.7,
"targetReserves": "5000e18",
"rates": {
Expand Down Expand Up @@ -49,4 +49,4 @@
"supplyCap": "0e8"
}
}
}
}
19 changes: 11 additions & 8 deletions deployments/optimism/weth/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default async function deploy(deploymentManager: DeploymentManager, deplo
'0x68f180fcCe6836688e9084f035309E29Bf0A2095',
'optimism'
);

const COMP = await deploymentManager.existing(
'COMP',
'0x7e7d4467112689329f7E06571eD0E8CbAd4910eE',
Expand All @@ -40,7 +40,7 @@ export default async function deploy(deploymentManager: DeploymentManager, deplo
exp(1, 8) // constantPrice
]
);

const rETHPriceFeed = await deploymentManager.deploy(
'rETH:priceFeed',
'pricefeeds/ScalingPriceFeed.sol',
Expand All @@ -60,7 +60,7 @@ export default async function deploy(deploymentManager: DeploymentManager, deplo
'wstETH / ETH price feed' // description
]
);

const wbtcETHPriceFeed = await deploymentManager.deploy(
'WBTC:priceFeed',
'pricefeeds/ReverseMultiplicativePriceFeed.sol',
Expand All @@ -71,23 +71,26 @@ export default async function deploy(deploymentManager: DeploymentManager, deplo
'WBTC / ETH price feed' // description
]
);

// Import shared contracts from cUSDCv3 and cUSDTv3 deployments
const cometAdmin = await deploymentManager.fromDep('cometAdmin', 'optimism', 'usdc');
const cometFactory = await deploymentManager.fromDep('cometFactory', 'optimism', 'usdt');
// we use cometFactory from usdc deployment, because usdt deployment use the same one.
// the factory is not the latest version of comet (update for USDT on Mainnet)
// for this market it works perfectly
const cometFactory = await deploymentManager.fromDep('cometFactory', 'optimism', 'usdc');
const $configuratorImpl = await deploymentManager.fromDep('configurator:implementation', 'optimism', 'usdc');
const configurator = await deploymentManager.fromDep('configurator', 'optimism', 'usdc');
const rewards = await deploymentManager.fromDep('rewards', 'optimism', 'usdc');
const bulker = await deploymentManager.fromDep('bulker', 'optimism', 'usdc');
const localTimelock = await deploymentManager.fromDep('timelock', 'optimism', 'usdc');
const bridgeReceiver = await deploymentManager.fromDep('bridgeReceiver', 'optimism', 'usdc');

// Deploy Comet
const deployed = await deployComet(deploymentManager, deploySpec);

return {
...deployed,
bridgeReceiver,
bridgeReceiver,
bulker,
rewards,
COMP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ENSTextRecordKey = 'v3-official-markets';
const opCOMPAddress = '0x7e7d4467112689329f7E06571eD0E8CbAd4910eE';
const wethAmountToBridge = exp(10, 18);

export default migration('1720515728_my_migration', {
export default migration('1720515728_configurate_and_ens', {
prepare: async () => {
return {};
},
Expand Down Expand Up @@ -144,7 +144,7 @@ export default migration('1720515728_my_migration', {
signature: 'sendMessage(address,bytes,uint32)',
args: [bridgeReceiver.address, l2ProposalData, 3_000_000],
},
// 5. Update the list of official markets
// 3. Update the list of official markets
{
target: ENSResolverAddress,
signature: 'setText(bytes32,string,string)',
Expand All @@ -154,10 +154,10 @@ export default migration('1720515728_my_migration', {
),
},
];

// the description has speeds. speeds will be set up on on-chain proposal
const description = 'DESCRIPTION';
const txn = await govDeploymentManager.retry(async () =>{
const description = '# Initialize cWETHv3 on Optimism\n\n## Proposal summary\n\nCompound Growth Program [AlphaGrowth] proposes the deployment of Compound III to the Optimism network. This proposal takes the governance steps recommended and necessary to initialize a Compound III WETH market on Optimism; upon execution, cWETHv3 will be ready for use. Simulations have confirmed the market’s readiness, as much as possible, using the [Comet scenario suite](https://github.com/compound-finance/comet/tree/main/scenario). The new parameters include setting the risk parameters based on the [recommendations from Gauntlet](https://www.comp.xyz/t/add-market-eth-on-optimism/5274/5).\n\nFurther detailed information can be found on the corresponding [proposal pull request](https://github.com/compound-finance/comet/pull/882) and [forum discussion](https://www.comp.xyz/t/add-market-eth-on-optimism/5274).\n\n\n## Proposal Actions\n\nThe first action bridges 10 ETH as seed reserves from Mainnet Timelock to Optimism L2 Timelock using OpL1StandardBridge.\n\nThe second action sets the Comet configuration and deploys a new Comet implementation on Optimism. This sends the encoded `setFactory`, `setConfiguration` and `deployAndUpgradeTo` calls across the bridge to the governance receiver on Optimism. It also calls `setRewardConfig` on the Optimism rewards contract, to establish Optimism’s bridged version of COMP as the reward token for the deployment and set the initial supply speed to be 4 COMP/day and borrow speed to be 3 COMP/day. The last two steps are to wrap ETH into WETH and transfer seed reserves into Comet\n\nThe third action updates the ENS TXT record `v3-official-markets` on `v3-additional-grants.compound-community-licenses.eth`, updating the official markets JSON to include the new Optimism cWETHv3 market.';
const txn = await govDeploymentManager.retry(async () => {
return trace(await governor.propose(...(await proposal(actions, description))));
}
);
Expand All @@ -183,6 +183,7 @@ export default migration('1720515728_my_migration', {
timelock
} = await govDeploymentManager.getContracts();

// 2.
// uncomment on on-chain proposal PR
// const stateChanges = await diffState(comet, getCometConfig, preMigrationBlockNumber);
// expect(stateChanges).to.deep.equal({
Expand All @@ -204,10 +205,10 @@ export default migration('1720515728_my_migration', {
expect(config.rescaleFactor).to.be.equal(exp(1, 12));
expect(config.shouldUpscale).to.be.equal(true);

// 2. & 3 & 4.
// 1.
expect(await comet.getReserves()).to.be.equal(wethAmountToBridge);

// 5.
// 3.
const ENSResolver = await govDeploymentManager.existing(
'ENSResolver',
ENSResolverAddress
Expand Down

0 comments on commit f6996e5

Please sign in to comment.