fix bug: return array event and not the last one

pull/3094/head
yann300 7 years ago
parent 04ddb14f1b
commit da5884230f
  1. 14
      remix-lib/src/execution/eventsDecoder.js

@ -66,16 +66,20 @@ class EventsDecoder {
_decodeEvents (tx, logs, contractName, compiledContracts, cb) {
var eventsABI = this._eventsABI(compiledContracts)
var events = {}
var events = []
for (var i in logs) {
// [address, topics, mem]
var log = logs[i]
var topicId = log.topics[0]
var abi = this._event(topicId.replace('0x', ''), eventsABI)
var topics = log.topics.map((value) => {
return value.indexOf('0x') === 0 ? value : '0x' + value
})
events = abi.object.parse(topics, '0x' + log.data)
if (abi) {
var topics = log.topics.map((value) => {
return value.indexOf('0x') === 0 ? value : '0x' + value
})
events.push({ topic: topicId, event: abi.event, args: abi.object.parse(topics, '0x' + log.data) })
} else {
events.push({ data: log.data, topics: log.topics })
}
}
cb(null, { decoded: events, raw: logs })
}

Loading…
Cancel
Save