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

add cndl example #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions deploy/cndlMainnet/cndlMainnet_bni.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = async () => {
};
module.exports.tags = ["cndlMainnet_bni"];
module.exports.dependencies = [
"cndlMainnet_bni_PriceOracle",
"cndlMainnet_l2_Aave3Factory",
"cndlMainnet_l2_Aave3Vaults",
"cndlMainnet_bni_BNIStrategy",
"cndlMainnet_bni_BNIVault",
];
8 changes: 8 additions & 0 deletions deploy/cndlMainnet/cndlMainnet_bni2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = async () => {
};
module.exports.tags = ["cndlMainnet_bni2"];
module.exports.dependencies = [
"cndlMainnet_l2_Aave3Factory",
"cndlMainnet_l2_Aave3Vaults",
"cndlMainnet_bni_BNIStrategy", // Upgrade BNIStrategy
];
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { ethers } = require("hardhat");
const { common, maticMainnet: network_ } = require("../../parameters");
const { common, cndlMainnet: network_ } = require("../../parameters");
const AddressZero = ethers.constants.AddressZero;

module.exports = async ({ deployments }) => {
Expand Down Expand Up @@ -55,4 +55,4 @@ module.exports = async ({ deployments }) => {
} catch (e) {
}
};
module.exports.tags = ["maticMainnet_bni_BNIStrategy"];
module.exports.tags = ["cndlMainnet_bni_BNIStrategy"];
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { ethers } = require("hardhat");
const { common, maticMainnet: network_ } = require("../../parameters");
const { common, cndlMainnet: network_ } = require("../../parameters");

module.exports = async ({ deployments }) => {
const { deploy } = deployments;
Expand Down Expand Up @@ -49,4 +49,4 @@ module.exports = async ({ deployments }) => {
} catch (e) {
}
};
module.exports.tags = ["maticMainnet_bni_BNIVault"];
module.exports.tags = ["cndlMainnet_bni_BNIVault"];
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ module.exports = async ({ deployments }) => {
} catch (e) {
}
};
module.exports.tags = ["maticMainnet_bni_PriceOracle"];
module.exports.tags = ["cndlMainnet_bni_PriceOracle"];
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ module.exports = async ({ deployments }) => {
}

};
module.exports.tags = ["maticMainnet_l2_Aave3Factory"];
module.exports.tags = ["cndlMainnet_l2_Aave3Factory"];
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { ethers } = require("hardhat");
const { common, maticMainnet: network_ } = require("../../parameters");
const { common, cndlMainnet: network_ } = require("../../parameters");
const AddressZero = ethers.constants.AddressZero;

module.exports = async ({ deployments }) => {
Expand All @@ -11,7 +11,7 @@ module.exports = async ({ deployments }) => {
const vaultFactory = await ethers.getContract("Aave3VaultFactory");

const dataWMATIC = vaultIface.encodeFunctionData("initialize", [
"BNI L2 WMATIC", "bniL2WMATIC",
"BNI L2 WCNDL", "bniL2WCNDL",
common.treasury, common.admin,
priceOracleProxy.address,
network_.Aave3.aPolWMATIC,
Expand Down Expand Up @@ -39,4 +39,4 @@ module.exports = async ({ deployments }) => {
}

};
module.exports.tags = ["maticMainnet_l2_Aave3Vaults"];
module.exports.tags = ["cndlMainnet_l2_Aave3Vaults"];
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ module.exports = async ({ deployments }) => {
}

};
module.exports.tags = ["maticMainnet_l2_upgrade_Aave3Vaults"];
module.exports.tags = ["cndlMainnet_l2_upgrade_Aave3Vaults"];
7 changes: 7 additions & 0 deletions deploy/cndlMainnet/cndlMainnet_upgrade.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = async () => {
};
module.exports.tags = ["cndlMainnet_upgrade"];
module.exports.dependencies = [
"cndlMainnet_l2_upgrade_Aave3Vaults", // BasicAave3Vault
"cndlMainnet_bni_BNIStrategy", // MaticBNIStrategy
];
23 changes: 23 additions & 0 deletions deploy/hardhat_cndl/hardhat_cndl_bni.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const { network } = require("hardhat");

const ERC20_ABI = require("@openzeppelin/contracts-upgradeable/build/contracts/ERC20Upgradeable").abi;

const { common } = require("../../parameters");

module.exports = async () => {

await network.provider.request({method: "hardhat_impersonateAccount", params: [common.admin]});

await network.provider.request({method: "hardhat_impersonateAccount", params: ['0xe7804c37c13166fF0b37F5aE0BB07A3aEbb6e245']});
const usdtHolder = await ethers.getSigner('0xe7804c37c13166fF0b37F5aE0BB07A3aEbb6e245');
const usdt = new ethers.Contract('0xc2132D05D31c914a87C6611C10748AEb04B58e8F', ERC20_ABI, usdtHolder);
await usdt.transfer(deployer.address, await usdt.balanceOf(usdtHolder.address));
};

module.exports.tags = ["hardhat_matic_bni"];
module.exports.dependencies = [
"hardhat_matic_reset",
"maticMainnet_bni_PriceOracle",
"maticMainnet_bni2",
"maticMainnet_bni_BNIVault",
];
20 changes: 20 additions & 0 deletions deploy/hardhat_cndl/hardhat_cndl_reset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { network } = require("hardhat");
require("dotenv").config();

const mainnetUrl = `https://polygon-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_POLYGON_MAINNET_API_KEY}`;
const mainnetBlockNumber = 29697590;

module.exports = async () => {
await network.provider.request({
method: "hardhat_reset",
params: [
{
forking: {
jsonRpcUrl: mainnetUrl,
blockNumber: mainnetBlockNumber,
},
},
],
});
};
module.exports.tags = ["hardhat_matic_reset"];
10 changes: 0 additions & 10 deletions deploy/maticMainnet/maticMainnet_bni.js

This file was deleted.

8 changes: 0 additions & 8 deletions deploy/maticMainnet/maticMainnet_bni2.js

This file was deleted.

7 changes: 0 additions & 7 deletions deploy/maticMainnet/maticMainnet_upgrade.js

This file was deleted.

4 changes: 4 additions & 0 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ module.exports = {
url: `https://testnet.aurora.dev`,
accounts: [process.env.PRIVATE_KEY]
},
cndlMainnet: {
url: `https://rpc.cndlchain.com`,
accounts: [process.env.PRIVATE_KEY]
},
avaxMainnet: {
url: `https://api.avax.network/ext/bc/C/rpc`,
accounts: [process.env.PRIVATE_KEY]
Expand Down
12 changes: 12 additions & 0 deletions parameters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ module.exports = {
}
},

cndlMainnet: {
Aave3: {
aPolWMATIC: "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97",
},
Swap: {
router: "0x1a45c9f823F64c9360b0c3df269F824cf404f82b", // CarthageDEX
SWAP_BASE_TOKEN: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", // WCNDL
USDC: "0x95A0A7953F9292838C0614D690005D5c716E718E",
WCNDL: "0x85FA00f55492B0437b3925381fAaf0E024747627",
}
},

maticMainnet: {
Aave3: {
aPolWMATIC: "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97",
Expand Down
Loading