Skip to content

Commit

Permalink
debuggin scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriy-woof-software committed Apr 9, 2024
1 parent 34d8a2c commit 2a385e6
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 7 deletions.
6 changes: 3 additions & 3 deletions deployments/mainnet/weth-lrt/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DeploySpec, deployComet, exp } from '../../../src/deploy';

export default async function deploy(deploymentManager: DeploymentManager, deploySpec: DeploySpec): Promise<Deployed> {
const ezETH = await deploymentManager.existing('ezETH', '0x1e756B7bCca7B26FB9D85344B3525F5559bbacb0');
const WETH = await deploymentManager.existing('WETH', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2');
// const WETH = await deploymentManager.existing('WETH', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2');

// Deploy scaling price feed for cbETH
const ezETHScalingPriceFeed = await deploymentManager.deploy(
Expand All @@ -17,8 +17,8 @@ export default async function deploy(deploymentManager: DeploymentManager, deplo

const cometAdmin = await deploymentManager.fromDep('cometAdmin', 'mainnet', 'usdc');
const cometFactory = await deploymentManager.fromDep('cometFactory', 'mainnet', 'usdc');
// const $configuratorImpl = await deploymentManager.fromDep('configurator:implementation', 'mainnet', 'usdc');
// const configurator = await deploymentManager.fromDep('configurator', 'mainnet', 'usdc');
const $configuratorImpl = await deploymentManager.fromDep('configurator:implementation', 'mainnet', 'usdc');
const configurator = await deploymentManager.fromDep('configurator', 'mainnet', 'usdc');
const rewards = await deploymentManager.fromDep('rewards', 'mainnet', 'usdc');
const bulker = await deploymentManager.fromDep('bulker', 'mainnet', 'usdc'); // 0xa397a8C2086C554B531c02E29f3291c9704B00c7
const localTimelock = await deploymentManager.fromDep('timelock', 'mainnet', 'usdc');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DeploymentManager } from '../../../../plugins/deployment_manager/DeploymentManager';
import { migration } from '../../../../plugins/deployment_manager/Migration';

import { calldata, exp, getConfigurationStruct, proposal } from '../../../../src/deploy';
// const ENSName = 'compound-community-licenses.eth';
// const ENSResolverAddress = '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41';
// const ENSRegistryAddress = '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e';
Expand All @@ -13,6 +13,8 @@ import { migration } from '../../../../plugins/deployment_manager/Migration';

// const cUSDTAddress = '0xf650c3d88d12db855b8bf7d11be6c55a4e07dcc9';

const COMPAddress = '0xc00e94cb662c3520282e6f5717214004a7f26888';

export default migration('1675200105_configurate_and_ens', {
prepare: async (deploymentManager: DeploymentManager) => {
console.log('WTF1')
Expand All @@ -21,6 +23,83 @@ export default migration('1675200105_configurate_and_ens', {

enact: async (deploymentManager: DeploymentManager, govDeploymentManager: DeploymentManager) => {
console.log('WTF2')
const trace = deploymentManager.tracer();
const ethers = deploymentManager.hre.ethers;

const comptrollerV2 = await deploymentManager.fromDep('comptrollerV2', 'mainnet', 'usdc');
const cometFactory = await deploymentManager.fromDep('cometFactory', 'mainnet', 'usdc');
const {
governor,
comet,
configurator,
cometAdmin,
rewards,
WETH,
ezETH
} = await deploymentManager.getContracts();

const configuration = await getConfigurationStruct(deploymentManager);

const actions = [
// 2. Set the factory in the Configurator
{
contract: configurator,
signature: 'setFactory(address,address)',
args: [comet.address, cometFactory.address],
},

// 3. Set the configuration in the Configurator
{
contract: configurator,
signature: '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)[]))',
args: [comet.address, configuration],
},

// 4. Deploy and upgrade to a new version of Comet
{
contract: cometAdmin,
signature: "deployAndUpgradeTo(address,address)",
args: [configurator.address, comet.address],
},

// 5. Set the rewards configuration to COMP
{
contract: rewards,
signature: "setRewardConfig(address,address)",
args: [comet.address, COMPAddress],
},

// 6. Wrap some ETH as WETH
{
contract: WETH,
signature: "deposit()",
args: [],
value: 358052565869157684316n, // 500e18 - current balance
},

// 7. Send all Timelock's WETH to Comet to seed reserves
{
contract: WETH,
signature: "transfer(address,uint256)",
args: [comet.address, exp(500, 18)],
},

// 8. Transfer COMP
{
contract: comptrollerV2,
signature: '_grantComp(address,uint256)',
args: [rewards.address, exp(25_000, 18)],
},
];
const description = "# Initialize LRT";
const txn = await deploymentManager.retry(
async () => trace((await governor.propose(...await proposal(actions, description))))
);

const event = txn.events.find(event => event.event === 'ProposalCreated');
const [proposalId] = event.args;

trace(`Created proposal ${proposalId}.`);
// const trace = deploymentManager.tracer();
// const ethers = deploymentManager.hre.ethers;
// const { utils } = ethers;
Expand Down
1 change: 1 addition & 0 deletions deployments/mainnet/weth-lrt/roots.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
6 changes: 3 additions & 3 deletions deployments/mainnet/weth/relations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
}
}
},
'AppProxyUpgradeable': {
artifact: 'contracts/ERC20.sol:ERC20',
}
// 'AppProxyUpgradeable': {
// artifact: 'contracts/ERC20.sol:ERC20',
// }
};
1 change: 1 addition & 0 deletions scenario/ConfiguratorScenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ scenario.only('upgrade governor', {}, async ({ comet, configurator, timelock, ac
console.log({3: (await configurator.getConfiguration(comet.address))})

Check failure on line 13 in scenario/ConfiguratorScenario.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Missing semicolon
console.log({4: (await configurator.getConfiguration(comet.address)).governor})

Check failure on line 14 in scenario/ConfiguratorScenario.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Missing semicolon
console.log({5: configurator.address})
console.log({6: comet.address})


expect(await comet.governor()).to.equal(timelock.address);
Expand Down
5 changes: 5 additions & 0 deletions src/deploy/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ export async function deployNetworkComet(
console.log('configurator', configurator.address) // 0x316f9708bB98af7dA9c68C1C3b5e79039cD336E3
// Also get a handle for Comet, although it may not *actually* support the interface yet
const comet = await deploymentManager.cast(cometProxy.address, 'contracts/CometInterface.sol:CometInterface');

console.log({2: await configurator.getConfiguration(comet.address), 22: configurator.address, 222: comet.address})
console.log({23: configuratorProxy})
console.log({3: await configuratorProxy.getConfiguration(comet.address), 33: configurator.address, 333: comet.address})
console.log({4: await configuratorImpl.getConfiguration(comet.address), 44: configurator.address, 444: comet.address})
// console.log({XXX: await configuratorImpl.getConfiguration(comet.address)})
// console.log({gole1: await configuratorProxy.getConfiguration(comet.address)})
// console.log({gole: await configurator.getConfiguration(comet.address)})
Expand Down

0 comments on commit 2a385e6

Please sign in to comment.