0

I am trying to understand some solidity code, and I see what appears to be the calling of an unimplemented function.

There is an interface defined as:

interface IOneInchCaller is ISafeERC20Extension, IGasDiscountExtension {
    struct CallDescription {
        uint256 targetWithMandatory;
        uint256 gasLimit;
        uint256 value;
        bytes data;
    }

    function makeCall(CallDescription memory desc) external;
    function makeCalls(CallDescription[] memory desc) external payable;
}

And then elsewhere in the codebase I see a call to this function:

function swap(
        IOneInchCaller caller,
        SwapDescription calldata desc,
        IOneInchCaller.CallDescription[] calldata calls
    )
        external
        payable
        whenNotPaused
        returns (uint256 returnAmount)
    {

        caller.makeCalls{value: msg.value}(calls);

It is calling the IOneInchCaller.makeCalls function, but nowhere is the function implementation defined. What is going on here?


By the way, the code is pulled from here.

1

For making calls to an external contract you don't need the implementation, having the interface is enough.

As example all ERC20 compliant tokens use the same interface defined in EIP-20. Any contract can interact with them through the same interface without having to worry about particular implementations details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.