...by Daniel Szego
quote
"On a long enough timeline we will all become Satoshi Nakamoto.."
Daniel Szego

Wednesday, December 6, 2017

Solidity and Truffle Tips and Tricks - accessing a mapping from external


If you have a public mapping in a contract, like

mapping(address => string) myMapping;

then you can certainly reach internally as

myMapping[<myAddress>]

however, if you want to reach externally, then actually you do not reach the variable itself, instead getter functions are generated automatically. Due to the fact that it is actually a function, you can access for the variable as: 

myMapping(<myAddress>)