Skip to content

Commit

Permalink
add migration
Browse files Browse the repository at this point in the history
  • Loading branch information
vincetiu8 committed Jun 3, 2024
1 parent c6127f9 commit 3c3f204
Showing 1 changed file with 106 additions and 0 deletions.
106 changes: 106 additions & 0 deletions deployments/mainnet/usdt/migrations/1717456227_configurate_and_ens
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import { Contract } from 'ethers';
import { DeploymentManager } from '../../../../plugins/deployment_manager/DeploymentManager';
import { migration } from '../../../../plugins/deployment_manager/Migration';
import { calldata, exp, getConfigurationStruct, proposal } from '../../../../src/deploy';
import { expect } from 'chai';
import {ERC20__factory} from '../../../../build/types';

const ENSName = 'compound-community-licenses.eth';
const ENSResolverAddress = '0x19c2d5D0f035563344dBB7bE5fD09c8dad62b001';
const ENSRegistryAddress = '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e';
const ENSSubdomainLabel = 'v3-additional-grants';
const ENSSubdomain = `${ENSSubdomainLabel}.${ENSName}`;
const ENSTextRecordKey = 'v3-official-markets';

const ERC20PredicateAddress = '0xdD6596F2029e6233DEFfaCa316e6A95217d4Dc34';
const RootChainManagerAddress = '0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74';

export default migration('1676659582_configurate_and_ens', {
prepare: async (deploymentManager: DeploymentManager) => {
return {};
},

enact: async (deploymentManager: DeploymentManager, govDeploymentManager: DeploymentManager) => {

},

async enacted(deploymentManager: DeploymentManager): Promise<boolean> {
return false;
},

async verify(deploymentManager: DeploymentManager, govDeploymentManager: DeploymentManager) {
const ethers = deploymentManager.hre.ethers;

const {
comet,
rewards,
DAI,
WBTC,
WETH,
WMATIC
} = await deploymentManager.getContracts();

const {
timelock,
} = await govDeploymentManager.getContracts();

// 1.
const daiInfo = await comet.getAssetInfoByAddress(DAI.address);
const wbtcInfo = await comet.getAssetInfoByAddress(WBTC.address);
const wethInfo = await comet.getAssetInfoByAddress(WETH.address);
const wmaticInfo = await comet.getAssetInfoByAddress(WMATIC.address);
expect(await daiInfo.supplyCap).to.be.eq(exp(1_000_000, 18));
expect(await wbtcInfo.supplyCap).to.be.eq(exp(20_000, 8));
expect(await wethInfo.supplyCap).to.be.eq(exp(50_000, 18));
expect(await wmaticInfo.supplyCap).to.be.eq(exp(500_000, 18));

// 2. & 3.
// Note: Cannot verify because the USDC we are bridging over is different from the one in Comet
// expect(await comet.getReserves()).to.be.equal(exp(400_000, 6));
const bridgedUSDC = new Contract(
'0x0FA8781a83E46826621b3BC094Ea2A0212e71B23',
ERC20__factory.createInterface(),
deploymentManager.hre.ethers.provider
);
expect(await bridgedUSDC.balanceOf(comet.address)).to.be.equal(exp(500, 6));

// 4. & 5.
// const bridgedCOMP = new Contract(
// '0x46DaBF9092B40A3fE6c0bC3331Cd928B600754fE',
// ERC20__factory.createInterface(),
// deploymentManager.hre.ethers.provider
// );
// expect(await bridgedCOMP.balanceOf(rewards.address)).to.be.equal(exp(10_000, 18));

// 6. & 7.
const ENSResolver = await govDeploymentManager.existing('ENSResolver', ENSResolverAddress, 'goerli');
const ENSRegistry = await govDeploymentManager.existing('ENSRegistry', ENSRegistryAddress, 'goerli');
const nameHash = ethers.utils.namehash(ENSName);
const subdomainHash = ethers.utils.namehash(ENSSubdomain);
const officialMarketsJSON = await ENSResolver.text(subdomainHash, ENSTextRecordKey);
const officialMarkets = JSON.parse(officialMarketsJSON);
expect(await ENSRegistry.recordExists(subdomainHash)).to.be.equal(true);
expect(await ENSRegistry.owner(subdomainHash)).to.be.equal(timelock.address);
expect(await ENSRegistry.resolver(subdomainHash)).to.be.equal(ENSResolverAddress);
expect(await ENSRegistry.ttl(subdomainHash)).to.be.equal(0);
expect(officialMarkets).to.deep.equal({
5: [
{
baseSymbol: 'USDC',
cometAddress: '0x3EE77595A8459e93C2888b13aDB354017B198188',
},
{
baseSymbol: 'WETH',
cometAddress: '0x9A539EEc489AAA03D588212a164d0abdB5F08F5F',
},
],

80001: [
{
baseSymbol: 'USDC',
cometAddress: comet.address,
},
]
});
}
});

0 comments on commit 3c3f204

Please sign in to comment.