Skip to content

Commit

Permalink
feat: change price feed
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaShWoof committed Sep 17, 2024
1 parent d19607c commit feba30d
Showing 1 changed file with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,24 @@ import { migration } from '../../../../plugins/deployment_manager/Migration';
import { exp, proposal } from '../../../../src/deploy';

const CBBTC_ADDRESS = '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf';
const CBBTC_USD_PRICE_FEED = '0x2665701293fCbEB223D11A08D826563EDcCE423A';

let priceFeedAddress: string;

export default migration('1726215532_add_cbbtc_as_collateral', {
async prepare() {
return {};
async prepare(deploymentManager: DeploymentManager) {
const _cbBTCPriceFeed = await deploymentManager.deploy(
'cbBTC:priceFeed',
'pricefeeds/ScalingPriceFeed.sol',
[
CBBTC_USD_PRICE_FEED, // cbBTC / USD price feed
8 // decimals
]
);
return { cbBTCPriceFeedAddress: _cbBTCPriceFeed.address };
},

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

const cbBTC = await deploymentManager.existing(
Expand All @@ -21,8 +30,12 @@ export default migration('1726215532_add_cbbtc_as_collateral', {
'mainnet',
'contracts/ERC20.sol:ERC20'
);
const cbBTCPricefeed = await deploymentManager.fromDep('WBTC:priceFeed', 'mainnet', 'usdc');
priceFeedAddress = cbBTCPricefeed.address;
const cbBTCPriceFeed = await deploymentManager.existing(
'cbBTC:priceFeed',
cbBTCPriceFeedAddress,
'mainnet'
);
priceFeedAddress = cbBTCPriceFeed.address;
const {
governor,
comet,
Expand All @@ -32,7 +45,7 @@ export default migration('1726215532_add_cbbtc_as_collateral', {

const newAssetConfig = {
asset: cbBTC.address,
priceFeed: cbBTCPricefeed.address,
priceFeed: cbBTCPriceFeed.address,
decimals: await cbBTC.decimals(),
borrowCollateralFactor: exp(0.8, 18),
liquidateCollateralFactor: exp(0.85, 18),
Expand Down

0 comments on commit feba30d

Please sign in to comment.