Skip to content

Commit

Permalink
refactor: remove bnb address from configs
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Dec 5, 2023
1 parent 7d78545 commit 6d3a573
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 183 deletions.
8 changes: 8 additions & 0 deletions copy_contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@ mkdir -p ./contracts/protocol
cp -rf ./node_modules/@venusprotocol/venus-protocol/contracts/ ./contracts/protocol/contracts
rm -rf contracts/protocol/contracts/test

mkdir -p ./contracts/protocol-reserve
cp -rf ./node_modules/@venusprotocol/protocol-reserve/contracts/ ./contracts/protocol-reserve/contracts
rm -rf contracts/protocol-reserve/contracts/Test

mkdir -p ./contracts/governance/contracts/Governance
mkdir -p ./contracts/governance/contracts/legacy
mkdir -p ./contracts/governance/contracts/test

cp -rf ./node_modules/@venusprotocol/governance-contracts/contracts/legacy ./contracts/governance/contracts
cp ./node_modules/@venusprotocol/governance-contracts/contracts/test/TestTimelockV8.sol ./contracts/governance/contracts/test/TestTimelockV8.sol
cp ./node_modules/@venusprotocol/governance-contracts/contracts/Governance/GovernorBravoInterfaces.sol ./contracts/governance/contracts/Governance/GovernorBravoInterfaces.sol
cp ./node_modules/@venusprotocol/governance-contracts/contracts/Governance/TimelockV8.sol ./contracts/governance/contracts/Governance/TimelockV8.sol

rm -rf contracts/protocol/contracts/Lens/VenusLens.sol

Expand Down
14 changes: 3 additions & 11 deletions deploy/000-governance-access-control.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import accessControl from '@venusprotocol/governance-contracts/dist/deploy/001-access-control';
import timelock from '@venusprotocol/governance-contracts/dist/deploy/001-timelock';
import accessControl from '@venusprotocol/governance-contracts/dist/deploy/002-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 timelock(hre);

await accessControl(hre);
};
Expand Down
2 changes: 1 addition & 1 deletion deploy/003-configure-feeds.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import configureFeeds from '@venusprotocol/oracle/dist/deploy/2-configure-feeds';
import configureFeeds from '@venusprotocol/oracle/dist/deploy/3-configure-feeds';

export default configureFeeds;
22 changes: 3 additions & 19 deletions deploy/018-governance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployer } = await getNamedAccounts();
const signers = await ethers.getSigners();

const timelock = await ethers.getContract('Timelock');
const timelock = await ethers.getContract('CriticalTimelock');
const xvsVault = await ethers.getContract('XVSVaultProxy');

await deploy('GovernorAlphaTimelock', {
contract: 'Timelock',
from: deployer,
args: [deployer, 3600],
log: true,
autoMine: true,
});

