Add test for transaction price errors with hardhat_mine (#845)
parent
66082b3e56
commit
b1ee826ae5
@ -0,0 +1,7 @@ |
||||
// Testing hooks
|
||||
const fn = (msg, config) => config.logger.log(msg); |
||||
|
||||
module.exports = { |
||||
silent: process.env.SILENT ? true : false, |
||||
istanbulReporter: ['json-summary', 'text'], |
||||
} |
@ -0,0 +1,12 @@ |
||||
pragma solidity >=0.8.0 <0.9.0; |
||||
|
||||
|
||||
contract Setter { |
||||
uint x; |
||||
constructor() public { |
||||
} |
||||
|
||||
function set() public { |
||||
x = 1; |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
require("@nomiclabs/hardhat-waffle"); |
||||
require("@nomiclabs/hardhat-ethers"); |
||||
require(__dirname + "/../plugins/nomiclabs.plugin"); |
||||
|
||||
module.exports = { |
||||
solidity: { |
||||
version: "0.8.17" |
||||
}, |
||||
logger: process.env.SILENT ? { log: () => {} } : console, |
||||
}; |
@ -0,0 +1,22 @@ |
||||
const { expect } = require("chai"); |
||||
const { ethers } = require("hardhat"); |
||||
|
||||
describe("Setter", function() { |
||||
let instance; |
||||
|
||||
before(async () => { |
||||
const factory = await ethers.getContractFactory("Setter"); |
||||
instance = await factory.deploy(); |
||||
}); |
||||
|
||||
it('sets at the beginning', async function(){ |
||||
await instance.set(); |
||||
}); |
||||
|
||||
it('sets at the end', async function(){ |
||||
// Mine about 50K blocks
|
||||
await hre.network.provider.send('hardhat_mine', ['0xCCCC']) |
||||
await instance.set(); |
||||
}); |
||||
}); |
||||
|
Loading…
Reference in new issue