-
Notifications
You must be signed in to change notification settings - Fork 11
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 #111 from VenusProtocol/governance-integration-tests
Governance integration tests
- Loading branch information
Showing
64 changed files
with
839 additions
and
991 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,20 @@ | ||
import accessControl from '@venusprotocol/governance-contracts/dist/deploy/001-access-control'; | ||
import { DeployFunction } from 'hardhat-deploy/types'; | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { deployments, getNamedAccounts } = hre; | ||
const { deploy } = deployments; | ||
const { deployer } = await getNamedAccounts(); | ||
|
||
await deploy('Timelock', { | ||
from: deployer, | ||
args: [deployer, 3600], | ||
log: true, | ||
autoMine: true, | ||
}); | ||
|
||
await accessControl(hre); | ||
}; | ||
|
||
export default 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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import deployMockTokens from '@venusprotocol/isolated-pools/dist/deploy/001-deploy-mock-tokens'; | ||
|
||
deployMockTokens.skip = async () => process.env.PACKAGE !== 'isolated-pools'; | ||
|
||
export default deployMockTokens; |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import deployOracle from '@venusprotocol/oracle/dist/deploy/1-deploy-oracles'; | ||
|
||
deployOracle.skip = async () => process.env.PACKAGE == 'venus-governance'; | ||
|
||
export default deployOracle; |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import configureFeeds from '@venusprotocol/oracle/dist/deploy/2-configure-feeds'; | ||
|
||
configureFeeds.skip = async () => process.env.PACKAGE == 'venus-governance'; | ||
|
||
export default configureFeeds; |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import deployPoolLens from '@venusprotocol/isolated-pools/dist/deploy/004-swap-router'; | ||
|
||
deployPoolLens.skip = async () => process.env.PACKAGE !== 'isolated-pools'; | ||
|
||
export default deployPoolLens; |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import accessControl from '@venusprotocol/isolated-pools/dist/deploy/005-access-control'; | ||
|
||
accessControl.skip = async () => process.env.PACKAGE !== 'isolated-pools'; | ||
|
||
export default accessControl; |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import deployPoolLens from '@venusprotocol/isolated-pools/dist/deploy/006-deploy-pool-registry'; | ||
|
||
deployPoolLens.skip = async () => process.env.PACKAGE !== 'isolated-pools'; | ||
|
||
export default deployPoolLens; |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import deployPoolLens from '@venusprotocol/isolated-pools/dist/deploy/007-deploy-pool-lens'; | ||
|
||
deployPoolLens.skip = async () => process.env.PACKAGE !== 'isolated-pools'; | ||
|
||
export default deployPoolLens; |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import accessControlConfigure from '@venusprotocol/isolated-pools/dist/deploy/008-deploy-comptrollers'; | ||
|
||
accessControlConfigure.skip = async () => process.env.PACKAGE !== 'isolated-pools'; | ||
|
||
export default accessControlConfigure; |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import deployPoolLens from '@venusprotocol/isolated-pools/dist/deploy/009-deploy-vtokens'; | ||
|
||
deployPoolLens.skip = async () => process.env.PACKAGE !== 'isolated-pools'; | ||
|
||
export default deployPoolLens; |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import deployPoolLens from '@venusprotocol/isolated-pools/dist/deploy/010-deploy-reward-distributors'; | ||
|
||
deployPoolLens.skip = async () => process.env.PACKAGE !== 'isolated-pools'; | ||
|
||
export default deployPoolLens; |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import upgradeComptroller from '@venusprotocol/isolated-pools/dist/deploy/011-initial-liquidity'; | ||
|
||
upgradeComptroller.skip = async () => process.env.PACKAGE !== 'isolated-pools'; | ||
|
||
export default upgradeComptroller; |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import upgradeComptroller from '@venusprotocol/isolated-pools/dist/deploy/012-transfer-pools-ownership'; | ||
|
||
upgradeComptroller.skip = async () => process.env.PACKAGE !== 'isolated-pools'; | ||
|
||
export default upgradeComptroller; |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import upgradeComptroller from '@venusprotocol/isolated-pools/dist/deploy/013-vip-based-config'; | ||
|
||
upgradeComptroller.skip = async () => process.env.PACKAGE !== 'isolated-pools'; | ||
|
||
export default upgradeComptroller; |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import upgradeComptroller from '@venusprotocol/isolated-pools/dist/deploy/014-riskfund-protocolshare'; | ||
|
||
upgradeComptroller.skip = async () => process.env.PACKAGE !== 'isolated-pools'; | ||
|
||
export default upgradeComptroller; |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import upgradeComptroller from '@venusprotocol/isolated-pools/dist/deploy/015-funds-config'; | ||
|
||
upgradeComptroller.skip = async () => process.env.PACKAGE !== 'isolated-pools'; | ||
|
||
export default upgradeComptroller; |
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,64 @@ | ||
import { ethers } from 'hardhat'; | ||
import { DeployFunction } from 'hardhat-deploy/types'; | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { deployments, getNamedAccounts } = hre; | ||
const { deploy } = deployments; | ||
const { deployer } = await getNamedAccounts(); | ||
|
||
const xvsDeployment = await deploy('XVS', { | ||
from: deployer, | ||
args: [deployer], | ||
log: true, | ||
autoMine: true, | ||
}); | ||
const xvsAddress = xvsDeployment.address; | ||
|
||
const xvsVaultDeployment = await deploy('XVSVault', { | ||
from: deployer, | ||
args: [], | ||
log: true, | ||
autoMine: true, | ||
}); | ||
|
||
const xvsVaultAddress = xvsVaultDeployment.address; | ||
|
||
const xvsVaultProxyDeployment = await deploy('XVSVaultProxy', { | ||
from: deployer, | ||
args: [], | ||
log: true, | ||
autoMine: true, | ||
}); | ||
|
||
const xvsVaultProxyAddress = xvsVaultProxyDeployment.address; | ||
|
||
await deploy('XVSStore', { | ||
from: deployer, | ||
args: [], | ||
log: true, | ||
autoMine: true, | ||
}); | ||
|
||
const xvsVault = await ethers.getContract('XVSVault'); | ||
const xvsStore = await ethers.getContract('XVSStore'); | ||
const xvsVaultProxy = await ethers.getContract('XVSVaultProxy'); | ||
const accessControlManager = await ethers.getContract('AccessControlManager'); | ||
|
||
let txn = await xvsVault.setXvsStore(xvsAddress, xvsStore.address); | ||
await txn.wait(1); | ||
|
||
txn = await xvsVault.setAccessControl(accessControlManager.address); | ||
await txn.wait(1); | ||
|
||
// Become Implementation of XVSVaultProxy | ||
await xvsVaultProxy._setPendingImplementation(xvsVaultAddress); | ||
await xvsVault._become(xvsVaultProxyAddress); | ||
|
||
// Set new owner to xvs store | ||
await xvsStore.setNewOwner(xvsVaultAddress); | ||
}; | ||
|
||
func.tags = ['XVS vault']; | ||
|
||
export default 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,78 @@ | ||
import { ethers } from 'hardhat'; | ||
import { DeployFunction } from 'hardhat-deploy/types'; | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { deployments, getNamedAccounts } = hre; | ||
const { deploy } = deployments; | ||
const { deployer } = await getNamedAccounts(); | ||
|
||
const timelock = await ethers.getContract('Timelock'); | ||
const xvsVault = await ethers.getContract('XVSVault'); | ||
|
||
await deploy('GovernorAlpha', { | ||
from: deployer, | ||
args: [timelock.address, xvsVault.address, deployer], | ||
log: true, | ||
autoMine: true, | ||
}); | ||
|
||
await deploy('GovernorAlpha2', { | ||
from: deployer, | ||
args: [timelock.address, xvsVault.address, deployer, 20], | ||
log: true, | ||
autoMine: true, | ||
}); | ||
|
||
const governorBravoDelegateDeployment = await deploy('GovernorBravoDelegate', { | ||
from: deployer, | ||
args: [], | ||
log: true, | ||
autoMine: true, | ||
}); | ||
|
||
const governorBravoDelegate = await ethers.getContractAt( | ||
'GovernorBravoDelegate', | ||
governorBravoDelegateDeployment.address, | ||
); | ||
const minVotingDelay = await governorBravoDelegate.MIN_VOTING_DELAY(); | ||
const minVotingPeriod = await governorBravoDelegate.MIN_VOTING_PERIOD(); | ||
const minProposalThreshold = await governorBravoDelegate.MIN_PROPOSAL_THRESHOLD(); | ||
const proposalConfigs = [ | ||
{ | ||
votingDelay: minVotingDelay.add(3), | ||
votingPeriod: minVotingPeriod.add(3), | ||
proposalThreshold: minProposalThreshold.add(3), | ||
}, | ||
{ | ||
votingDelay: minVotingDelay.add(2), | ||
votingPeriod: minVotingPeriod.add(2), | ||
proposalThreshold: minProposalThreshold.add(2), | ||
}, | ||
{ | ||
votingDelay: minVotingDelay.add(1), | ||
votingPeriod: minVotingPeriod.add(1), | ||
proposalThreshold: minProposalThreshold.add(1), | ||
}, | ||
]; | ||
|
||
const timelocks = [timelock.address, timelock.address, timelock.address]; | ||
|
||
await deploy('GovernorBravoDelegator', { | ||
from: deployer, | ||
args: [ | ||
xvsVault.address, | ||
deployer, | ||
governorBravoDelegate.address, | ||
proposalConfigs, | ||
timelocks, | ||
deployer, | ||
], | ||
log: true, | ||
autoMine: true, | ||
}); | ||
}; | ||
|
||
func.tags = ['Governance']; | ||
|
||
export default 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,31 @@ | ||
import { ethers } from 'hardhat'; | ||
import { DeployFunction } from 'hardhat-deploy/types'; | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { getNamedAccounts } = hre; | ||
const { deployer } = await getNamedAccounts(); | ||
|
||
const accessControlManager = await ethers.getContract('AccessControlManager'); | ||
const xvsVault = await ethers.getContract('XVSVault'); | ||
const xvs = await ethers.getContract('XVS'); | ||
|
||
const tx = await accessControlManager.giveCallPermission( | ||
ethers.constants.AddressZero, | ||
'add(address,uint256,address,uint256,uint256)', | ||
deployer, | ||
); | ||
await tx.wait(); | ||
// Add token pool to xvs vault | ||
const allocPoint = 100; | ||
const token = xvs.address; | ||
const rewardToken = xvs.address; | ||
const rewardPerBlock = ethers.BigNumber.from(10).pow(16).toString(); | ||
const lockPeriod = 300; | ||
|
||
await xvsVault.add(rewardToken, allocPoint, token, rewardPerBlock, lockPeriod); | ||
}; | ||
|
||
func.tags = ['Configure XVS Vault']; | ||
|
||
export default 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
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.