-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from bancorprotocol/vortex-withdraw-funds
CarbonVortex - add withdraw funds
- Loading branch information
Showing
10 changed files
with
229 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { DeployedContracts, InstanceName, setDeploymentMetadata, upgradeProxy } from '../../../utils/Deploy'; | ||
import { DeployFunction } from 'hardhat-deploy/types'; | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types'; | ||
|
||
// carbon vortex withdraw funds upgrade | ||
const func: DeployFunction = async ({ getNamedAccounts }: HardhatRuntimeEnvironment) => { | ||
const { deployer, bnt, bancorNetworkV3 } = await getNamedAccounts(); | ||
|
||
const carbonController = await DeployedContracts.CarbonController.deployed(); | ||
|
||
await upgradeProxy({ | ||
name: InstanceName.CarbonVortex, | ||
from: deployer, | ||
args: [bnt, carbonController.address, bancorNetworkV3] | ||
}); | ||
|
||
return true; | ||
}; | ||
|
||
export default setDeploymentMetadata(__filename, func); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { CarbonController, CarbonVortex, ProxyAdmin } from '../../../components/Contracts'; | ||
import { DeployedContracts, describeDeployment } from '../../../utils/Deploy'; | ||
import { expect } from 'chai'; | ||
import { ethers } from 'hardhat'; | ||
|
||
describeDeployment(__filename, () => { | ||
let proxyAdmin: ProxyAdmin; | ||
let carbonController: CarbonController; | ||
let carbonVortex: CarbonVortex; | ||
|
||
beforeEach(async () => { | ||
proxyAdmin = await DeployedContracts.ProxyAdmin.deployed(); | ||
carbonController = await DeployedContracts.CarbonController.deployed(); | ||
carbonVortex = await DeployedContracts.CarbonVortex.deployed(); | ||
}); | ||
|
||
it('should deploy and configure the carbon vortex contract', async () => { | ||
expect(await proxyAdmin.getProxyAdmin(carbonVortex.address)).to.equal(proxyAdmin.address); | ||
expect(await carbonVortex.version()).to.equal(3); | ||
|
||
// check that the carbon vortex is the fee manager | ||
const role = await carbonController.roleFeesManager(); | ||
const roleMembers = await carbonController.getRoleMemberCount(role); | ||
const feeManagers = []; | ||
for (let i = 0; i < roleMembers.toNumber(); ++i) { | ||
const feeManagerAddress = await carbonController.getRoleMember(role, i); | ||
feeManagers.push(feeManagerAddress); | ||
} | ||
expect(feeManagers.includes(carbonVortex.address)).to.be.true; | ||
}); | ||
|
||
it('rewards percentage PPM should be set correctly', async () => { | ||
const rewardsPPM = await carbonVortex.rewardsPPM(); | ||
expect(rewardsPPM).to.be.eq(20_000); | ||
}); | ||
|
||
it('carbon vortex implementation should be initialized', async () => { | ||
const implementationAddress = await proxyAdmin.getProxyImplementation(carbonVortex.address); | ||
const carbonVortexImpl: CarbonVortex = await ethers.getContractAt('CarbonVortex', implementationAddress); | ||
// hardcoding gas limit to avoid gas estimation attempts (which get rejected instead of reverted) | ||
const tx = await carbonVortexImpl.initialize({ gasLimit: 6000000 }); | ||
await expect(tx.wait()).to.be.reverted; | ||
}); | ||
}); |
Submodule forge-std
updated
25 files
+1 −0 | .gitattributes | |
+1 −1 | package.json | |
+635 −0 | scripts/vm.py | |
+1 −1 | src/Script.sol | |
+23 −4 | src/StdChains.sol | |
+111 −10 | src/StdCheats.sol | |
+15 −0 | src/StdInvariant.sol | |
+19 −15 | src/StdJson.sol | |
+54 −3 | src/StdStorage.sol | |
+61 −33 | src/StdUtils.sol | |
+1 −2 | src/Test.sol | |
+981 −378 | src/Vm.sol | |
+234 −0 | src/mocks/MockERC20.sol | |
+235 −0 | src/mocks/MockERC721.sol | |
+93 −77 | test/StdAssertions.t.sol | |
+22 −21 | test/StdChains.t.sol | |
+105 −54 | test/StdCheats.t.sol | |
+13 −11 | test/StdError.t.sol | |
+10 −10 | test/StdMath.t.sol | |
+66 −34 | test/StdStorage.t.sol | |
+4 −4 | test/StdStyle.t.sol | |
+30 −30 | test/StdUtils.t.sol | |
+15 −0 | test/Vm.t.sol | |
+441 −0 | test/mocks/MockERC20.t.sol | |
+721 −0 | test/mocks/MockERC721.t.sol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.