Remove Address.functionDelegateCall
This commit is contained in:
@ -334,50 +334,4 @@ contract('Address', function (accounts) {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('functionDelegateCall', function () {
|
||||
beforeEach(async function () {
|
||||
this.contractRecipient = await CallReceiverMock.new();
|
||||
});
|
||||
|
||||
it('delegate calls the requested function', async function () {
|
||||
const abiEncodedCall = web3.eth.abi.encodeFunctionCall({
|
||||
name: 'mockFunctionWritesStorage',
|
||||
type: 'function',
|
||||
inputs: [],
|
||||
}, []);
|
||||
|
||||
const receipt = await this.mock.functionDelegateCall(this.contractRecipient.address, abiEncodedCall);
|
||||
|
||||
expectEvent(receipt, 'CallReturnValue', { data: '0x1234' });
|
||||
|
||||
expect(await this.mock.sharedAnswer()).to.equal('42');
|
||||
});
|
||||
|
||||
it('bubbles up revert reason', async function () {
|
||||
const abiEncodedCall = web3.eth.abi.encodeFunctionCall({
|
||||
name: 'mockFunctionRevertsReason',
|
||||
type: 'function',
|
||||
inputs: [],
|
||||
}, []);
|
||||
|
||||
await expectRevert(
|
||||
this.mock.functionDelegateCall(this.contractRecipient.address, abiEncodedCall),
|
||||
'CallReceiverMock: reverting',
|
||||
);
|
||||
});
|
||||
|
||||
it('reverts when address is not a contract', async function () {
|
||||
const [ recipient ] = accounts;
|
||||
const abiEncodedCall = web3.eth.abi.encodeFunctionCall({
|
||||
name: 'mockFunction',
|
||||
type: 'function',
|
||||
inputs: [],
|
||||
}, []);
|
||||
await expectRevert(
|
||||
this.mock.functionDelegateCall(recipient, abiEncodedCall),
|
||||
'Address: delegate call to non-contract',
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user