Use hardhat-exposed to reduce the need for mocks (#3666)

Co-authored-by: Francisco <fg@frang.io>
This commit is contained in:
Hadrien Croubois
2023-01-03 15:38:13 +01:00
committed by GitHub
parent a81b0d0b21
commit c1d9da4052
190 changed files with 2297 additions and 4311 deletions

View File

@ -4,9 +4,9 @@ const RLP = require('rlp');
const Enums = require('../../helpers/enums');
const { GovernorHelper } = require('../../helpers/governance');
const Token = artifacts.require('ERC20VotesCompMock');
const Token = artifacts.require('$ERC20VotesComp');
const Timelock = artifacts.require('CompTimelock');
const Governor = artifacts.require('GovernorCompatibilityBravoMock');
const Governor = artifacts.require('$GovernorCompatibilityBravoMock');
const CallReceiver = artifacts.require('CallReceiverMock');
function makeContractAddress (creator, nonce) {
@ -29,7 +29,7 @@ contract('GovernorCompatibilityBravo', function (accounts) {
beforeEach(async function () {
const [ deployer ] = await web3.eth.getAccounts();
this.token = await Token.new(tokenName, tokenSymbol);
this.token = await Token.new(tokenName, tokenSymbol, tokenName);
// Need to predict governance address to set it as timelock admin with a delayed transfer
const nonce = await web3.eth.getTransactionCount(deployer);
@ -38,11 +38,11 @@ contract('GovernorCompatibilityBravo', function (accounts) {
this.timelock = await Timelock.new(predictGovernor, 2 * 86400);
this.mock = await Governor.new(
name,
this.token.address,
votingDelay,
votingPeriod,
proposalThreshold,
this.timelock.address,
this.token.address,
);
this.receiver = await CallReceiver.new();
@ -50,7 +50,7 @@ contract('GovernorCompatibilityBravo', function (accounts) {
await web3.eth.sendTransaction({ from: owner, to: this.timelock.address, value });
await this.token.mint(owner, tokenSupply);
await this.token.$_mint(owner, tokenSupply);
await this.helper.delegate({ token: this.token, to: proposer, value: proposalThreshold }, { from: owner });
await this.helper.delegate({ token: this.token, to: voter1, value: web3.utils.toWei('10') }, { from: owner });
await this.helper.delegate({ token: this.token, to: voter2, value: web3.utils.toWei('7') }, { from: owner });