const governorAlphaTimelock = await ethers.getContract('GovernorAlphaTimelock');
const governorAlphaTimelock = await ethers.getContract('CriticalTimelock');
await deploy('GovernorAlpha', {
from: deployer,
args: [governorAlphaTimelock.address, xvsVault.address, deployer],
Expand Down Expand Up @@ -47,15 +39,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

await governorAlpha.__acceptAdmin();

await deploy('GovernorAlpha2Timelock', {
contract: 'Timelock',
from: deployer,
args: [deployer, 3600],
log: true,
autoMine: true,
});

const governorAlpha2Timelock = await ethers.getContract('GovernorAlpha2Timelock');
const governorAlpha2Timelock = await ethers.getContract('CriticalTimelock');

await deploy('GovernorAlpha2', {
from: deployer,
Expand Down
1 change: 0 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ const config: HardhatUserConfig = {
paths: [
'@venusprotocol/governance-contracts/contracts/Governance/Timelock.sol',
'@venusprotocol/governance-contracts/contracts/Governance/GovernorBravoDelegate.sol',
'@venusprotocol/governance-contracts/contracts/Governance/GovernorBravoDelegator.sol',
],
},
mocha: {
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
"@types/node": "^20.5.9",
"@typescript-eslint/eslint-plugin": "^5.40.1",
"@typescript-eslint/parser": "^5.40.1",
"@venusprotocol/governance-contracts": "^1.4.0-dev.6",
"@venusprotocol/governance-contracts": "^1.4.0-dev.7",
"@venusprotocol/isolated-pools": "^2.3.0-dev.4",
"@venusprotocol/oracle": "^1.7.3-dev.1",
"@venusprotocol/oracle": "^1.8.0-dev.5",
"@venusprotocol/venus-protocol": "^6.1.0-dev.5",
"assemblyscript": "0.19.23",
"chai": "^4.3.6",
Expand Down Expand Up @@ -86,5 +86,8 @@
"packageManager": "yarn@3.2.2",
"_moduleAliases": {
"@nomiclabs/hardhat-ethers": "node_modules/hardhat-deploy-ethers"
},
"dependencies": {
"@venusprotocol/protocol-reserve": "^1.1.0"
}
}
133 changes: 0 additions & 133 deletions patches/@venusprotocol+governance-contracts+1.4.0-dev.6.patch

This file was deleted.

30 changes: 30 additions & 0 deletions patches/@venusprotocol+governance-contracts+1.4.0-dev.7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/node_modules/@venusprotocol/governance-contracts/contracts/legacy/GovernorAlpha.sol b/node_modules/@venusprotocol/governance-contracts/contracts/legacy/GovernorAlpha.sol
index fca5350..4713034 100644
--- a/node_modules/@venusprotocol/governance-contracts/contracts/legacy/GovernorAlpha.sol
+++ b/node_modules/@venusprotocol/governance-contracts/contracts/legacy/GovernorAlpha.sol
@@ -27,8 +27,8 @@ contract GovernorAlpha {

/// @notice The duration of voting on a proposal, in blocks
function votingPeriod() public pure returns (uint) {
- return (60 * 60 * 24 * 3) / 3;
- } // ~3 days in blocks (assuming 3s blocks)
+ return 100;
+ } // A reasonable amount of block suitable for testing

/// @notice The address of the Venus Protocol Timelock
TimelockInterface public timelock;
diff --git a/node_modules/@venusprotocol/governance-contracts/contracts/legacy/GovernorAlpha2.sol b/node_modules/@venusprotocol/governance-contracts/contracts/legacy/GovernorAlpha2.sol
index c009718..0e8e8ec 100644
--- a/node_modules/@venusprotocol/governance-contracts/contracts/legacy/GovernorAlpha2.sol
+++ b/node_modules/@venusprotocol/governance-contracts/contracts/legacy/GovernorAlpha2.sol
@@ -27,8 +27,8 @@ contract GovernorAlpha2 {

/// @notice The duration of voting on a proposal, in blocks
function votingPeriod() public pure returns (uint) {
- return (60 * 60 * 24 * 3) / 3;
- } // ~3 days in blocks (assuming 3s blocks)
+ return 100;
+ } // A reasonable amount of block suitable for testing

/// @notice The address of the Venus Protocol Timelock
TimelockInterface public timelock;
3 changes: 0 additions & 3 deletions subgraphs/venus/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,16 @@ const main = () => {
network: 'hardhat',
comptrollerAddress: '0x94d1820b2D1c7c7452A163983Dc888CEC546b77D',
startBlock: '0',
vBnbAddress: '0xA07c5b74C9B40447a954e1466938b865b6BBea36',
},
chapel: {
network: 'chapel',
comptrollerAddress: bscTestnetCoreDeployments.Contracts.Comptroller,
startBlock: '2470000',
vBnbAddress: bscTestnetCoreDeployments.Contracts.vBNB,
},
bsc: {
network: 'bsc',
comptrollerAddress: bscMainnetCoreDeployments.Contracts.Comptroller,
startBlock: '2470000',
vBnbAddress: bscMainnetCoreDeployments.Contracts.vBNB,
},
};

Expand Down
6 changes: 1 addition & 5 deletions subgraphs/venus/src/constants/addresses.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { Address } from '@graphprotocol/graph-ts';

import {
comptrollerAddress as comptrollerAddressString,
vBnbAddress as vBnbAddressString,
} from './config';
import { comptrollerAddress as comptrollerAddressString } from './config';

export const vBnbAddress = Address.fromString(vBnbAddressString);
export const comptrollerAddress = Address.fromString(comptrollerAddressString);
export const nullAddress = Address.fromString('0x0000000000000000000000000000000000000000');
1 change: 0 additions & 1 deletion subgraphs/venus/src/constants/config-template
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Use yarn prepare commands to generate config typescript file per env

export const vBnbAddress = '{{ vBnbAddress }}';
export const comptrollerAddress = '{{ comptrollerAddress }}';
Loading

0 comments on commit 6d3a573

Please sign in to comment.