18
8

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で引数に指定するindexedとは何か

Posted at

Solidityで以下のようなコードを読んでindexedって何?となったのでメモ

event Transfer(address indexed from, address indexed to, uint256 value);

indexedの役割

上のコードの場合indexedで指定した引数をもとにeventを絞りこめるようになる。
要するに以下のコードの{_from: "0xd43070..."}のようにして、ブロックチェーンから特定のeventだけを取得出来るようになる。

var daoBlock = 2254451;
transferEvent = dao.Transfer(
  {_from: "0xd430709a70da06c5c25157a97dba3c3e664590af"},
  {fromBlock: daoBlock, toBlock: daoBlock + 2000}
);

上のコードは参考元のコードを簡略化したものなので、詳しく見たい方は参考元をどうぞ!

参考

18
8
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
18
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?