Add additional types to EnumerableMap

Is there any structure like EnumerableMap.UintToAddressMap in reverse way, i.e. address -> uint256? I want a mapping to store addresses and each address maps into a uint value. I also need to calculate the sum of those uint values for all addresses.

The use case is that I had quite a few beneficiaries in a sale that they split the revenue in different percentages. I had to make sure that the percentage of the sum of those addresses to be 100% and able to retrieve the percentage holding for each of the address in the mapping.

Would be great if this can be added in the future. Thank you~ :muscle:

:computer: Environment

β”œβ”€β”€ @openzeppelin/contracts-upgradeable@3.3.0
β”œβ”€β”€ @openzeppelin/truffle-upgrades@1.5.0

:memo:Details

:1234: Code to reproduce

1 Like

Hi @ElvisWong,

Welcome to the community forum :wave:

If you are using Ether you could look at using PaymentSplitter in OpenZeppelin Contracts.

1 Like

Hi @ElvisWong,

My assumption is that until Solidity supports generics then this would be a huge maintenance task to support multiple types.

That’s what exactly what I want!! Thank you. :muscle:

1 Like