Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

abi: function overloading #13079

Closed
olegrok opened this issue Dec 11, 2024 · 0 comments
Closed

abi: function overloading #13079

olegrok opened this issue Dec 11, 2024 · 0 comments
Labels
imp3 Low importance

Comments

@olegrok
Copy link

olegrok commented Dec 11, 2024

Imagine I have following contract:

pragma solidity ^0.8.0;

contract IncrementerExtended {
    uint256 private value;

    constructor(uint256 initialValue) {
        value = initialValue;
    }

    function increment() public {
        value += 1;
    }

    function increment(uint256 amount) public {
        value += amount;
    }

    receive() external payable {}

    function get() public view returns(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:

method, exist := abi.Methods[name]

Is it a bug or feature? How should we work with such functions?

@VBulikov VBulikov added the imp3 Low importance label Dec 13, 2024
@erigontech erigontech locked and limited conversation to collaborators Jan 16, 2025
@yperbasis yperbasis converted this issue into discussion #13465 Jan 16, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
imp3 Low importance
Projects
None yet
Development

No branches or pull requests

2 participants