I have an Ethereum contract with an event defined like so:
event Apple(address indexed a, address b, address c);
The event is fired and I can see the log in the transaction receipt.
Via web3, when I attempt to parse the logs from the receipt, I am able to retrieve the event parameters, but it looks like the value of a
is always the same.
// compiled is the built contract. address is the contract address
const contract = new web3.eth.Contract(compiled.abi, address)
const eventJsonInterface = _.find(
contract._jsonInterface,
o => o.name === 'Apple' && o.type === 'event',
)
const log = _.find(
receipt.logs,
l => l.topics.includes(eventJsonInterface.signature)
)
web3.eth.abi.decodeLog(eventJsonInterface.inputs, log.data, log.topics)
What I end up with is:
Result {
'0': '0x42087b16F33E688a9e73BFeef94F8F2bd2BfC98f',
'1': '0xfc36bFe712f30F75DF0BA9A60A109Ad51ac7Ca38',
'2': '0x6915d2f3D512F7CfEF968f653D1cA3ed4489798C',
__length__: 3,
a: '0x42087b16F33E688a9e73BFeef94F8F2bd2BfC98f',
b: '0xfc36bFe712f30F75DF0BA9A60A109Ad51ac7Ca38',
c: '0x6915d2f3D512F7CfEF968f653D1cA3ed4489798C' }
where a
is always the same address across events that are fired. I'm generating a new contract with each transaction, and a is the address of this new contract (which I have verified to be correct by firing a separate event from the generated contract that also emits the value of a
), so the resolved value of a
for event Apple
is definitely incorrect.
Has anyone run into this before?
I am using web3 1.0.0-beta.33