Use Prettier for JS files (#3913)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
@ -3,7 +3,7 @@ const { BN, expectRevert } = require('@openzeppelin/test-helpers');
|
||||
const ERC20MulticallMock = artifacts.require('$ERC20MulticallMock');
|
||||
|
||||
contract('Multicall', function (accounts) {
|
||||
const [ deployer, alice, bob ] = accounts;
|
||||
const [deployer, alice, bob] = accounts;
|
||||
const amount = 12000;
|
||||
|
||||
beforeEach(async function () {
|
||||
@ -15,10 +15,13 @@ contract('Multicall', function (accounts) {
|
||||
expect(await this.multicallToken.balanceOf(alice)).to.be.bignumber.equal(new BN('0'));
|
||||
expect(await this.multicallToken.balanceOf(bob)).to.be.bignumber.equal(new BN('0'));
|
||||
|
||||
await this.multicallToken.multicall([
|
||||
this.multicallToken.contract.methods.transfer(alice, amount / 2).encodeABI(),
|
||||
this.multicallToken.contract.methods.transfer(bob, amount / 3).encodeABI(),
|
||||
], { from: deployer });
|
||||
await this.multicallToken.multicall(
|
||||
[
|
||||
this.multicallToken.contract.methods.transfer(alice, amount / 2).encodeABI(),
|
||||
this.multicallToken.contract.methods.transfer(bob, amount / 3).encodeABI(),
|
||||
],
|
||||
{ from: deployer },
|
||||
);
|
||||
|
||||
expect(await this.multicallToken.balanceOf(alice)).to.be.bignumber.equal(new BN(amount / 2));
|
||||
expect(await this.multicallToken.balanceOf(bob)).to.be.bignumber.equal(new BN(amount / 3));
|
||||
@ -39,20 +42,26 @@ contract('Multicall', function (accounts) {
|
||||
it('reverts previous calls', async function () {
|
||||
expect(await this.multicallToken.balanceOf(alice)).to.be.bignumber.equal(new BN('0'));
|
||||
|
||||
const call = this.multicallToken.multicall([
|
||||
this.multicallToken.contract.methods.transfer(alice, amount).encodeABI(),
|
||||
this.multicallToken.contract.methods.transfer(bob, amount).encodeABI(),
|
||||
], { from: deployer });
|
||||
const call = this.multicallToken.multicall(
|
||||
[
|
||||
this.multicallToken.contract.methods.transfer(alice, amount).encodeABI(),
|
||||
this.multicallToken.contract.methods.transfer(bob, amount).encodeABI(),
|
||||
],
|
||||
{ from: deployer },
|
||||
);
|
||||
|
||||
await expectRevert(call, 'ERC20: transfer amount exceeds balance');
|
||||
expect(await this.multicallToken.balanceOf(alice)).to.be.bignumber.equal(new BN('0'));
|
||||
});
|
||||
|
||||
it('bubbles up revert reasons', async function () {
|
||||
const call = this.multicallToken.multicall([
|
||||
this.multicallToken.contract.methods.transfer(alice, amount).encodeABI(),
|
||||
this.multicallToken.contract.methods.transfer(bob, amount).encodeABI(),
|
||||
], { from: deployer });
|
||||
const call = this.multicallToken.multicall(
|
||||
[
|
||||
this.multicallToken.contract.methods.transfer(alice, amount).encodeABI(),
|
||||
this.multicallToken.contract.methods.transfer(bob, amount).encodeABI(),
|
||||
],
|
||||
{ from: deployer },
|
||||
);
|
||||
|
||||
await expectRevert(call, 'ERC20: transfer amount exceeds balance');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user