Is it possible to have a mapping where the values are a tuple?
mapping (address => (bool, uint)) participants;
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityIf you use a struct, eg
struct Participant {
bool value1;
uint value2;
}
mapping (address => Participant) participants;
I don't think there's any way of using an actual Tuple eg var (a, b)
in a mapping since the types of a
and b
cannot be declared with the syntax available. With a struct the types can be declared, which is necessary to declare the mapping type.