8000 Add wsuperOETHb to cWETHv3 on Base by MishaShWoof · Pull Request #958 · compound-finance/comet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add wsuperOETHb to cWETHv3 on Base #958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 76 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
bba7d99
feat: create comet with extended asset list
MishaShWoof Aug 9, 2024
fc16ae0
feat: move new cometExt to its own contract
MishaShWoof Aug 12, 2024
6b62ee6
fix: clean up
MishaShWoof Aug 12, 2024
d06a3f6
fix: gas optimization 8000
MishaShWoof Aug 12, 2024
d2873ad
fix: more gas optimization
MishaShWoof Aug 12, 2024
5e867a0
fix: linter fix
MishaShWoof Aug 12, 2024
8ab1786
fix: natspec
MishaShWoof Aug 12, 2024
171eb7a
fix: more natspec
MishaShWoof Aug 12, 2024
53f1513
Update index.ts
MishaShWoof Aug 23, 2024
8df38e6
fix: remove unused iterface
MishaShWoof Aug 26, 2024
70e8a73
feat: add prepare and enact for simulation
MishaShWoof Aug 26, 2024
4c0a8f4
fix: fix to workflow
MishaShWoof Aug 26, 2024
c29f4b9
Update enact-migration.yaml
MishaShWoof Aug 26, 2024
cf08c19
fix: reverse
MishaShWoof Aug 26, 2024
71fee7b
feat: add prepare and enact workflow
MishaShWoof Aug 26, 2024
57d04f7
feat: update enact migration script
dmitriy-woof-software Aug 26, 2024
f0c33a1
feat: update enact migration script
dmitriy-woof-software Aug 26, 2024
df2d152
feat: update enact migration script
dmitriy-woof-software Aug 26, 2024
92937aa
feat: update enact migration script
dmitriy-woof-software Aug 26, 2024
b72092c
fix: remove verification from simulatative migration
MishaShWoof Aug 27, 2024
ea15450
Merge branch 'main' of github.com:woof-software/comet into woof-softw…
MishaShWoof Sep 17, 2024
dfe98c9
feat: fixes after audit
MishaShWoof Sep 19, 2024
4f2ba04
fix: working tests
MishaShWoof Sep 19, 2024
e641f95
fix: no network issue resolved
MishaShWoof Dec 13, 2024
986efa2
Merge branch 'main' into woof-software/collateral-extension
MishaShWoof Dec 20, 2024
5c75787
fix: audit fixes
MishaShWoof Dec 23, 2024
4e41a94
fix
MishaShWoof Dec 23, 2024
547e934
Merge branch 'woof-software/fix-to-no-network' of github.com:woof-sof…
MishaShWoof Dec 23, 2024
6635049
feat: working scenarios
MishaShWoof Dec 26, 2024
4ba3b92
feat: migrations and working scenarios
MishaShWoof Dec 27, 2024
c792011
fix
MishaShWoof Dec 27, 2024
9d67b33
fix: secret fix for scroll
MishaShWoof Dec 27, 2024
978dec0
fix: increase arbitrary number
MishaShWoof Dec 27, 2024
b6fb6a2
fix: scroll scan fix
MishaShWoof Dec 27, 2024
6a7f18a
feat: migrations and descriptions
MishaShWoof Jan 6, 2025
d7d9c2c
fix
MishaShWoof Jan 6, 2025
262fb3b
update descriptions
dmitriy-woof-software Jan 14, 2025
1b4307b
fix
MishaShWoof Jan 14, 2025
2381830
fix: review fix
MishaShWoof Jan 14, 2025
40e0370
fix: naming fix
MishaShWoof Jan 14, 2025
fb9f9b5
fix: optimizer
MishaShWoof Jan 14, 2025
f4860cf
fix: second optimizer fix
MishaShWoof Jan 14, 2025
94131ad
fix: optimization
MishaShWoof Jan 15, 2025
b6ff78e
Merge pull request #100 from woof-software/woof-software/collateral-e…
MishaShWoof Jan 17, 2025
5fe26a2
fix: merge fix
MishaShWoof Jan 17, 2025
d3522dc
fix: extension delegate fix and linter fix
MishaShWoof Jan 23, 2025
dd7e23f
fix: no network issue fix and migration for wsuperOETHb
MishaShWoof Jan 27, 2025
a875abb
fix: pr link
MishaShWoof Jan 27, 2025
d8ac7a5
feat: add force push for ext deployment
dmitriy-woof-software Jan 28, 2025
370f22a
fix: clean up debug
MishaShWoof Jan 28, 2025
4351754
Modified migration from GitHub Actions
Jan 28, 2025
d9b644a
Squash 24 Collaterals
MishaShWoof Jan 29, 2025
5ef60f7
Merge branch 'woof-software/collateral-extension' of github.com:woof-…
MishaShWoof Jan 29, 2025
ba0e373
Merge branch 'woof-software/squash-superoethb-to-base-weth' of github…
MishaShWoof Jan 29, 2025
8d2b5af
feat: skip governance update proposal
dmitriy-woof-software Jan 29, 2025
9dff2fd
feat: make 24 collaterals update enacted for base network
dmitriy-woof-software Jan 29, 2025
56e20cc
fix: fixes after audit
MishaShWoof Jan 30, 2025
6fda51a
fix: opcode fix
MishaShWoof Feb 6, 2025
344e8c0
fix: forge fix
MishaShWoof Feb 6, 2025
091c0bc
fix: forge test
MishaShWoof Feb 6, 2025
6cd2191
fix: forge test
MishaShWoof Feb 6, 2025
02a96fa
fix: scenarios
MishaShWoof Feb 6, 2025
0707d18
Trigger actions
dmitriy-woof-software Feb 7, 2025
ff81ff3
fix: remove repeatable deployments issue
MishaShWoof Feb 7, 2025
d4850ea
fix: new governance fix
MishaShWoof Feb 7, 2025
a82a1b0
fix: base usds contract support and scroll prepare fix
MishaShWoof Feb 7, 2025
6788ac6
update Seacrest commit hash to support scroll network
dmitriy-woof-software Feb 11, 2025
f0db6dd
feat: update node version to 18 in enact script
dmitriy-woof-software Feb 11, 2025
6634200
feat: re-use 24 collaterals comet factory and asset list factory
dmitriy-woof-software Feb 11, 2025
acd8af0
feat: fix prepare
dmitriy-woof-software Feb 11, 2025
0d26845
Trigger actions
dmitriy-woof-software Feb 20, 2025
8b054ab
Merge branch 'woof-software/collateral-extension' of github.com:woof-…
MishaShWoof Feb 20, 2025
e77eb81
Merge branch 'woof-software/add-wsuperoethb-to-base-weth' of https://…
MishaShWoof Feb 20, 2025
8bf916f
Update hardhat.config.ts
MishaShWoof Feb 20, 2025
a4c40a7
Merge branch 'main' of github.com:woof-software/comet into woof-softw…
MishaShWoof Mar 14, 2025
043a4d2
Modified migration from GitHub Actions
Mar 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import { expect } from 'chai';
import { DeploymentManager } from '../../../../plugins/deployment_manager/DeploymentManager';
import { migration } from '../../../../plugins/deployment_manager/Migration';
import { calldata, exp, proposal } from '../../../../src/deploy';
import { utils } from 'ethers';

