1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SolidityでMappingの入れ子をするには

Posted at

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]);
    }
}
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?