dethcrypto / dethcrypto/TypeChain

Always generate overloads works differently with struct parameters

Open
#405 3 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.8k
Forks
376
PR merge metrics
No merged PRs in 30d

Description

Hi there,

Thanks for this cool library, it works perfectly. However, I tried to compile this contract:

```SOLIDITY
contract PaperMoney {
struct Order {
address from;
address payable to;
}

function transfer(Order memory order, uint256 amount) external payable returns (uint256) {
// ...
}

function transfer(address from, address payable to, uint256 amount) external payable returns (uint256) {
// ...
}
}
```

And the abi of this inputs:
```JSON
{
"abi": [
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"internalType": "struct Order",
"name": "_order",
"type": "tuple"
}
],
"name": "trade",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "trade",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
}
]
}
```

It turns `"trade((address,address),uint256)": FunctionFragment;` function was missing in compiled ts interface:
```JAVASCRIPT
interface AMMWrapperInterface extends ethers.utils.Interface {
functions: {
"trade(address,address,uint256)": FunctionFragment;
}
...
```

It works different in some complicated structs, eg struct XXXLIB.Order, night be related to #343:
```JAVASCRIPT
interface AMMWrapperInterface extends ethers.utils.Interface {
functions: {
"trade((tuple),uint256)": FunctionFragment;
}
...
```

Note: I cleaned up smart contract for some reason.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.