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

Feat/connect prod #193

Open
wants to merge 5 commits into
base: main
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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "citadel",
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.5",
"@nomiclabs/hardhat-etherscan": "^3.0.4",
"@nomiclabs/hardhat-waffle": "^2.0.3",
"@typechain/ethers-v5": "^10.0.0",
"chai": "^4.3.6",
Expand All @@ -27,4 +28,4 @@
"prepare": "husky install",
"gen-types": "./gen-types.sh"
}
}
}
111 changes: 111 additions & 0 deletions scripts/actions/connectProd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
const hre = require("hardhat");
const ethers = hre.ethers;

const pipeActions = require("../utils/pipeActions");
const prodDeploy = require("./prodDeploy");
const mintForknet = require("./mintForknet");
const getRoleSigners = require("./prod/getRoleSingers");
const initializer = require("./initializer");
const grantRoles = require("./grantRoles");
const setXCitadelStrategy = require("./setXCitadelStrategy");
const citadelMinterSetup = require("./citadelMinterSetup");
const approveFundingTokens = require("./approveFundingTokens");
const medianOracleUpdatePrice = require("./medianOracleUpdatePrice");
const setDiscount = require("./setDiscount");
const bondTokenForXCTDL = require("./bondTokenForXCTDL");
const xCTDLVesting = require("./xCTDLVesting");
const setupKnightingRound = require("./setupKnightingRound");
const setupSchedule = require('./setupSchedule')
const getContractFactories = require("./getContractFactories");

const wbtc_address = "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599";
const cvx_address = "0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b";

const wbtc_minter_address = "0xCA06411bd7a7296d7dbdd0050DFc846E95fEBEB7"; // owner address of wbtc
const cvx_minter_address = "0xF403C135812408BFbE8713b5A23a04b3D48AAE31"; // operator address of cvx

const erc20_mintable_abi = ["function mint(address, uint256)"];

const { feeds,
multisigs,
logics,
proxies } = require('../deploys')

const verify = async (toVerify) => {
// Add Logic Addresses

console.log("Verifying " + toVerify + " ...");
await hre.run("verify:verify", {
address: toVerify,
constructorArguments: [],
});
}

// TODO: Please set this as an env variable to read
// Note that this is the PK to the well-known hardhat node account #1 and will lose all assets if sent
const DEPLOYER_PRIVATE_KEY = "59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"

const connectProd = async () => {
const deployer = new ethers.Wallet(DEPLOYER_PRIVATE_KEY, ethers.provider)

const {
GlobalAccessControl,
CitadelToken,
StakedCitadelVester,
StakedCitadel,
StakedCitadelLocker,
SupplySchedule,
CitadelMinter,
KnightingRound,
Funding,
ERC20Upgradeable,
MedianOracle,
TransparentUpgradeableProxy
} = await getContractFactories();

const gac = GlobalAccessControl.attach(proxies.gac)
console.log("gac: ", gac.address);

const citadel = CitadelToken.attach(proxies.citadel)
console.log("citadel: ", citadel.address);

const xCitadel = StakedCitadel.attach(proxies.xCitadel)
console.log("xCitadel: ", xCitadel.address);

const xCitadelVester = StakedCitadelVester.attach(proxies.xCitadelVester)
console.log("xCitadelVester: ", xCitadelVester.address);

const xCitadelLocker = StakedCitadelVester.attach(proxies.xCitadelLocker)
console.log("xCitadelLocker: ", xCitadelVester.address);

const schedule = SupplySchedule.attach(proxies.schedule)
console.log("schedule: ", schedule.address);

const citadelMinter = CitadelMinter.attach(proxies.citadelMinter)
console.log("citadelMinter: ", citadelMinter.address);

const wbtc = ERC20Upgradeable.attach(wbtc_address);
console.log(`wbtc address is: ${wbtc.address}`);
const cvx = ERC20Upgradeable.attach(cvx_address);
console.log(`cvx address is: ${cvx.address}`);
const usdc = ERC20Upgradeable.attach("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48");
console.log(`usdc address is: ${usdc.address}`);
const renBTC = ERC20Upgradeable.attach("0xeb4c2781e4eba804ce9a9803c67d0893436bb27d");
console.log(`renBTC address is: ${renBTC.address}`);
const ibBTCLP = ERC20Upgradeable.attach("0xaE96fF08771a109dc6650a1BdCa62F2d558E40af");
console.log(`ibBTCLP address is: ${ibBTCLP.address}`);
const wETH = ERC20Upgradeable.attach("0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2");
console.log(`wETH address is: ${wETH.address}`);
const frax = ERC20Upgradeable.attach("0x853d955acef822db058eb8505911ed77f175b99e");
console.log(`frax address is: ${frax.address}`);
const badger = ERC20Upgradeable.attach("0x3472a5a71965499acd81997a54bba8d852c6e53d");
console.log(`badger address is: ${badger.address}`);
const bveCVX = ERC20Upgradeable.attach("0xfd05D3C7fe2924020620A8bE4961bBaA747e6305");
console.log(`bveCVX address is: ${bveCVX.address}`);

// How to verify a contract on etherscan
// await verify("0xd03A04901041ac9313E83C47B23e9ACD1b1E12eE")

};