const WSUPEROETHB_ADDRESS = '0x7FcD174E80f264448ebeE8c88a7C4476AAF58Ea6';
let newPriceFeedAddress: string;

export default migration('1737981787_add_wsuperoethb_as_collateral', {
async prepare(deploymentManager: DeploymentManager) {
const ethPriceFeed = await deploymentManager.fromDep('WETH:priceFeed', 'base', 'weth');
const _wsuperOETHbPriceFeed = await deploymentManager.deploy(
'wsuperOETHb:priceFeed',
'pricefeeds/PriceFeedWith4626Support.sol',
[
WSUPEROETHB_ADDRESS, // wsuperOETHb / superOETHb price feed
ethPriceFeed.address, // constant ETH price feed (we consider 1 superOETHb = 1 ETH)
8, // decimals
'wsuperOETHb / ETH price feed', // description
]
);

return { wsuperOETHbPriceFeedAddress: _wsuperOETHbPriceFeed.address };
},

enact: async (
deploymentManager: DeploymentManager,
govDeploymentManager: DeploymentManager,
{ wsuperOETHbPriceFeedAddress }
) => {
const trace = deploymentManager.tracer();

const wsuperOETHb = await deploymentManager.existing(
'wsuperOETHb',
WSUPEROETHB_ADDRESS,
'base',
'contracts/ERC20.sol:ERC20'
);
const wsuperOETHbPriceFeed = await deploymentManager.existing(
'wsuperOETHb:priceFeed',
wsuperOETHbPriceFeedAddress,
'base'
);

const {
bridgeReceiver,
comet,
cometAdmin,
configurator,
} = await deploymentManager.getContracts();

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

const newAssetConfig = {
asset: wsuperOETHb.address,
priceFeed: wsuperOETHbPriceFeed.address,
decimals: await wsuperOETHb.decimals(),
borrowCollateralFactor: exp(0.88, 18),
liquidateCollateralFactor: exp(0.90, 18),
liquidationFactor: exp(0.95, 18),
supplyCap: exp(2000, 18),
};

newPriceFeedAddress = wsuperOETHbPriceFeed.address;

const addAssetCalldata = await calldata(
configurator.populateTransaction.addAsset(comet.address, newAssetConfig)
);
const deployAndUpgradeToCalldata = utils.defaultAbiCoder.encode(
['address', 'address'],
[configurator.address, comet.address]
);

const l2ProposalData = utils.defaultAbiCoder.encode(
['address[]', 'uint256[]', 'string[]', 'bytes[]'],
[
[configurator.address, cometAdmin.address],
[0, 0],
[
'addAsset(address,(address,address,uint8,uint64,uint64,uint64,uint128))',
'deployAndUpgradeTo(address,address)',
],
[addAssetCalldata, deployAndUpgradeToCalldata],
]
);

const mainnetActions = [
// Send the proposal to the L2 bridge
{
contract: baseL1CrossDomainMessenger,
signature: 'sendMessage(address,bytes,uint32)',
args: [bridgeReceiver.address, l2ProposalData, 3_000_000]
},
];

const description = '# Add wsuperOETHb as collateral into cWETHv3 on Base\n\n## Proposal summary\n\nCompound Growth Program [AlphaGrowth] proposes to add wsuperOETHb into cWETHv3 on Base network. This proposal takes the governance steps recommended and necessary to update a Compound III WETH market on Base. 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 off of the [recommendations from Gauntlet](https://www.comp.xyz/t/add-collateral-wsuperoethb-on-base/5782/2).\n\nFurther detailed information can be found on the corresponding [proposal pull request](https://github.com/compound-finance/comet/pull/958) and [forum discussion](https://www.comp.xyz/t/add-collateral-wsuperoethb-on-base/5782).\n\n\n## Proposal Actions\n\nThe first proposal action adds wsuperOETHb to the WETH Comet on Base. This sends the encoded `addAsset` and `deployAndUpgradeTo` calls across the bridge to the governance receiver on Base.';
const txn = await govDeploymentManager.retry(async () =>
trace(
await governor.propose(...(await proposal(mainnetActions, description)))
)
);

const event = txn.events.find(
(event) => event.event === 'ProposalCreated'
);
const [proposalId] = event.args;
trace(`Created proposal ${proposalId}.`);
},

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

async verify(deploymentManager: DeploymentManager) {
const { comet, configurator } = await deploymentManager.getContracts();

const wsuperOETHbAssetIndex = Number(await comet.numAssets()) - 1;

const wsuperOETHbAssetConfig = {
asset: WSUPEROETHB_ADDRESS,
priceFeed: newPriceFeedAddress,
decimals: 18,
borrowCollateralFactor: exp(0.88, 18),
liquidateCollateralFactor: exp(0.90, 18),
liquidationFactor: exp(0.95, 18),
supplyCap: exp(2000, 18),
};

// 1. Compare proposed asset config with Comet asset info
const wsuperOETHbAssetInfo = await comet.getAssetInfoByAddress(WSUPEROETHB_ADDRESS);
expect(wsuperOETHbAssetIndex).to.be.equal(wsuperOETHbAssetInfo.offset);
expect(wsuperOETHbAssetConfig.asset).to.be.equal(wsuperOETHbAssetInfo.asset);
expect(wsuperOETHbAssetConfig.priceFeed).to.be.equal(wsuperOETHbAssetInfo.priceFeed);
expect(exp(1, wsuperOETHbAssetConfig.decimals)).to.be.equal(wsuperOETHbAssetInfo.scale);
expect(wsuperOETHbAssetConfig.borrowCollateralFactor).to.be.equal(wsuperOETHbAssetInfo.borrowCollateralFactor);
expect(wsuperOETHbAssetConfig.liquidateCollateralFactor).to.be.equal(wsuperOETHbAssetInfo.liquidateCollateralFactor);
expect(wsuperOETHbAssetConfig.liquidationFactor).to.be.equal(wsuperOETHbAssetInfo.liquidationFactor);
expect(wsuperOETHbAssetConfig.supplyCap).to.be.equal(wsuperOETHbAssetInfo.supplyCap);

// 2. Compare proposed asset config with Configurator asset config
const configuratorWsuperOETHbAssetConfig = (await configurator.getConfiguration(comet.address)).assetConfigs[wsuperOETHbAssetIndex];
expect(wsuperOETHbAssetConfig.asset).to.be.equal(configuratorWsuperOETHbAssetConfig.asset);
expect(wsuperOETHbAssetConfig.priceFeed).to.be.equal(configuratorWsuperOETHbAssetConfig.priceFeed);
expect(wsuperOETHbAssetConfig.decimals).to.be.equal(configuratorWsuperOETHbAssetConfig.decimals);
expect(wsuperOETHbAssetConfig.borrowCollateralFactor).to.be.equal(configuratorWsuperOETHbAssetConfig.borrowCollateralFactor);
expect(wsuperOETHbAssetConfig.liquidateCollateralFactor).to.be.equal(configuratorWsuperOETHbAssetConfig.liquidateCollateralFactor);
expect(wsuperOETHbAssetConfig.liquidationFactor).to.be.equal(configuratorWsuperOETHbAssetConfig.liquidationFactor);
expect(wsuperOETHbAssetConfig.supplyCap).to.be.equal(configuratorWsuperOETHbAssetConfig.supplyCap);
},
});
8 changes: 8 additions & 0 deletions deployments/base/weth/relations.ts
6D47
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,12 @@ export default {
}
},

