Solidity

使用映射時如何將數據推送到數組(地址=>地址) 映射名稱?

  • September 16, 2020

使用上述給定語法推送數據的確切語法是什麼?

我會這樣做:

mapping(address=>address[]) addressToMany;
       
function addAddress(address _address) public {
 addressToMany[msg.sender].push(_address);
}

引用自:https://ethereum.stackexchange.com/questions/70251