From 6e615250c93fe2a59c2332401b55855cb2a9e403 Mon Sep 17 00:00:00 2001 From: Ivan Zhelyazkov Date: Fri, 23 Aug 2024 12:49:36 +0200 Subject: [PATCH] add vortex 2.0 upgrade script --- .../mainnet/0016-CarbonVortex-upgrade.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 deploy/scripts/mainnet/0016-CarbonVortex-upgrade.ts diff --git a/deploy/scripts/mainnet/0016-CarbonVortex-upgrade.ts b/deploy/scripts/mainnet/0016-CarbonVortex-upgrade.ts new file mode 100644 index 00000000..e296b764 --- /dev/null +++ b/deploy/scripts/mainnet/0016-CarbonVortex-upgrade.ts @@ -0,0 +1,25 @@ +import { DeployFunction } from 'hardhat-deploy/types'; +import { HardhatRuntimeEnvironment } from 'hardhat/types'; +import { DeployedContracts, upgradeProxy, InstanceName, setDeploymentMetadata } from '../../../utils/Deploy'; +import { NATIVE_TOKEN_ADDRESS } from '../../../utils/Constants'; + +/** + * upgrade carbon vortex 2.0 to v2: + * add maxInput to trade function + * fix upgradeable contract + */ +const func: DeployFunction = async ({ getNamedAccounts }: HardhatRuntimeEnvironment) => { + const { deployer, bnt, vault, oldVortex } = await getNamedAccounts(); + const carbonController = await DeployedContracts.CarbonController.deployed(); + + await upgradeProxy({ + name: InstanceName.CarbonVortex, + from: deployer, + args: [carbonController.address, vault, oldVortex, bnt, NATIVE_TOKEN_ADDRESS, bnt], + checkVersion: false + }); + + return true; +}; + +export default setDeploymentMetadata(__filename, func);