思路:为需要遍历的 mapping 再准备一个 list,之后通过 for 循环遍历 list 取得 mapping 的 key。

 

mapping (address => uint) usersValue

mapping (uint => address) list

uint length = xx

for (uint i; i < length; i++) {

  usersValue[ list[i] ]

}

 

Refer:Solidity的遍历方式

Refer:https://ethereum.stackexchange.com/questions/10915/could-mapping-data-structure-return-the-number-of-items-it-points

Link:https://www.cnblogs.com/farwish/p/12364291.html

相关文章:

  • 2021-10-07
  • 2021-11-24
  • 2021-12-07
  • 2022-01-23
  • 2021-12-02
  • 2021-10-08
  • 2021-12-11
  • 2021-10-09
猜你喜欢
  • 2022-12-23
  • 2022-02-24
  • 2022-12-23
  • 2021-06-24
  • 2021-11-30
  • 2021-11-30
  • 2021-11-30
相关资源
相似解决方案