how is the topic of an event computed if the event accepts a struct instance?
my event accepts an address for the first argument and for the second argument an instance of a struct containing an address and a uint32. i tried
echo -n 'MyEvent(address,[address,uint32])' | keccak-256sum | head -c 8
because that's a JS/TS-like notation which usually works pretty well with solidity
i also tried
echo -n 'MyEvent(address,(address,uint32))' | keccak-256sum | head -c 8
because i found an answer on SE saying to use round parenthesis for computing function identifiers if the function accepts a tuple instance
i also tried
echo -n 'MyEvent(address,tuple[])' | keccak-256sum | head -c 8
because that's the type i found in the artifacts file generated by remix
but none of these work out to the correct topic
how do i compute it?
Dec 9, 2022, 10:46 AM
i figured it out. my event actually accepts an array of struct instances. the correct solution for anyone interested:
echo -n 'MyEvent(address,(address,uint32)[])' | keccak-256sum | head -c 8
echo -n 'MyEvent(address,(address,uint32)[])' | keccak-256sum | head -c 8
Dec 9, 2022, 11:05 AM