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-2275] Prime Deployment Sepolia #425

Merged
merged 12 commits into from
Jan 16, 2024
79 changes: 44 additions & 35 deletions deploy/008-deploy-prime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,47 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();

const networkName = network.name === "bscmainnet" ? "bscmainnet" : "bsctestnet";
const stakingPeriod = networkName === "bscmainnet" ? 90 * 24 * 60 * 60 : 60 * 10;
const TEN_MINUTES = 60 * 10;
const NINETY_DAYS = 90 * 24 * 60 * 60;
const ZERO_ADDRESS = ethers.constants.AddressZero;

interface Config {
[key: string]: number;
}
const stakingPeriod: Config = {
bsctestnet: TEN_MINUTES,
sepolia: TEN_MINUTES,
bscmainnet: NINETY_DAYS,
ethereum: NINETY_DAYS,
};

const xVSVaultPoolId: Config = {
bsctestnet: 1,
sepolia: 0,
bscmainnet: 0,
ethereum: 0,
};

const blocksPerYear: Config = {
bsctestnet: 10_512_000, // 3 sec per block
sepolia: 2_628_000, // 12 sec per block
bscmainnet: 10_512_000,
ethereum: 2_628_000,
};

const networkName: string = network.name;
const maximumXVSCap = ethers.utils.parseEther("100000");
const minimumXVS = ethers.utils.parseEther("1000");
const xVSVaultPoolId = networkName === "bscmainnet" ? 0 : 1;
const xvsVaultAlphaNumerator = 1;
const xvsVaultAlphaDenominator = 2;
const blocksPeryear = 10512000;
const loopsLimit = 20;
const isTimeBased = false; // revise this value when deploying on L2s

await deploy("PrimeLiquidityProvider", {
from: deployer,
log: true,
deterministicDeployment: false,
args: [],
args: [isTimeBased, blocksPerYear[networkName]],
proxy: {
owner: ADDRESSES[networkName].normalVipTimelock,
proxyContract: "OpenZeppelinTransparentProxy",
Expand All @@ -36,17 +62,22 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

const plp = await ethers.getContract("PrimeLiquidityProvider");

const corePoolAddress = ADDRESSES[networkName].unitroller;
const wrappedNativeToken = ADDRESSES[networkName].wbnb;
const nativeMarket = ADDRESSES[networkName].vbnb;

await deploy("Prime", {
from: deployer,
log: true,
deterministicDeployment: false,
args: [
ADDRESSES[networkName].wbnb,
ADDRESSES[networkName].vbnb,
blocksPeryear,
stakingPeriod,
wrappedNativeToken ? wrappedNativeToken : ZERO_ADDRESS,
nativeMarket ? nativeMarket : ZERO_ADDRESS,
blocksPerYear[networkName],
stakingPeriod[networkName],
minimumXVS,
maximumXVSCap,
isTimeBased,
],
proxy: {
owner: ADDRESSES[networkName].normalVipTimelock,
Expand All @@ -56,45 +87,23 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
args: [
ADDRESSES[networkName].xvsVault,
ADDRESSES[networkName].xvs,
xVSVaultPoolId,
xVSVaultPoolId[networkName],
xvsVaultAlphaNumerator,
xvsVaultAlphaDenominator,
ADDRESSES[networkName].acm,
plp.address,
ADDRESSES[networkName].unitroller,
corePoolAddress ? corePoolAddress : ZERO_ADDRESS,
ADDRESSES[networkName].oracle,
loopsLimit,
],
},
},
});

await deploy("XVSVault", {
from: deployer,
log: true,
deterministicDeployment: false,
args: [],
proxy: false,
});

await deploy("PolicyFacet", {
from: deployer,
log: true,
deterministicDeployment: false,
args: [],
proxy: false,
});

await deploy("SetterFacet", {
from: deployer,
log: true,
deterministicDeployment: false,
args: [],
proxy: false,
});
const prime = await ethers.getContract("Prime");
await prime.initializeV2(ADDRESSES[networkName].poolRegistry);

console.log("Transferring Prime ownership to Timelock");
const prime = await ethers.getContract("Prime");
await prime.transferOwnership(ADDRESSES[networkName].normalVipTimelock);

console.log("Transferring PLP ownership to Timelock");
Expand Down
Loading
Loading