From 8dd0cb794d1a60c427fbe349eb3493cb1b22e03b Mon Sep 17 00:00:00 2001 From: Spablob Date: Fri, 23 Jun 2023 14:27:09 +0100 Subject: [PATCH] updated ARB vaults deployment scripts --- ..._vault.ts => 33_arb_treasury_vault-10%.ts} | 8 +- scripts/deploy/34_arb_treasury_vault-15%.ts | 116 ++++++++++++++++++ scripts/deploy/35_arb_treasury_vault-20%.ts | 116 ++++++++++++++++++ scripts/deploy/36_arb_treasury_vault-25%.ts | 116 ++++++++++++++++++ 4 files changed, 352 insertions(+), 4 deletions(-) rename scripts/deploy/{33_arb_treasury_vault.ts => 33_arb_treasury_vault-10%.ts} (95%) create mode 100644 scripts/deploy/34_arb_treasury_vault-15%.ts create mode 100644 scripts/deploy/35_arb_treasury_vault-20%.ts create mode 100644 scripts/deploy/36_arb_treasury_vault-25%.ts diff --git a/scripts/deploy/33_arb_treasury_vault.ts b/scripts/deploy/33_arb_treasury_vault-10%.ts similarity index 95% rename from scripts/deploy/33_arb_treasury_vault.ts rename to scripts/deploy/33_arb_treasury_vault-10%.ts index aeff9020..174b4a61 100644 --- a/scripts/deploy/33_arb_treasury_vault.ts +++ b/scripts/deploy/33_arb_treasury_vault-10%.ts @@ -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) { @@ -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: [], @@ -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], @@ -143,7 +143,7 @@ const main = async ({ console.log(error); } }; -main.tags = ["RibbonTreasuryVaultARB"]; +main.tags = ["RibbonTreasuryVaultARB-10%"]; main.dependencies = []; //["ManualVolOracle", "RibbonTreasuryVaultV2Logic"]; export default main; diff --git a/scripts/deploy/34_arb_treasury_vault-15%.ts b/scripts/deploy/34_arb_treasury_vault-15%.ts new file mode 100644 index 00000000..3a87c995 --- /dev/null +++ b/scripts/deploy/34_arb_treasury_vault-15%.ts @@ -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; diff --git a/scripts/deploy/35_arb_treasury_vault-20%.ts b/scripts/deploy/35_arb_treasury_vault-20%.ts new file mode 100644 index 00000000..7689727a --- /dev/null +++ b/scripts/deploy/35_arb_treasury_vault-20%.ts @@ -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; diff --git a/scripts/deploy/36_arb_treasury_vault-25%.ts b/scripts/deploy/36_arb_treasury_vault-25%.ts new file mode 100644 index 00000000..e3008cc6 --- /dev/null +++ b/scripts/deploy/36_arb_treasury_vault-25%.ts @@ -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;