Migrate metatx tests to ethers.js (#4737)
Co-authored-by: ernestognw <ernestognw@gmail.com>
This commit is contained in:
@ -4,10 +4,10 @@ const { impersonateAccount, setBalance } = require('@nomicfoundation/hardhat-net
|
||||
// Hardhat default balance
|
||||
const DEFAULT_BALANCE = 10000n * ethers.WeiPerEther;
|
||||
|
||||
async function impersonate(account, balance = DEFAULT_BALANCE) {
|
||||
await impersonateAccount(account);
|
||||
await setBalance(account, balance);
|
||||
}
|
||||
const impersonate = (account, balance = DEFAULT_BALANCE) =>
|
||||
impersonateAccount(account)
|
||||
.then(() => setBalance(account, balance))
|
||||
.then(() => ethers.getSigner(account));
|
||||
|
||||
module.exports = {
|
||||
impersonate,
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
module.exports = {
|
||||
// sum of integer / bignumber
|
||||
sum: (...args) => args.reduce((acc, n) => acc + n, 0),
|
||||
bigintSum: (...args) => args.reduce((acc, n) => acc + n, 0n),
|
||||
BNsum: (...args) => args.reduce((acc, n) => acc.add(n), web3.utils.toBN(0)),
|
||||
// min of integer / bignumber
|
||||
min: (...args) => args.slice(1).reduce((x, y) => (x < y ? x : y), args[0]),
|
||||
|
||||
Reference in New Issue
Block a user