Prepare tests for hardhat-exposed transition (#3930)

Co-authored-by: Francisco <frangio.1@gmail.com>
This commit is contained in:
Hadrien Croubois
2023-01-12 09:51:29 +01:00
committed by GitHub
parent d210847e28
commit 7c6e289782
13 changed files with 369 additions and 418 deletions

View File

@ -1,14 +1,13 @@
const { constants, expectEvent, expectRevert, time } = require('@openzeppelin/test-helpers');
const { web3 } = require('@openzeppelin/test-helpers/src/setup');
const { expect } = require('chai');
const { BNmin } = require('../helpers/math');
const ERC20Mock = artifacts.require('ERC20Mock');
const VestingWallet = artifacts.require('VestingWallet');
const { shouldBehaveLikeVesting } = require('./VestingWallet.behavior');
const min = (...args) => args.slice(1).reduce((x, y) => x.lt(y) ? x : y, args[0]);
contract('VestingWallet', function (accounts) {
const [ sender, beneficiary ] = accounts;
@ -36,7 +35,7 @@ contract('VestingWallet', function (accounts) {
describe('vesting schedule', function () {
beforeEach(async function () {
this.schedule = Array(64).fill().map((_, i) => web3.utils.toBN(i).mul(duration).divn(60).add(this.start));
this.vestingFn = timestamp => min(amount, amount.mul(timestamp.sub(this.start)).div(duration));
this.vestingFn = timestamp => BNmin(amount, amount.mul(timestamp.sub(this.start)).div(duration));
});
describe('Eth vesting', function () {