0

I have the following function

   enum OptionType {Invalid, Put, Call}

   function create(
    uint256 period,
    uint256 amount,
    uint256 strike,
    OptionType optionType
) {
    ....
}

When I try to delegatecall this function from another contract using this

address(contractAddress).delegatecall(abi.encodeWithSelector("create(uint256,uint256,uint256,uint8)",1,1,1,1));

I get the error

function selector was not recognized and there's no fallback function

2
  • can you try bytes4(keccak256("create(uint256,uint256,uint256,uint8)")), 1,1,1,1
    – hack3r_0m
    Apr 15 at 5:36
  • @hack3r_0m That fails and even this one fails abi.encodeWithSignature( "create(uint256,uint256,uint256,uint8)", 1, 1, 1, 1 ) Apr 15 at 6:04

Your Answer

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

Browse other questions tagged or ask your own question.