question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"No matching function" in the ABI

See original GitHub issue

I’m having a similar issue. Using V5 under NodeJS

const fillInterface = new ethers.utils.Interface(FILL_ORDER_ABI);        // function abi
const data =  fillInterface.encodeFunctionData("fillOrder",[orderTuple, takerAssetFillAmount, signature])

Error: no matching function (argument=“name”, value=“fillOrder”, code=INVALID_ARGUMENT, version=abi/5.0.9)

The ABI

{
                           "constant":false,"inputs":[
                               {"components":[
                                   {"internalType":"address","name":"makerAddress","type":"address"},
                                   {"internalType":"address","name":"takerAddress","type":"address"},
                                   {"internalType":"address","name":"feeRecipientAddress","type":"address"},
                                   {"internalType":"address","name":"senderAddress","type":"address"},
                                   {"internalType":"uint256","name":"makerAssetAmount","type":"uint256"},
                                   {"internalType":"uint256","name":"takerAssetAmount","type":"uint256"},
                                   {"internalType":"uint256","name":"makerFee","type":"uint256"},
                                   {"internalType":"uint256","name":"takerFee","type":"uint256"},
                                   {"internalType":"uint256","name":"expirationTimeSeconds","type":"uint256"},
                                   {"internalType":"uint256","name":"salt","type":"uint256"},
                                   {"internalType":"bytes","name":"makerAssetData","type":"bytes"},
                                   {"internalType":"bytes","name":"takerAssetData","type":"bytes"},
                                   {"internalType":"bytes","name":"makerFeeAssetData","type":"bytes"},
                                   {"internalType":"bytes","name":"takerFeeAssetData","type":"bytes"}
                                   ],
                                   "internalType":"struct LibOrder.Order","name":"order","type":"tuple"
                                },
                                {"internalType":"uint256","name":"takerAssetFillAmount","type":"uint256"},
                                {"internalType":"bytes","name":"signature","type":"bytes"}
                            ],
                            "name":"fillOrder",
                            "outputs":[
                                {"components":[
                                    {"internalType":"uint256","name":"makerAssetFilledAmount","type":"uint256"},
                                    {"internalType":"uint256","name":"takerAssetFilledAmount","type":"uint256"},
                                    {"internalType":"uint256","name":"makerFeePaid","type":"uint256"},
                                    {"internalType":"uint256","name":"takerFeePaid","type":"uint256"},
                                    {"internalType":"uint256","name":"protocolFeePaid","type":"uint256"}
                                ],
                                "internalType":"struct LibFillResults.FillResults",
                                "name":"fillResults","type":"tuple"}
                            ],"payable":true,
                            "stateMutability":"payable",
                            "type":"function"
                        }

Not sure why it wont see the function. This ABI was working with WEB3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ricmoocommented, Dec 11, 2020

Can you show more of your code? This works for me:

const { ethers } = require("../../packages/ethers");

const abi = [
    {
                           "constant":false,"inputs":[
                               {"components":[
                                   {"internalType":"address","name":"makerAddress","type":"address"},
                                   {"internalType":"address","name":"takerAddress","type":"address"},
                                   {"internalType":"address","name":"feeRecipientAddress","type":"address"},
                                   {"internalType":"address","name":"senderAddress","type":"address"},
                                   {"internalType":"uint256","name":"makerAssetAmount","type":"uint256"},
                                   {"internalType":"uint256","name":"takerAssetAmount","type":"uint256"},
                                   {"internalType":"uint256","name":"makerFee","type":"uint256"},
                                   {"internalType":"uint256","name":"takerFee","type":"uint256"},
                                   {"internalType":"uint256","name":"expirationTimeSeconds","type":"uint256"},
                                   {"internalType":"uint256","name":"salt","type":"uint256"},
                                   {"internalType":"bytes","name":"makerAssetData","type":"bytes"},
                                   {"internalType":"bytes","name":"takerAssetData","type":"bytes"},
                                   {"internalType":"bytes","name":"makerFeeAssetData","type":"bytes"},
                                   {"internalType":"bytes","name":"takerFeeAssetData","type":"bytes"}
                                ],
                                "internalType":"struct LibOrder.Order","name":"order","type":"tuple"
                                },
                                {"internalType":"uint256","name":"takerAssetFillAmount","type":"uint256"},
                                {"internalType":"bytes","name":"signature","type":"bytes"}
                            ],
                            "name":"fillOrder",
                            "outputs":[
                                {"components":[
                                    {"internalType":"uint256","name":"makerAssetFilledAmount","type":"uint256"},
                                    {"internalType":"uint256","name":"takerAssetFilledAmount","type":"uint256"},
                                    {"internalType":"uint256","name":"makerFeePaid","type":"uint256"},
                                    {"internalType":"uint256","name":"takerFeePaid","type":"uint256"},
                                    {"internalType":"uint256","name":"protocolFeePaid","type":"uint256"}
                                ],
                                "internalType":"struct LibFillResults.FillResults",
                                "name":"fillResults","type":"tuple"}
                            ],"payable":true,
                            "stateMutability":"payable",
                            "type":"function"
                        }
];
// Or the equivalent in Human-Readable ABI
// const abi = [
//  'function fillOrder(tuple(address makerAddress, address takerAddress, address feeRecipientAddress, address senderAddress, uint256 makerAssetAmount, uint256 takerAssetAmount, uint256 makerFee, uint256 takerFee, uint256 expirationTimeSeconds, uint256 salt, bytes makerAssetData, bytes takerAssetData, bytes makerFeeAssetData, bytes takerFeeAssetData) order, uint256 takerAssetFillAmount, bytes signature) payable returns (tuple(uint256 makerAssetFilledAmount, uint256 takerAssetFilledAmount, uint256 makerFeePaid, uint256 takerFeePaid, uint256 protocolFeePaid) fillResults)'
// ] 

const iface = new ethers.utils.Interface(abi);
const a = ethers.constants.AddressZero;
console.log(iface.encodeFunctionData("fillOrder", [
    [ a, a, a, a, 0, 0, 0, 0, 0, 0, "0x", "0x", "0x", "0x" ],
    0,
    "0x"
]));
0reactions
Madeindreamscommented, Jan 13, 2021

Based on the “thumbs up”, I’m guessing your issue is resolved? 😃

I’m going to close this now, but if you have any further issues, please re-open.

Thanks! 😃

Nope but I was sure it was. Not sure if something is wrong with my abi. Interface is looking for an array given the map error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I get a weird error about no matching function when I try to use ...
I get a weird error about no matching function when I try to use winrt::capture. Last time, we looked at using the C++/WinRT...
Read more >
no matching function for call to 'MY_OBJ - Stack Overflow
You defined a constructor for Vector requiring an argument, so now Base can't construct its member Vectors without an argument supplied. Put the ......
Read more >
Interface - Ethers.js
Create a new Interface from a JSON string or object representing abi. ... getFunction("doesNotExist()"); // [Error: no matching function] { // argument: ...
Read more >
"multiple matching functions" with Hardhat and contracts ...
I've recently “upgraded” my deployment setup to use Hardhat and the latest @openzeppelin/contracts-upgradeable package.
Read more >
web3.py does not print Events `ValueError: No matching ...
var event = myContract.LogJob({}, {fromBlock:0, toBlock:'latest'}); event.watch(function(error, result) { console.log(JSON.stringify(result)); }); ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found