SolidityでMapping in Mappingをする方法。
pragma solidity >=0.4.22 <0.6.0;
contract NestedMapping {
// mapping(いつ => mapping(誰が => どれくらい)) ammountMapping;
mapping(uint128 => mapping(address => uint128)) ammountMapping;
function setAmmount(uint128 _date, uint128 _ammount) public {
ammountMapping[_date][msg.sender] = _ammount;
}
function getAmmount(uint128 _date) view public returns(uint128) {
return (ammountMapping[_date][msg.sender]);
}
}