module.exports = connectProd;
30 changes: 26 additions & 4 deletions scripts/actions/getContractFactories.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,30 @@ const getContractFactories = async () => {
const CitadelMinter = await ethers.getContractFactory("CitadelMinter");

const KnightingRound = await ethers.getContractFactory("KnightingRound");
const KnightingRoundWithEth = await ethers.getContractFactory("KnightingRoundWithEth");

const KnightingRoundRegistry = await ethers.getContractFactory("KnightingRoundRegistry");

const KnightingRoundGuestlist = await ethers.getContractFactory("KnightingRoundGuestlist");

const Funding = await ethers.getContractFactory("Funding");

const ERC20Upgradeable = await ethers.getContractFactory("ERC20Upgradeable");

const KnightingRoundGuestlist = await ethers.getContractFactory(
"KnightingRoundGuestlist"
const CtdlAssetChainlinkProvider = await ethers.getContractFactory(
"CtdlAssetChainlinkProvider"
);
const CtdlBtcChainlinkProvider = await ethers.getContractFactory(
"CtdlBtcChainlinkProvider"
);
const CtdlEthChainlinkProvider = await ethers.getContractFactory(
"CtdlEthChainlinkProvider"
);
const CtdlWbtcCurveV2Provider = await ethers.getContractFactory(
"CtdlWbtcCurveV2Provider"
);
const CtdlWibbtcLpVaultProvider = await ethers.getContractFactory(
"CtdlWibbtcLpVaultProvider"
);

const wBTC = await ethers.getContractFactory("WrapBitcoin");
Expand All @@ -69,6 +86,7 @@ const getContractFactories = async () => {
StakedCitadelVester,
StakedCitadel,
StakedCitadelLocker,
KnightingRoundWithEth,
SupplySchedule,
CitadelMinter,
KnightingRound,
Expand All @@ -82,7 +100,11 @@ const getContractFactories = async () => {
MintableToken,
TransparentUpgradeableProxy,
MedianOracle,
CtdlAssetChainlinkProvider,
CtdlBtcChainlinkProvider,
CtdlEthChainlinkProvider,
CtdlWbtcCurveV2Provider,
CtdlWibbtcLpVaultProvider
};
};

}
module.exports = getContractFactories;
108 changes: 2 additions & 106 deletions scripts/connect-prod.js
Original file line number Diff line number Diff line change
@@ -1,113 +1,9 @@
const hre = require("hardhat");
const StakedCitadelLockerArtifact = require("../artifacts-external/StakedCitadelLocker.json");
const ethers = hre.ethers;
const getContractFactories = require("./utils/getContractFactories");

const testdeploy = {
proxyAdmin: "0x8074Db4de0018b2E9E6866ea02c1eb608F751cCB",
gac: "0xD89AE35cCC177A1C63fdF028f75274C25a00e3c9",
citadel: "0x26FFe8414440fEEf67712C0825BBffE14215F8A0",
xCitadel: "0x56f0EAAB23Edb3f74e463C236Fc6b9e859EDd338",
xCitadelVester: "0x1da6Dae34Fb1e47cfA90FC380e3C562e71aa177B",
xCitadelLocker: "0xf600CdD2b5AC63Fc4142A6A68FEF62Cc8619B49d",
supplySchedule: "0xC46e2765658Ae9b5D320ffC6132ec2A2574b9892",
funding: "0x1857f25A92722F040e3Dd577B078D1acFC2AC924",
citadelMinter: "0x145e8b97730F9D8F21e962F2fc4Cf4Ee192104FD",
knightingRound: "0x01c8550aD29C90d1Dd8c207F29Df3AC41FC2a551",
knightingRoundGuestlist: "0x6debc2E93f6a41be7F4d606f27941FBFfB9E9CE8"
}

const proxies = {
gac: "0xd93550006E351161A6edFf855fc3E588C46ecfB1",
citadel: "0xaF0b1FDf9c6BfeC7b3512F207553c0BA00D7f1A2",
xCitadel: "0xa0FFfb6b575045f215432b3158Ffd0A9ee0454B9",
xCitadelVester: "0x8e8593369263D99013a6e795634510551F49031d",
xCitadelLocker: "0x8b9AAb4BE7b25D7794386F8CC217f2d8a9498ee9",
supplySchedule: "0x90D047E94515af741206033399b3C60114Ed99f2",
citadelMinter: "0x594691aEa75080dd9B3e91e648Db6045d4fF6E22",
knightingRound: "0x366f3e96c7a1dC97C261Ffc5119dD9C2A477860E",
fundingWBTC: "0x2559F79Ffd2b705083A5a23f1fAB4bB03C491435",
fundingCVX: "0x40927b7bc37380b73DBB60b75d6D5EA308Ec2590",
}

const wbtc_address = "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599";
const cvx_address = "0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b";
const usdc_address = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const frax_address = "0x853d955aCEf822Db058eb8505911ED77F175b99e";
const ibbtc_lp_address = "0xaE96fF08771a109dc6650a1BdCa62F2d558E40af";
const bvecvx_address = "0xfd05D3C7fe2924020620A8bE4961bBaA747e6305";

const address = (entity) =>
entity.address ? entity.address : ethers.constants.AddressZero;

const hashIt = (str) => ethers.utils.keccak256(ethers.utils.toUtf8Bytes(str));

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
const connectProd = require("./actions/connectProd");

async function main() {
// const signers = await ethers.getSigners();
const [deployer] = await ethers.getSigners();

/// === Contract Factories
const {
GlobalAccessControl,
CitadelToken,
StakedCitadelVester,
StakedCitadel,
StakedCitadelLocker,
SupplySchedule,
CitadelMinter,
KnightingRound,
Funding,
ERC20Upgradeable,
KnightingRoundGuestlist,
ProxyAdmin
} = await getContractFactories();

/// === Deploying Contracts & loggin addresses
const proxyAdmin = await ProxyAdmin.attach(testdeploy.proxyAdmin);
console.log("proxy admin address is: ", proxyAdmin.address);

const gac = GlobalAccessControl.attach(proxies.gac)
console.log("gac: ", gac.address);

const citadel = CitadelToken.attach(proxies.citadel)
console.log("citadel: ", citadel.address);

const xCitadel = StakedCitadel.attach(proxies.xCitadel)
console.log("xCitadel: ", xCitadel.address);

const xCitadelVester = StakedCitadelVester.attach(proxies.xCitadelVester)
console.log("xCitadelVester: ", xCitadelVester.address);

const schedule = SupplySchedule.attach(proxies.supplySchedule)
console.log("schedule: ", schedule.address);

const citadelMinter = CitadelMinter.attach(proxies.citadelMinter)
console.log("citadelMinter: ", citadelMinter.address);

const knightingRound = KnightingRound.attach(proxies.knightingRound)
console.log("knightingRound: ", knightingRound.address);

const fundingWBTC = Funding.attach(proxies.fundingWBTC)
console.log("fundingWBTC: ", fundingWBTC.address);

const fundingCVX = Funding.attach(proxies.fundingCVX)
console.log("fundingCVX: ", fundingCVX.address);

const knightingRoundGuestlist = KnightingRoundGuestlist.attach(testdeploy.knightingRoundGuestlist);
console.log("knightingRoundGuestlist address is: ", knightingRoundGuestlist.address);

console.log("/n");

const wbtc = ERC20Upgradeable.attach(wbtc_address); //
const cvx = ERC20Upgradeable.attach(cvx_address); //
const usdc = ERC20Upgradeable.attach(usdc_address); //
const frax = ERC20Upgradeable.attach(frax_address); //
const ibbtc_lp = ERC20Upgradeable.attach(ibbtc_lp_address); //
const bvecvx = ERC20Upgradeable.attach(bvecvx_address); //
await connectProd();
}

main()
Expand Down
Loading