@ -16,7 +16,7 @@ function shouldBehaveLikeERC20Burnable (owner, initialBalance, [burner]) {
|
||||
|
||||
function shouldBurn (amount) {
|
||||
beforeEach(async function () {
|
||||
({ logs: this.logs } = await this.token.burn(amount, { from: owner }));
|
||||
(this.receipt = await this.token.burn(amount, { from: owner }));
|
||||
});
|
||||
|
||||
it('burns the requested amount', async function () {
|
||||
@ -24,7 +24,7 @@ function shouldBehaveLikeERC20Burnable (owner, initialBalance, [burner]) {
|
||||
});
|
||||
|
||||
it('emits a transfer event', async function () {
|
||||
expectEvent.inLogs(this.logs, 'Transfer', {
|
||||
expectEvent(this.receipt, 'Transfer', {
|
||||
from: owner,
|
||||
to: ZERO_ADDRESS,
|
||||
value: amount,
|
||||
@ -59,8 +59,7 @@ function shouldBehaveLikeERC20Burnable (owner, initialBalance, [burner]) {
|
||||
|
||||
beforeEach(async function () {
|
||||
await this.token.approve(burner, originalAllowance, { from: owner });
|
||||
const { logs } = await this.token.burnFrom(owner, amount, { from: burner });
|
||||
this.logs = logs;
|
||||
this.receipt = await this.token.burnFrom(owner, amount, { from: burner });
|
||||
});
|
||||
|
||||
it('burns the requested amount', async function () {
|
||||
@ -72,7 +71,7 @@ function shouldBehaveLikeERC20Burnable (owner, initialBalance, [burner]) {
|
||||
});
|
||||
|
||||
it('emits a transfer event', async function () {
|
||||
expectEvent.inLogs(this.logs, 'Transfer', {
|
||||
expectEvent(this.receipt, 'Transfer', {
|
||||
from: owner,
|
||||
to: ZERO_ADDRESS,
|
||||
value: amount,
|
||||
|
||||
@ -17,14 +17,14 @@ contract('ERC20Snapshot', function (accounts) {
|
||||
|
||||
describe('snapshot', function () {
|
||||
it('emits a snapshot event', async function () {
|
||||
const { logs } = await this.token.snapshot();
|
||||
expectEvent.inLogs(logs, 'Snapshot');
|
||||
const receipt = await this.token.snapshot();
|
||||
expectEvent(receipt, 'Snapshot');
|
||||
});
|
||||
|
||||
it('creates increasing snapshots ids, starting from 1', async function () {
|
||||
for (const id of ['1', '2', '3', '4', '5']) {
|
||||
const { logs } = await this.token.snapshot();
|
||||
expectEvent.inLogs(logs, 'Snapshot', { id });
|
||||
const receipt = await this.token.snapshot();
|
||||
expectEvent(receipt, 'Snapshot', { id });
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -42,8 +42,8 @@ contract('ERC20Snapshot', function (accounts) {
|
||||
beforeEach(async function () {
|
||||
this.initialSnapshotId = new BN('1');
|
||||
|
||||
const { logs } = await this.token.snapshot();
|
||||
expectEvent.inLogs(logs, 'Snapshot', { id: this.initialSnapshotId });
|
||||
const receipt = await this.token.snapshot();
|
||||
expectEvent(receipt, 'Snapshot', { id: this.initialSnapshotId });
|
||||
});
|
||||
|
||||
context('with no supply changes after the snapshot', function () {
|
||||
@ -66,8 +66,8 @@ contract('ERC20Snapshot', function (accounts) {
|
||||
beforeEach(async function () {
|
||||
this.secondSnapshotId = new BN('2');
|
||||
|
||||
const { logs } = await this.token.snapshot();
|
||||
expectEvent.inLogs(logs, 'Snapshot', { id: this.secondSnapshotId });
|
||||
const receipt = await this.token.snapshot();
|
||||
expectEvent(receipt, 'Snapshot', { id: this.secondSnapshotId });
|
||||
});
|
||||
|
||||
it('snapshots return the supply before and after the changes', async function () {
|
||||
@ -84,8 +84,8 @@ contract('ERC20Snapshot', function (accounts) {
|
||||
this.secondSnapshotIds = ['2', '3', '4'];
|
||||
|
||||
for (const id of this.secondSnapshotIds) {
|
||||
const { logs } = await this.token.snapshot();
|
||||
expectEvent.inLogs(logs, 'Snapshot', { id });
|
||||
const receipt = await this.token.snapshot();
|
||||
expectEvent(receipt, 'Snapshot', { id });
|
||||
}
|
||||
});
|
||||
|
||||
@ -116,8 +116,8 @@ contract('ERC20Snapshot', function (accounts) {
|
||||
beforeEach(async function () {
|
||||
this.initialSnapshotId = new BN('1');
|
||||
|
||||
const { logs } = await this.token.snapshot();
|
||||
expectEvent.inLogs(logs, 'Snapshot', { id: this.initialSnapshotId });
|
||||
const receipt = await this.token.snapshot();
|
||||
expectEvent(receipt, 'Snapshot', { id: this.initialSnapshotId });
|
||||
});
|
||||
|
||||
context('with no balance changes after the snapshot', function () {
|
||||
@ -147,8 +147,8 @@ contract('ERC20Snapshot', function (accounts) {
|
||||
beforeEach(async function () {
|
||||
this.secondSnapshotId = new BN('2');
|
||||
|
||||
const { logs } = await this.token.snapshot();
|
||||
expectEvent.inLogs(logs, 'Snapshot', { id: this.secondSnapshotId });
|
||||
const receipt = await this.token.snapshot();
|
||||
expectEvent(receipt, 'Snapshot', { id: this.secondSnapshotId });
|
||||
});
|
||||
|
||||
it('snapshots return the balances before and after the changes', async function () {
|
||||
@ -174,8 +174,8 @@ contract('ERC20Snapshot', function (accounts) {
|
||||
this.secondSnapshotIds = ['2', '3', '4'];
|
||||
|
||||
for (const id of this.secondSnapshotIds) {
|
||||
const { logs } = await this.token.snapshot();
|
||||
expectEvent.inLogs(logs, 'Snapshot', { id });
|
||||
const receipt = await this.token.snapshot();
|
||||
expectEvent(receipt, 'Snapshot', { id });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -206,8 +206,8 @@ contract('ERC20Votes', function (accounts) {
|
||||
}),
|
||||
));
|
||||
|
||||
const { logs } = await this.token.delegateBySig(holderDelegatee, nonce, MAX_UINT256, v, r, s);
|
||||
const { args } = logs.find(({ event }) => event == 'DelegateChanged');
|
||||
const receipt = await this.token.delegateBySig(holderDelegatee, nonce, MAX_UINT256, v, r, s);
|
||||
const { args } = receipt.logs.find(({ event }) => event == 'DelegateChanged');
|
||||
expect(args.delegator).to.not.be.equal(delegatorAddress);
|
||||
expect(args.fromDelegate).to.be.equal(ZERO_ADDRESS);
|
||||
expect(args.toDelegate).to.be.equal(holderDelegatee);
|
||||
|
||||
@ -206,8 +206,8 @@ contract('ERC20VotesComp', function (accounts) {
|
||||
}),
|
||||
));
|
||||
|
||||
const { logs } = await this.token.delegateBySig(holderDelegatee, nonce, MAX_UINT256, v, r, s);
|
||||
const { args } = logs.find(({ event }) => event == 'DelegateChanged');
|
||||
const receipt = await this.token.delegateBySig(holderDelegatee, nonce, MAX_UINT256, v, r, s);
|
||||
const { args } = receipt.logs.find(({ event }) => event == 'DelegateChanged');
|
||||
expect(args.delegator).to.not.be.equal(delegatorAddress);
|
||||
expect(args.fromDelegate).to.be.equal(ZERO_ADDRESS);
|
||||
expect(args.toDelegate).to.be.equal(holderDelegatee);
|
||||
|
||||
Reference in New Issue
Block a user