Currently I have quiet a few mappings which I believe overall could be reduced to a struct with internal mappings and one overall mapping, however, I'm not sure how to do this myself and are therefore looking for guidance.
mapping(address => uint256) public proposedOfferings;
mapping(address => uint256) public receivedOfferings;
mapping(address => uint256) public acceptedOfferings;
mapping(address => uint256) public rejectedOfferings;
How can I re-structure above to below, keeping in mind each mapping consist of two separate uint256
variables (e.g. uint256 amount
and uint256 percentageBonus
).
struct offerings {
mapping(address=> uint256) proposed;
mapping(address=> uint256) received;
mapping(address=> uint256) accepted;
mapping(address=> uint256) rejected;
}
mapping(address => offerings) offeringData;
also, some information on the related design paradigm would be highly appreciated. thanks!