Skip to content

Commit

Permalink
feat: updated oracles
Browse files Browse the repository at this point in the history
  • Loading branch information
artemwoofsoftware committed Feb 21, 2025
1 parent d9d67cc commit b0b2f8a
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 69 deletions.
72 changes: 39 additions & 33 deletions deployments/ronin/weth/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const HOUR = 60 * 60;
const DAY = 24 * HOUR;

const MAINNET_TIMELOCK = '0x6d903f6003cca6255D85CcA4D3B5E5146dC33925';
const ETH_USD_PRICE_FEED = '0x662Fdb0E7D95d89CD3458E4A3506296E48BB1F44';
const RON_USD_PRICE_FEED = '0x0B6074F21488B95945989E513EFEA070096d931D';
const AXS_USD_PRICE_FEED = '0x81DfC7A054C8F60497e47579c5A5cEB37bc047e8';

export default async function deploy(
deploymentManager: DeploymentManager,
Expand Down Expand Up @@ -48,12 +51,12 @@ async function deployContracts(
'ronin'
);

// pre-deployed OptimismMintableERC20
const COMP = await deploymentManager.existing(
'COMP',
'0x3902228d6a3d2dc44731fd9d45fee6a61c722d0b',
'ronin'
);
// // pre-deployed OptimismMintableERC20
// const COMP = await deploymentManager.existing(
// 'COMP',
// '0x3902228d6a3d2dc44731fd9d45fee6a61c722d0b',
// 'ronin'
// );

const l2CCIPOffRamp = await deploymentManager.existing(
'l2CCIPOffRamp',
Expand Down Expand Up @@ -88,56 +91,59 @@ async function deployContracts(
}
);



const WETHPriceFeed = await deploymentManager.deploy(
'WETH:priceFeed',
'pricefeeds/ConstantPriceFeed.sol',
[
8,
exp(2600, 8),
exp(1, 8),

]
);

const WRONPriceFeed = await deploymentManager.deploy(
'WRON:priceFeed',
'pricefeeds/ConstantPriceFeed.sol',

const WRONMultiplicativePriceFeed = await deploymentManager.deploy(
'wstETH:priceFeed',
'pricefeeds/MultiplicativePriceFeed.sol',
[
8,
exp(10.04, 8)
RON_USD_PRICE_FEED, // RON / USD price feed
ETH_USD_PRICE_FEED, // ETH / USD
8, // decimals
'RON/USD price feed' // description
]
);


const AXSPriceFeed = await deploymentManager.deploy(
'AXS:priceFeed',
'pricefeeds/ConstantPriceFeed.sol',
const AXSMultiplicativePriceFeed = await deploymentManager.deploy(
'wstETH:priceFeed',
'pricefeeds/MultiplicativePriceFeed.sol',
[
8,
exp(4.02, 8),
AXS_USD_PRICE_FEED, // RON / USD price feed
ETH_USD_PRICE_FEED, // ETH / USD
8, // decimals
'AXS/USD price feed' // description
]
);


const USDCPriceFeed = await deploymentManager.deploy(
'USDC:priceFeed',
'pricefeeds/ConstantPriceFeed.sol',
'pricefeeds/ScalingPriceFeed.sol',
[
8,
exp(1, 8),
]
);


const COMPPriceFeed = await deploymentManager.deploy(
'LINK:priceFeed',
'pricefeeds/ConstantPriceFeed.sol',
[
8,
exp(18.4, 18),
ETH_USD_PRICE_FEED, // ETH / USD price feed
8
]
);


// const COMPPriceFeed = await deploymentManager.deploy(
// 'LINK:priceFeed',
// 'pricefeeds/ConstantPriceFeed.sol',
// [
// 8,
// exp(18.4, 18),
// ]
// );


// Deploy all Comet-related contracts
Expand Down Expand Up @@ -165,7 +171,7 @@ async function deployContracts(
l2CCIPOffRamp,
roninl2NativeBridge,
bulker,
COMP
// COMP
// WETH
};
}
69 changes: 37 additions & 32 deletions deployments/ronin/weth/migrations/1689892563_configurate_and_ens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const ENSResolverAddress = '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41';
const ENSSubdomainLabel = 'v3-additional-grants';
const ENSSubdomain = `${ENSSubdomainLabel}.${ENSName}`;
const ENSTextRecordKey = 'v3-official-markets';
const whale = '0xF977814e90dA44bFA03b6295A0616a897441aceC';
//const whale = '0xF977814e90dA44bFA03b6295A0616a897441aceC';

export default migration("1707394874_configurate_and_ens", {
prepare: async (deploymentManager: DeploymentManager) => {
Expand All @@ -44,7 +44,6 @@ export default migration("1707394874_configurate_and_ens", {
l1CCIPRouter,
roninl1NativeBridge,
governor,
COMP,
timelock
} = await govDeploymentManager.getContracts();

Expand Down Expand Up @@ -93,7 +92,7 @@ export default migration("1707394874_configurate_and_ens", {
);


const COMPAmountToBridge = exp(1, 18);
//const COMPAmountToBridge = exp(1, 18);
const ETHAmountToBridge = exp(1, 18);

const ENSResolver = await govDeploymentManager.existing(
Expand All @@ -115,31 +114,31 @@ export default migration("1707394874_configurate_and_ens", {
officialMarketsJSON[baseChainId] = [newMarketObject];
}

await govDeploymentManager.hre.network.provider.request({
method: 'hardhat_impersonateAccount',
params: [whale],
});
// await govDeploymentManager.hre.network.provider.request({
// method: 'hardhat_impersonateAccount',
// params: [whale],
// });



const whaleSigner = await govDeploymentManager.getSigner(whale);
// const whaleSigner = await govDeploymentManager.getSigner(whale);

const tx = await whaleSigner.sendTransaction({
to: Comp,
data: COMP.interface.encodeFunctionData('transfer', [timelock.address, COMPAmountToBridge]),
});
// const tx = await whaleSigner.sendTransaction({
// to: Comp,
// data: COMP.interface.encodeFunctionData('transfer', [timelock.address, COMPAmountToBridge]),
// });

await tx.wait();
//await tx.wait();

const actions = [
{
target: Comp,
signature: "approve(address,uint256)",
calldata: utils.defaultAbiCoder.encode(
["address", "uint256"],
[l1CCIPRouter.address, COMPAmountToBridge]
),
},
// {
// target: Comp,
// signature: "approve(address,uint256)",
// calldata: utils.defaultAbiCoder.encode(
// ["address", "uint256"],
// [l1CCIPRouter.address, COMPAmountToBridge]
// ),
// },
{
contract: roninl1NativeBridge,
signature: "requestDepositFor((address,address,(uint8,uint256,uint256)))",
Expand All @@ -162,10 +161,10 @@ export default migration("1707394874_configurate_and_ens", {
utils.defaultAbiCoder.encode(['address'], [bridgeReceiver.address]),
l2ProposalData,
[
[
Comp,
COMPAmountToBridge
]
// [
// Comp,
// COMPAmountToBridge
// ]
],
ethers.constants.AddressZero,
"0x"
Expand Down Expand Up @@ -217,7 +216,7 @@ export default migration("1707394874_configurate_and_ens", {
const ethers = deploymentManager.hre.ethers;
const { utils } = ethers;
await deploymentManager.spider();
const { comet, rewards, COMP, WETH } = await deploymentManager.getContracts();
const { comet, rewards, WETH } = await deploymentManager.getContracts();

// 1.
// const stateChanges = await diffState(
Expand All @@ -227,16 +226,16 @@ export default migration("1707394874_configurate_and_ens", {
// );
// expect(stateChanges).to.deep.equal({
// WRON: {
// supplyCap: exp(3000000, 18) // 3000000e18
// supplyCap: exp(2500000, 18)
// },
// USDC: {
// supplyCap: exp(400000, 6) // 400000e6
// supplyCap: exp(800000, 6)
// },
// AXS: {
// supplyCap: exp(300000, 18) // 300000e18
// supplyCap: exp(250000, 18)
// }
// baseTrackingSupplySpeed: exp(0 / 86400, 15, 18), // 0
// baseTrackingBorrowSpeed: exp(0 / 86400, 15, 18), // 0
// baseTrackingSupplySpeed: exp(4 / 86400, 15, 18), // 46296296296
// baseTrackingBorrowSpeed: exp(4 / 86400, 15, 18), // 46296296296
// });


Expand All @@ -246,7 +245,7 @@ export default migration("1707394874_configurate_and_ens", {
expect(config.shouldUpscale).to.be.equal(true);

// 4. & 5.
expect(await COMP.balanceOf(rewards.address)).to.be.equal(exp(1, 18));
// expect(await COMP.balanceOf(rewards.address)).to.be.equal(exp(1, 18));
expect(await WETH.balanceOf(comet.address)).to.be.equal(exp(1, 18));

// 6.
Expand Down Expand Up @@ -353,6 +352,12 @@ export default migration("1707394874_configurate_and_ens", {
cometAddress: '0xd98Be00b5D27fc98112BdE293e487f8D4cA57d07',
},
],
59144: [
{
baseSymbol: 'USDC',
cometAddress: '0x8D38A3d6B3c3B7d96D6536DA7Eef94A9d7dbC991'
}
],
534352: [
{
baseSymbol: 'USDC',
Expand Down
9 changes: 5 additions & 4 deletions scripts/clone-multisig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ const SRC_NETWORK = process.env['SRC_NETWORK'] ?? 'mainnet';
const DST_NETWORK = process.env['DST_NETWORK'] ?? 'hardhat';

async function main() {
console.log('SRC_NETWORK:', SRC_NETWORK);
console.log('DST_NETWORK:', DST_NETWORK);
await hre.changeNetwork(SRC_NETWORK);

console.log('Network:', hre.network);
const dm = new DeploymentManager(SRC_NETWORK, 'usdc', hre);

const signer_ = await dm.getSigner();
const signer_ = await new hre.ethers.Wallet(process.env['ETH_PK'], hre.ethers.provider);
const comet = await dm.contract('comet');
const guardian = await comet.pauseGuardian();

Expand All @@ -29,7 +30,7 @@ async function main() {

await hre.changeNetwork(DST_NETWORK);

const signer = await hre.ethers.provider.getSigner(signer_.address);
const signer = await new hre.ethers.Wallet(process.env['ETH_PK'], hre.ethers.provider);
const ethAdapter = new EthersAdapter({ ethers: hre.ethers, signerOrProvider: signer });
const safeFactory = await SafeFactory.create({ ethAdapter: ethAdapter });
const safeSdk = await safeFactory.deploySafe({ safeAccountConfig });
Expand Down

0 comments on commit b0b2f8a

Please sign in to comment.