In a regular solidity function, we have to name the arguments like:

function getAddr(string AddrName) public. . .

Here's the argument is a string which is named AddrName.

I had build a dapp which simplifies the interaction with smart contract using URL parameters. So to initiate the function with prefilled values in arguments I can simply browse: https://conteract.io/c/moataddress?function=getAddr&AddrName=owner

But prefilled input values doesn't work in mapping as the arguments is not named in mappings: https://conteract.io/c/moatfund?function=Investors

mapping(address => uint256) public Investors;

Provided that the mapping is used more often, is there any way to name the arguments in mapping or any workaround which might solve this issue.


2 Answers 2


Finally, with the release of solidity version 0.8.18, we can name mapping parameters! You can see it listed in the 0.8.18 release announcement.

The following code compiles with any version above that:

mapping(address contractAddress => uint numOfFunctions) public whateverYouWantMan;
mapping(string object => uint value) public objects;


No, its not possible to do so and is not an issue. The mapping is an associative structure where a unique key is mapped to another value. In your case the name of the mapping is Investors.

You can either find a better name (es: InvestorsBalance which would identify what's the key and what is mapped to) or you create a function to get mapping value given the key.

function getBalance(adddress investor) public returns(uint256) {
    return Investors[investor];

But that's something up to the developer of the contract so you won't know what's trying to do with that specific mapping. You can't make an assumption on your tool.

An option could be to enrich your dapp asking the name of the parameters of the mapping when you import the contract. But it would be something that you may need to store off-chain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.