2

I want to call the Seaport contract (SeaportContract), more precisely the fulfillBasicOrder function but I have some problems. First I know that in order to call another function contract we need to have its interface, problem: the Seaport interface needs many additional files to be imported and I wondered if there was maybe another way to call it so Ive seen here Calling function from deployed contract

And now my other problem is that, I indeed have the function signature ("fulfillBasicOrder((address,uint256,uint256,address,address,address,uint256,uint256,uint8,uint256,uint256,bytes32,uint256,bytes32,bytes32,uint256,(uint256,address)[],bytes))") But I only have the calldata to call it, no parameters (so some very long string bytes 0xfb0f3ee1000000000.....0000000000000000). Is there a way I can call that function the way I described ? So without using interface and with the calldata ? Or will I have to import manually all of the seaport files.

MM1
  • 213
  • 1
  • 6
  • You could create your own interface with just the functions you need instead. Alternatively you can use ethers to perform a low level call https://docs.ethers.org/v5/api/providers/provider/#Provider-call – Markus Schick Mar 01 '23 at 09:54
  • Thats what I did for the interface, but I have problem fulfilling the function – MM1 Mar 01 '23 at 10:00
  • You could use the interface.encodeFunctionData function (see ethers docs) to encode the parameters. Or when you start with the calldata you can decode it via interface.decodeFunctionData. – Markus Schick Mar 01 '23 at 10:43
  • The problem is that Im trying to do all of that on chain @MarkusSchick – MM1 Mar 02 '23 at 00:07
  • Similar functions are available in solidity. https://solidity-by-example.org/call/, https://solidity-by-example.org/abi-encode/, https://solidity-by-example.org/abi-decode/ – Markus Schick Mar 02 '23 at 14:54

1 Answers1

2

Define interface like this

interface ISeaPort{
// whatever the function is 
}

And call the function in your contract like this.

Iseaport(addressOfSeaportCotract).Functionname(Function Arguments);
Zartaj Afser
  • 3,619
  • 1
  • 8
  • 25