Skip to content

Commit

Permalink
updated ARB vaults deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Spablob committed Jun 23, 2023
1 parent 8b061c3 commit 8dd0cb7
Show file tree
Hide file tree
Showing 4 changed files with 352 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const main = async ({
const { deploy } = deployments;
const { deployer, owner, keeper, admin, feeRecipient } =
await getNamedAccounts();
console.log(`33 - Deploying ARB Treasury Vault on ${network.name}`);
console.log(`33 - Deploying ARB Treasury Vault 10% on ${network.name}`);

const chainId = network.config.chainId;
if (chainId !== CHAINID.ARB_MAINNET) {
Expand Down Expand Up @@ -64,7 +64,7 @@ const main = async ({

// Can't verify pricer because it's compiled with 0.7.3

const strikeSelection = await deploy("ManualStrikeSelectionARB", {
const strikeSelection = await deploy("ManualStrikeSelectionARB-10%", {
contract: "ManualStrikeSelection",
from: deployer,
args: [],
Expand Down Expand Up @@ -126,7 +126,7 @@ const main = async ({
initArgs
);

const proxy = await deploy("RibbonTreasuryVaultARB", {
const proxy = await deploy("RibbonTreasuryVaultARB-10%", {
contract: "AdminUpgradeabilityProxy",
from: deployer,
args: [logicDeployment.address, admin, initData],
Expand All @@ -143,7 +143,7 @@ const main = async ({
console.log(error);
}
};
main.tags = ["RibbonTreasuryVaultARB"];
main.tags = ["RibbonTreasuryVaultARB-10%"];
main.dependencies = []; //["ManualVolOracle", "RibbonTreasuryVaultV2Logic"];

export default main;
116 changes: 116 additions & 0 deletions scripts/deploy/34_arb_treasury_vault-15%.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import { run } from "hardhat";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import {
CHAINID,
ARB_ADDRESS,
} from "../../constants/constants";
import {
AUCTION_DURATION,
PERFORMANCE_FEE,
PREMIUM_DISCOUNT,
} from "../utils/constants";

const main = async ({
network,
deployments,
ethers,
getNamedAccounts,
}: HardhatRuntimeEnvironment) => {
const { BigNumber } = ethers;
const { parseEther } = ethers.utils;
const { deploy } = deployments;
const { deployer, owner, keeper, admin, feeRecipient } =
await getNamedAccounts();
console.log(`34 - Deploying ARB Treasury Vault 15% on ${network.name}`);

const chainId = network.config.chainId;
if (chainId !== CHAINID.ARB_MAINNET) {
console.log(`Error: chainId ${chainId} not supported`);
return;
}

const pricer = await deployments.get("OptionsPremiumPricerARB");

const strikeSelection = await deploy("ManualStrikeSelectionARB-15%", {
contract: "ManualStrikeSelection",
from: deployer,
args: [],
});

console.log(
`RibbonTreasuryVaultARB strikeSelection @ ${strikeSelection.address}`
);

try {
await run("verify:verify", {
address: strikeSelection.address,
constructorArguments: [],
});
} catch (error) {
console.log(error);
}

const logicDeployment = await deployments.get("RibbonTreasuryVaultV2Logic");
const lifecycle = await deployments.get("VaultLifecycleTreasury");

const RibbonTreasuryVault = await ethers.getContractFactory(
"RibbonTreasuryVaultV2",
{
libraries: {
VaultLifecycleTreasury: lifecycle.address,
},
}
);

const initArgs = [
{
_owner: owner,
_keeper: keeper,
_feeRecipient: feeRecipient,
_managementFee: 0,
_performanceFee: PERFORMANCE_FEE,
_tokenName: "Ribbon ARB Treasury Vault",
_tokenSymbol: "rARB-TSRY",
_optionsPremiumPricer: pricer.address,
_strikeSelection: strikeSelection.address,
_premiumDiscount: PREMIUM_DISCOUNT,
_auctionDuration: AUCTION_DURATION,
_period: 30,
_maxDepositors: 30,
_minDeposit: parseEther("50000"),
},
{
isPut: false,
decimals: 18,
asset: ARB_ADDRESS[chainId],
underlying: ARB_ADDRESS[chainId],
minimumSupply: BigNumber.from(10).pow(10),
cap: parseEther("2000000"),
},
];
const initData = RibbonTreasuryVault.interface.encodeFunctionData(
"initialize",
initArgs
);

const proxy = await deploy("RibbonTreasuryVaultARB-15%", {
contract: "AdminUpgradeabilityProxy",
from: deployer,
args: [logicDeployment.address, admin, initData],
});

console.log(`RibbonTreasuryVaultARB Proxy @ ${proxy.address}`);

try {
await run("verify:verify", {
address: proxy.address,
constructorArguments: [logicDeployment.address, admin, initData],
});
} catch (error) {
console.log(error);
}
};
main.tags = ["RibbonTreasuryVaultARB-15%"];
main.dependencies = []; //["OptionsPremiumPricerARB", "RibbonTreasuryVaultV2Logic"];

export default main;
116 changes: 116 additions & 0 deletions scripts/deploy/35_arb_treasury_vault-20%.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import { run } from "hardhat";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import {
CHAINID,
ARB_ADDRESS,
} from "../../constants/constants";
import {
AUCTION_DURATION,
PERFORMANCE_FEE,
PREMIUM_DISCOUNT,
} from "../utils/constants";

const main = async ({
network,
deployments,
ethers,
getNamedAccounts,
}: HardhatRuntimeEnvironment) => {
const { BigNumber } = ethers;
const { parseEther } = ethers.utils;
const { deploy } = deployments;
const { deployer, owner, keeper, admin, feeRecipient } =
await getNamedAccounts();
console.log(`35 - Deploying ARB Treasury Vault 20% on ${network.name}`);

const chainId = network.config.chainId;
if (chainId !== CHAINID.ARB_MAINNET) {
console.log(`Error: chainId ${chainId} not supported`);
return;
}

const pricer = await deployments.get("OptionsPremiumPricerARB");

const strikeSelection = await deploy("ManualStrikeSelectionARB-20%", {
contract: "ManualStrikeSelection",
from: deployer,
args: [],
});

console.log(
`RibbonTreasuryVaultARB strikeSelection @ ${strikeSelection.address}`
);

try {
await run("verify:verify", {
address: strikeSelection.address,
constructorArguments: [],
});
} catch (error) {
console.log(error);
}

const logicDeployment = await deployments.get("RibbonTreasuryVaultV2Logic");
const lifecycle = await deployments.get("VaultLifecycleTreasury");

const RibbonTreasuryVault = await ethers.getContractFactory(
"RibbonTreasuryVaultV2",
{
libraries: {
VaultLifecycleTreasury: lifecycle.address,
},
}
);

const initArgs = [
{
_owner: owner,
_keeper: keeper,
_feeRecipient: feeRecipient,
_managementFee: 0,
_performanceFee: PERFORMANCE_FEE,
_tokenName: "Ribbon ARB Treasury Vault",
_tokenSymbol: "rARB-TSRY",
_optionsPremiumPricer: pricer.address,
_strikeSelection: strikeSelection.address,
_premiumDiscount: PREMIUM_DISCOUNT,
_auctionDuration: AUCTION_DURATION,
_period: 30,
_maxDepositors: 30,
_minDeposit: parseEther("50000"),
},
{
isPut: false,
decimals: 18,
asset: ARB_ADDRESS[chainId],
underlying: ARB_ADDRESS[chainId],
minimumSupply: BigNumber.from(10).pow(10),
cap: parseEther("2000000"),
},
];
const initData = RibbonTreasuryVault.interface.encodeFunctionData(
"initialize",
initArgs
);

const proxy = await deploy("RibbonTreasuryVaultARB-20%", {
contract: "AdminUpgradeabilityProxy",
from: deployer,
args: [logicDeployment.address, admin, initData],
});

console.log(`RibbonTreasuryVaultARB Proxy @ ${proxy.address}`);

try {
await run("verify:verify", {
address: proxy.address,
constructorArguments: [logicDeployment.address, admin, initData],
});
} catch (error) {
console.log(error);
}
};
main.tags = ["RibbonTreasuryVaultARB-20%"];
main.dependencies = []; //["OptionsPremiumPricerARB", "RibbonTreasuryVaultV2Logic"];

export default main;
116 changes: 116 additions & 0 deletions scripts/deploy/36_arb_treasury_vault-25%.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import { run } from "hardhat";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import {
CHAINID,
ARB_ADDRESS,
} from "../../constants/constants";
import {
AUCTION_DURATION,
PERFORMANCE_FEE,
PREMIUM_DISCOUNT,
} from "../utils/constants";

const main = async ({
network,
deployments,
ethers,
getNamedAccounts,
}: HardhatRuntimeEnvironment) => {
const { BigNumber } = ethers;
const { parseEther } = ethers.utils;
const { deploy } = deployments;
const { deployer, owner, keeper, admin, feeRecipient } =
await getNamedAccounts();
console.log(`36 - Deploying ARB Treasury Vault 25% on ${network.name}`);

const chainId = network.config.chainId;
if (chainId !== CHAINID.ARB_MAINNET) {
console.log(`Error: chainId ${chainId} not supported`);
return;
}

const pricer = await deployments.get("OptionsPremiumPricerARB");

const strikeSelection = await deploy("ManualStrikeSelectionARB-25%", {
contract: "ManualStrikeSelection",
from: deployer,
args: [],
});

console.log(
`RibbonTreasuryVaultARB strikeSelection @ ${strikeSelection.address}`
);

try {
await run("verify:verify", {
address: strikeSelection.address,
constructorArguments: [],
});
} catch (error) {
console.log(error);
}

const logicDeployment = await deployments.get("RibbonTreasuryVaultV2Logic");
const lifecycle = await deployments.get("VaultLifecycleTreasury");

const RibbonTreasuryVault = await ethers.getContractFactory(
"RibbonTreasuryVaultV2",
{
libraries: {
VaultLifecycleTreasury: lifecycle.address,
},
}
);

const initArgs = [
{
_owner: owner,
_keeper: keeper,
_feeRecipient: feeRecipient,
_managementFee: 0,
_performanceFee: PERFORMANCE_FEE,
_tokenName: "Ribbon ARB Treasury Vault",
_tokenSymbol: "rARB-TSRY",
_optionsPremiumPricer: pricer.address,
_strikeSelection: strikeSelection.address,
_premiumDiscount: PREMIUM_DISCOUNT,
_auctionDuration: AUCTION_DURATION,
_period: 30,
_maxDepositors: 30,
_minDeposit: parseEther("50000"),
},
{
isPut: false,
decimals: 18,
asset: ARB_ADDRESS[chainId],
underlying: ARB_ADDRESS[chainId],
minimumSupply: BigNumber.from(10).pow(10),
cap: parseEther("2000000"),
},
];
const initData = RibbonTreasuryVault.interface.encodeFunctionData(
"initialize",
initArgs
);

const proxy = await deploy("RibbonTreasuryVaultARB-25%", {
contract: "AdminUpgradeabilityProxy",
from: deployer,
args: [logicDeployment.address, admin, initData],
});

console.log(`RibbonTreasuryVaultARB Proxy @ ${proxy.address}`);

try {
await run("verify:verify", {
address: proxy.address,
constructorArguments: [logicDeployment.address, admin, initData],
});
} catch (error) {
console.log(error);
}
};
main.tags = ["RibbonTreasuryVaultARB-25%"];
main.dependencies = []; //["OptionsPremiumPricerARB", "RibbonTreasuryVaultV2Logic"];

export default main;

0 comments on commit 8dd0cb7

Please sign in to comment.