Skip to content
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

[VEN-2670]: restore deployment script to configure some price feeds on hardhat #222

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading