You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pragma solidity^0.8.0;
contractIncrementerExtended {
uint256private value;
constructor(uint256initialValue) {
value = initialValue;
}
function increment() public {
value +=1;
}
function increment(uint256amount) public {
value += amount;
}
receive() externalpayable {}
function get() publicviewreturns(uint256) {
return value;
}
}
How can I work with both "increment" methods from Go abi module.
If I try to call abi.Pack("increment") without any arguments it returns an error. And it works for abi.Pack("increment", big.NewInt(5)).
From the code I see that methods are stored in a map. And only one element can have "increment" name:
This discussion was converted from issue #13079 on January 16, 2025 13:10.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Imagine I have following contract:
How can I work with both "increment" methods from Go
abi
module.If I try to call
abi.Pack("increment")
without any arguments it returns an error. And it works forabi.Pack("increment", big.NewInt(5))
.From the code I see that methods are stored in a map. And only one element can have "increment" name:
erigon/accounts/abi/abi.go
Line 76 in f22317e
Is it a bug or feature? How should we work with such functions?
Beta Was this translation helpful? Give feedback.
All reactions