WOETHBaseProxy: {
artifact: 'contracts/ERC20.sol:ERC20',
delegates: {
field: {
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc'
}
}
},
};
1 change: 1 addition & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ const config: HardhatUserConfig = {
hardforkHistory: {
berlin: 1,
london: 2,
shanghai: 3,
},
};
return acc;
Expand Down
4 changes: 2 additions & 2 deletions scenario/constraints/MigrationConstraint.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { StaticConstraint, Solution, World, debug } from '../../plugins/scenario';
import { CometContext, MigrationData } from '../context/CometContext';
import { Migration, loadMigrations, Actions } from '../../plugins/deployment_manager/Migration';
import { modifiedPaths, subsets } from '../utils';
import { modifiedPaths } from '../utils';
import { DeploymentManager } from '../../plugins/deployment_manager';
import { impersonateAddress } from '../../plugins/scenario/utils';
import { exp } from '../../test/helpers';
Expand All @@ -22,7 +22,7 @@ export class MigrationConstraint<T extends CometContext> implements StaticConstr
async solve(world: World) {
const label = `[${world.base.name}] {MigrationConstraint}`;
const solutions: Solution<T>[] = [];
const migrationPaths = [...subsets(await getMigrations(world))];
const migrationPaths = [await getMigrations(world)];

for (const migrationList of migrationPaths) {
if (migrationList.length == 0 && migrationPaths.length > 1) {
Expand Down
3 changes: 1 addition & 2 deletions scripts/liquidation_bot/liquidateUnderwaterBorrowers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ export const flashLoanPools = {
tokenAddress: addresses.mainnet.WETH9,
poolFee: 500
},
}
},
},
polygon: {
usdc: {
tokenAddress: addresses.polygon.BOB,
Expand Down
1 change: 1 addition & 0 deletions src/deploy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export const WHALES = {
'0x651C9D1F9da787688225f49d63ad1623ba89A8D5', // FBTC whale
'0xC455fE28a76da80022d4C35A37eB08FF405Eb78f', // FBTC whale
'0x524db930F0886CdE7B5FFFc920Aae85e98C2abfb', // FBTC whale
'0x651C9D1F9da787688225f49d63ad1623ba89A8D5', // FBTC whale
'0x72c7d27320e042417506e594697324dB5Fbf334C', // FBTC whale
'0x3880233e78966eb13a9c2881d5f162d646633178', // FBTC whale
'0x233493E9DC68e548AC27E4933A600A3A4682c0c3', // FBTC whale
Expand Down
0