Skip to content

Commit

Permalink
Merge pull request bancorprotocol#141 from bancorprotocol/carbon-vort…
Browse files Browse the repository at this point in the history
…ex-2.0

Carbon vortex 2.0 deployment scripts
  • Loading branch information
ivanzhelyazkov authored Apr 23, 2024
2 parents e41f16a + f80ebf9 commit 1de8071
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 93 deletions.
2 changes: 1 addition & 1 deletion contracts/vortex/CarbonVortex.sol
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ contract CarbonVortex is ICarbonVortex, Upgradeable, ReentrancyGuardUpgradeable,
* @inheritdoc Upgradeable
*/
function version() public pure override(IVersioned, Upgradeable) returns (uint16) {
return 3;
return 1;
}

/**
Expand Down
7 changes: 7 additions & 0 deletions data/named-accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ const TokenNamedAccounts = {
const BancorNamedAccounts = {
bancorNetworkV3: {
...getAddress(mainnet, '0xeEF417e1D5CC832e619ae18D2F140De2999dD4fB')
},
vault: {
...getAddress(mainnet, ZERO_ADDRESS),
...getAddress(base, '0xD2b2D272c30d9a0ff3DbaFe848DA7e2f194f697F')
},
oldVortex: {
...getAddress(mainnet, '0xba7d1581Db6248DC9177466a328BF457703c8f84')
}
};

Expand Down
16 changes: 16 additions & 0 deletions deploy/scripts/mainnet/0014-ProxyAdmin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { deploy, InstanceName, setDeploymentMetadata } from '../../../utils/Deploy';
import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';

const func: DeployFunction = async ({ getNamedAccounts }: HardhatRuntimeEnvironment) => {
const { deployer } = await getNamedAccounts();

await deploy({
name: InstanceName.ProxyAdmin,
from: deployer
});

return true;
};

export default setDeploymentMetadata(__filename, func);
37 changes: 37 additions & 0 deletions deploy/scripts/mainnet/0015-CarbonVortex.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { NATIVE_TOKEN_ADDRESS } from '../../../utils/TokenData';
import { DeployedContracts, deployProxy, grantRole, InstanceName, setDeploymentMetadata } from '../../../utils/Deploy';
import { Roles } from '../../../utils/Roles';
import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';

/**
* deploy a new instance of carbon vortex v2.0 with the following configuration:
*
* 1. target token is ETH
* 2. final target token is BNT
* 3. transferAddress is BNT (will burn BNT tokens on ETH -> BNT trades)
* 4. CarbonController and Vortex 1.0 are set as withdraw addresses (on execute, tokens will be withdrawn from both)
*/
const func: DeployFunction = async ({ getNamedAccounts }: HardhatRuntimeEnvironment) => {
const { deployer, bnt, vault, oldVortex } = await getNamedAccounts();
const carbonController = await DeployedContracts.CarbonController.deployed();

await deployProxy({
name: InstanceName.CarbonVortex,
from: deployer,
args: [carbonController.address, vault, oldVortex, bnt, NATIVE_TOKEN_ADDRESS, bnt]
});

const carbonVortex = await DeployedContracts.CarbonVortex.deployed();

await grantRole({
name: InstanceName.CarbonController,
id: Roles.CarbonController.ROLE_FEES_MANAGER,
member: carbonVortex.address,
from: deployer
});

return true;
};

export default setDeploymentMetadata(__filename, func);
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
"@types/lodash": "^4.14.191",
"@types/mocha": "^10.0.1",
"@types/node": "^20.3.1",
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@typescript-eslint/parser": "^5.60.0",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"adm-zip": "^0.5.10",
"chai": "^4.3.7",
"chai-arrays": "^2.2.0",
Expand Down
Loading

0 comments on commit 1de8071

Please sign in to comment.