Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add wrapper function for low level calls #2264

Merged
Merged
8 changes: 8 additions & 0 deletions test/utils/Address.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,13 @@ describe('Address', function () {
inputs: [],
}, []);

const tracker = await balance.tracker(this.contractRecipient.address);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍


await send.ether(other, this.mock.address, amount);
const receipt = await this.mock.functionCallWithValue(this.contractRecipient.address, abiEncodedCall, amount);

expect(await tracker.delta()).to.be.bignumber.equal(amount);

expectEvent(receipt, 'CallReturnValue', { data: '0x1234' });
await expectEvent.inTransaction(receipt.tx, CallReceiverMock, 'MockFunctionCalled');
});
Expand All @@ -247,11 +251,15 @@ describe('Address', function () {
inputs: [],
}, []);

const tracker = await balance.tracker(this.contractRecipient.address);

expect(await balance.current(this.mock.address)).to.be.bignumber.equal('0');
const receipt = await this.mock.functionCallWithValue(
this.contractRecipient.address, abiEncodedCall, amount, { from: other, value: amount }
);

expect(await tracker.delta()).to.be.bignumber.equal(amount);

expectEvent(receipt, 'CallReturnValue', { data: '0x1234' });
await expectEvent.inTransaction(receipt.tx, CallReceiverMock, 'MockFunctionCalled');
});
Expand Down