Skip to content

Commit

Permalink
Refactor proposal to make market live (#640)
Browse files Browse the repository at this point in the history
  • Loading branch information
jflatow committed Dec 29, 2022
1 parent 7ee0f6b commit cf0469a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
6 changes: 3 additions & 3 deletions deployments/mainnet/weth/configuration.json
Expand Up @@ -20,7 +20,7 @@
},
"tracking": {
"indexScale": "1e15",
"baseSupplySpeed": "0e15",
"baseSupplySpeed": "447916666666",
"baseBorrowSpeed": "0e15",
"baseMinForRewards": "1000000e6"
},
Expand All @@ -31,15 +31,15 @@
"borrowCF": 0.90,
"liquidateCF": 0.93,
"liquidationFactor": 0.95,
"supplyCap": "0"
"supplyCap": "9000"
},
"wstETH": {
"address": "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",
"decimals": "18",
"borrowCF": 0.90,
"liquidateCF": 0.93,
"liquidationFactor": 0.95,
"supplyCap": "0"
"supplyCap": "80000"
}
}
}
@@ -1,12 +1,12 @@
import { DeploymentManager, migration } from '../../../../plugins/deployment_manager';
import { calldata, exp, proposal } from '../../../../src/deploy';
import { calldata, exp, getConfigurationStruct, proposal } from '../../../../src/deploy';

import { expect } from 'chai';

const cETHAddress = '0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5';
const COMPAddress = '0xc00e94cb662c3520282e6f5717214004a7f26888';

export default migration('1666906928_raise_supply_caps_and_seed_reserves_and_rewards', {
export default migration('1666906000_configurate_seed_reserves_and_rewards', {
prepare: async (deploymentManager: DeploymentManager) => {
return {};
},
Expand All @@ -15,6 +15,7 @@ export default migration('1666906928_raise_supply_caps_and_seed_reserves_and_rew
const trace = deploymentManager.tracer();
const ethers = deploymentManager.hre.ethers;

const cometFactory = await deploymentManager.fromDep('cometFactory', 'mainnet', 'usdc');
const {
governor,
comptrollerV2,
Expand All @@ -27,6 +28,8 @@ export default migration('1666906928_raise_supply_caps_and_seed_reserves_and_rew
cbETH,
} = await deploymentManager.getContracts();

const configuration = await getConfigurationStruct(deploymentManager);

const actions = [
// 1. Set v2 cETH speeds to 0
{
Expand All @@ -35,22 +38,18 @@ export default migration('1666906928_raise_supply_caps_and_seed_reserves_and_rew
args: [[cETHAddress], [0], [0]],
},

// 2. Increase v3 supply reward speed
// 2. Set the factory in the Configurator
{
contract: configurator,
signature: 'setBaseTrackingSupplySpeed(address,uint64)',
args: [comet.address, exp(38.7 / 86400, 15, 18)], // ~ 38.7 COMP / day cut from v2
signature: 'setFactory(address,address)',
args: [comet.address, cometFactory.address],
},

// 3. Increase supply caps for each of the assets
// 3. Set the configuration in the Configurator
{
contract: configurator,
signature: "updateAssetSupplyCap(address,address,uint128)",
args: [comet.address, wstETH.address, exp(80_000, 18)], // ~ $100M / $1225
}, {
contract: configurator,
signature: "updateAssetSupplyCap(address,address,uint128)",
args: [comet.address, cbETH.address, exp(9_000, 18)], // ~ $10M / $1091
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
Expand Down Expand Up @@ -101,20 +100,25 @@ export default migration('1666906928_raise_supply_caps_and_seed_reserves_and_rew
cbETH,
} = await deploymentManager.getContracts();

// XXX re-align, check more things
// XXX re-write proposal text

// 1.
expect(await comptrollerV2.compSupplySpeeds(cETHAddress)).to.be.equal(0);
expect(await comptrollerV2.compBorrowSpeeds(cETHAddress)).to.be.equal(0);

// 2. & 4.
expect(await comet.baseTrackingSupplySpeed()).to.be.equal(447916666666n);
expect(await comet.baseTrackingBorrowSpeed()).to.be.equal(0);
// 2.
// XXX

// 3. & 4.
expect(await comet.baseTrackingSupplySpeed()).to.be.equal(exp(38.7 / 86400, 15, 18)); // ~ 38.7 COMP / day cut from v2
expect(await comet.baseTrackingBorrowSpeed()).to.be.equal(0);

const wstETHInfo = await comet.getAssetInfoByAddress(wstETH.address);
expect(wstETHInfo.supplyCap).to.be.equal(exp(80_000, 18));
expect(wstETHInfo.supplyCap).to.be.equal(exp(80_000, 18)); // ~ $100M / $1225

const cbETHInfo = await comet.getAssetInfoByAddress(cbETH.address);
expect(cbETHInfo.supplyCap).to.be.equal(exp(9_000, 18));
expect(cbETHInfo.supplyCap).to.be.equal(exp(9_000, 18)); // ~ $10M / $1091

// 5.
const config = await rewards.rewardConfig(comet.address);
Expand Down

0 comments on commit cf0469a

Please sign in to comment.