UNPKG

@mstable/protocol

Version:
39 lines 2.75 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); require("ts-node/register"); require("tsconfig-paths/register"); const config_1 = require("hardhat/config"); const constants_1 = require("@utils/constants"); const taskUtils_1 = require("./taskUtils"); const generated_1 = require("../types/generated"); config_1.task("getBytecode-BoostedDualVault").setAction(async () => { const size = generated_1.BoostedDualVault__factory.bytecode.length / 2 / 1000; if (size > 24.576) { console.error(`BoostedDualVault size is ${size} kb: ${size - 24.576} kb too big`); } else { console.log(`BoostedDualVault = ${size} kb`); } }); config_1.task("BoostedVault.deploy", "Deploys a BoostedVault") .addParam("nexus", "Nexus address", undefined, taskUtils_1.params.address, false) .addParam("proxyAdmin", "ProxyAdmin address", undefined, taskUtils_1.params.address, false) .addParam("rewardsDistributor", "RewardsDistributor address", undefined, taskUtils_1.params.address, false) .addParam("stakingToken", "Staking token address", undefined, taskUtils_1.params.address, false) .addParam("rewardsToken", "Rewards token address", undefined, taskUtils_1.params.address, false) .addParam("vaultName", "Vault name", undefined, config_1.types.string, false) .addParam("vaultSymbol", "Vault symbol", undefined, config_1.types.string, false) .addParam("boostCoefficient", "Boost coefficient", undefined, config_1.types.string, false) .addParam("priceCoefficient", "Price coefficient", undefined, config_1.types.string, false) .setAction(async ({ boostCoefficient, nexus, priceCoefficient, proxyAdmin, rewardsDistributor, rewardsToken, vaultName, vaultSymbol, stakingToken, }, { ethers }) => { const [deployer] = await ethers.getSigners(); const implementation = await new generated_1.BoostedVault__factory(deployer).deploy(nexus, stakingToken, constants_1.DEAD_ADDRESS, priceCoefficient, boostCoefficient, rewardsToken); const receipt = await implementation.deployTransaction.wait(); console.log(`Deployed Vault Implementation to ${implementation.address}. gas used ${receipt.gasUsed}`); const data = implementation.interface.encodeFunctionData("initialize", [rewardsDistributor, vaultName, vaultSymbol]); const assetProxy = await new generated_1.AssetProxy__factory(deployer).deploy(implementation.address, proxyAdmin, data); const assetProxyDeployReceipt = await assetProxy.deployTransaction.wait(); await new generated_1.BoostedVault__factory(deployer).attach(assetProxy.address); console.log(`Deployed Vault Proxy to ${assetProxy.address}. gas used ${assetProxyDeployReceipt.gasUsed}`); }); //# sourceMappingURL=deployBoostedVault.js.map