Skip to content

Commit

Permalink
Merge pull request #222 from VenusProtocol/chore/VEN-2670
Browse files Browse the repository at this point in the history
[VEN-2670]: restore deployment script to configure some price feeds on hardhat
  • Loading branch information
chechu authored Sep 10, 2024
2 parents 4576859 + ee980da commit 2e0f413
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
47 changes: 47 additions & 0 deletions deploy/3-configure-feeds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import hre from "hardhat";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import { Oracles, assets, getOraclesData } from "../helpers/deploymentConfig";

const func: DeployFunction = async function ({ network, deployments, getNamedAccounts }: HardhatRuntimeEnvironment) {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();

const resilientOracle = await hre.ethers.getContract("ResilientOracle");

const oraclesData: Oracles = await getOraclesData();

for (const asset of assets[network.name]) {
const { oracle } = asset;
console.log(`Configuring ${asset.token}`);

await deploy(`Mock${asset.token}`, {
from: deployer,
log: true,
deterministicDeployment: false,
args: [`Mock${asset.token}`, `Mock${asset.token}`, 18],
autoMine: true,
contract: "BEP20Harness",
});

const mock = await hre.ethers.getContract(`Mock${asset.token}`);

console.log(`Configuring resilient oracle for ${asset.token}`);
let tx = await resilientOracle.setTokenConfig({
asset: mock.address,
oracles: oraclesData[oracle].oracles,
enableFlagsForOracles: oraclesData[oracle].enableFlagsForOracles,
});

await tx.wait(1);

console.log(`Configuring ${oracle} oracle for ${asset.token}`);
tx = await oraclesData[oracle].underlyingOracle?.setPrice(mock.address, asset.price);
await tx.wait(1);
}
};

export default func;
func.tags = ["configure"];
func.skip = async env => env.network.live;
62 changes: 62 additions & 0 deletions helpers/deploymentConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,68 @@ export const pythID: Config = {
};

export const assets: Assets = {
hardhat: [
{
token: "BNX",
address: "",
oracle: "chainlinkFixed",
price: "159990000000000000000",
},
{
token: "BTCB",
address: "",
oracle: "chainlinkFixed",
price: "208000000000000000",
},
{
token: "XVS",
address: "",
oracle: "chainlinkFixed",
price: "208000000000000000",
},
{
token: "ANKR",
address: "",
oracle: "chainlinkFixed",
price: "159990000000000000000",
},
{
token: "ankrBNB",
address: "",
oracle: "chainlinkFixed",
price: "159990000000000000000",
},
{
token: "MBOX",
address: "",
oracle: "chainlinkFixed",
price: "159990000000000000000",
},
{
token: "NFT",
address: "",
oracle: "chainlinkFixed",
price: "159990000000000000000",
},
{
token: "RACA",
address: "",
oracle: "chainlinkFixed",
price: "159990000000000000000",
},
{
token: "stkBNB",
address: "",
oracle: "chainlinkFixed",
price: "159990000000000000000",
},
{
token: "USDD",
address: "",
oracle: "chainlinkFixed",
price: "159990000000000000000",
},
],
bsctestnet: [
{
token: "BNX",
Expand Down

0 comments on commit 2e0f413

Please sign in to comment.