-
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.
- Loading branch information
Showing
8 changed files
with
143 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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('XVSVault', { | ||
from: deployer, | ||
args: [], | ||
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,66 @@ | ||
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 timelockDeployment = await deploy('Timelock', { | ||
from: deployer, | ||
args: [deployer, 3600], | ||
log: true, | ||
autoMine: true, | ||
}); | ||
|
||
const governorBravoDelegateDeployment = await deploy('GovernorBravoDelegate', { | ||
from: deployer, | ||
args: [], | ||
log: true, | ||
autoMine: true, | ||
}); | ||
|
||
const xvsVault = await ethers.getContract('XVSVault'); | ||
|
||
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 = [ | ||
timelockDeployment.address, | ||
timelockDeployment.address, | ||
timelockDeployment.address, | ||
]; | ||
// await deploy("GovernorBravoDelegator", { | ||
// from: deployer, | ||
// args: [timelockDeployment.address, xvsVault.address, deployer, governorBravoDelegate.address, 30, 30, 100, deployer], | ||
// log: true, | ||
// autoMine: true, | ||
// }); | ||
await governorBravoDelegate.initialize(xvsVault.address, proposalConfigs, timelocks, deployer); | ||
}; | ||
|
||
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,29 @@ | ||
// import accessControll from '@venusprotocol/governance-contracts/dist/deploy/001-access-control'; | ||
// export default accessControll; | ||
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 acmDeployment = await deploy('AccessControlManager', { | ||
from: deployer, | ||
args: [], | ||
log: true, | ||
autoMine: true, | ||
}); | ||
|
||
const acm = await ethers.getContractAt('AccessControlManager', acmDeployment.address); | ||
|
||
console.log( | ||
`Renouncing DEFAULT_ADMIN_ROLE from deployer (${deployer}) for ${hre.network.name} network`, | ||
); | ||
await acm.renounceRole(acm.DEFAULT_ADMIN_ROLE(), deployer); | ||
}; | ||
|
||
func.tags = ['AccessControl']; | ||
|
||
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,6 +1,6 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
pragma solidity 0.8.13; | ||
import "@openzeppelin/contracts/access/AccessControl.sol"; | ||
import "@venusprotocol/governance-contracts/contracts/Governance/AccessControlManager.sol"; | ||
import "../../governance/contracts/Governance/AccessControlManager.sol"; | ||
|
||
contract AccessControlManagerScenario is AccessControlManager {} |
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
12 changes: 12 additions & 0 deletions
12
patches/@venusprotocol+governance-contracts+1.0.1-dev.5.patch
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,12 @@ | ||
diff --git a/node_modules/@venusprotocol/governance-contracts/contracts/Governance/GovernorBravoDelegate.sol b/node_modules/@venusprotocol/governance-contracts/contracts/Governance/GovernorBravoDelegate.sol | ||
index 7169423..bfe0b64 100644 | ||
--- a/node_modules/@venusprotocol/governance-contracts/contracts/Governance/GovernorBravoDelegate.sol | ||
+++ b/node_modules/@venusprotocol/governance-contracts/contracts/Governance/GovernorBravoDelegate.sol | ||
@@ -115,7 +115,6 @@ contract GovernorBravoDelegate is GovernorBravoDelegateStorageV2, GovernorBravoE | ||
address guardian_ | ||
) public { | ||
require(address(proposalTimelocks[0]) == address(0), "GovernorBravo::initialize: cannot initialize twice"); | ||
- require(msg.sender == admin, "GovernorBravo::initialize: admin only"); | ||
require(xvsVault_ != address(0), "GovernorBravo::initialize: invalid xvs address"); | ||
require(guardian_ != address(0), "GovernorBravo::initialize: invalid guardian"); | ||
require( |
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