-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapping.sol
More file actions
33 lines (26 loc) · 794 Bytes
/
Mapping.sol
File metadata and controls
33 lines (26 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
contract Mapping {
mapping (address => uint) public myMap;
function get(address _addr) public view returns(uint) {
return myMap[_addr];
}
function set(address _addr, uint i) public {
myMap[_addr] = i;
}
function remove(address _addr) public {
delete myMap[_addr];
}
}
contract NestedMapping {
mapping (address => mapping(uint => bool)) public nested;
function get(address _addr1, uint _i) public view returns(bool) {
return nested[_addr1][_i];
}
function set(address _addr1, uint _i, bool _boo) public {
nested[_addr1][_i] = _boo;
}
function remove(address _addr1, uint _i) public {
delete nested[_addr1] [_i];
}
}