-
Notifications
You must be signed in to change notification settings - Fork 40
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 #165 from bancorprotocol/remove-old-vortex-dependency
Remove old vortex dependency
- Loading branch information
Showing
7 changed files
with
117 additions
and
244 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
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 v3: | ||
* remove the old vortex dependency | ||
*/ | ||
const func: DeployFunction = async ({ getNamedAccounts }: HardhatRuntimeEnvironment) => { | ||
const { deployer, bnt, vault } = await getNamedAccounts(); | ||
const carbonController = await DeployedContracts.CarbonController.deployed(); | ||
|
||
await upgradeProxy({ | ||
name: InstanceName.CarbonVortex, | ||
from: deployer, | ||
args: [carbonController.address, vault, bnt, NATIVE_TOKEN_ADDRESS, bnt], | ||
checkVersion: false | ||
}); | ||
|
||
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,33 @@ | ||
import { 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 carbonVortex: CarbonVortex; | ||
|
||
beforeEach(async () => { | ||
proxyAdmin = await DeployedContracts.ProxyAdmin.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); | ||
}); | ||
|
||
it('carbon vortex implementation should be initialized', async () => { | ||
const implementationAddress = await proxyAdmin.getProxyImplementation(carbonVortex.address); | ||
const carbonControllerImpl: CarbonVortex = await ethers.getContractAt('CarbonVortex', implementationAddress); | ||
// hardcoding gas limit to avoid gas estimation attempts (which get rejected instead of reverted) | ||
const tx = await carbonControllerImpl.initialize({ gasLimit: 6000000 }); | ||
await expect(tx.wait()).to.be.reverted; | ||
}); | ||
|
||
it('cannot call postUpgrade on carbon vortex', async () => { | ||
// hardcoding gas limit to avoid gas estimation attempts (which get rejected instead of reverted) | ||
const tx = await carbonVortex.postUpgrade(true, '0x', { gasLimit: 6000000 }); | ||
await expect(tx.wait()).to.be.reverted; | ||
}); | ||
}); |
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.