pragma solidity ^0.8.3;
contract Mapping{
mapping(address =>uint)pubic myMap;
function get(address _addr)pubic view returns(uint){
return myMap[_addr];
}
function set(address _addr,uint _i)pubic{
myMap[_addr]=-i;
}
function remove(address _addr)pubic{
delete myMap[_addr];
}
}
contract NestedMapping{
mapping(address =>mapping(uint =>bool))pubic nested;
function get()address )addr1,uint _i}public view returns(bool){
return nested[_adddr1][_i];
}
function set(
address _addr1,
uint _i,
bool _boo
)public{
nested[_addr1][_i]=_boo;
}
function remove(address _addr1,uint _i)public{
delete nestedp[addr1][i];
}
}
智能合约 solidity-mapping.sol
最新推荐文章于 2024-07-28 21:48:43 发布