在 Solidity 中匿名 event 會耗費較少的成本,然而我們不能夠使用 name 找到他們,只能使用特定的 contract address:
pragmasolidity >=0.4.21 <0.7.0;contract ClientReceipt {eventDeposit(addressindexed _from,bytes32indexed _id,uint _value );functiondeposit(bytes32_id) publicpayable {// Events are emitted using `emit`, followed by// the name of the event and the arguments// (if any) in parentheses. Any such invocation// (even deeply nested) can be detected from// the JavaScript API by filtering for `Deposit`.emitDeposit(msg.sender, _id, msg.value); }}