Merge pull request #782 from ethereum/fixEvent

prepend hex value with 0x
pull/7/head
yann300 7 years ago committed by GitHub
commit e95b42b4ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      remix-lib/src/execution/eventsDecoder.js
  2. 6
      remix-lib/src/web3Provider/web3VmProvider.js

@ -73,10 +73,7 @@ class EventsDecoder {
var topicId = log.topics[0] var topicId = log.topics[0]
var abi = this._event(topicId.replace('0x', ''), eventsABI) var abi = this._event(topicId.replace('0x', ''), eventsABI)
if (abi) { if (abi) {
var topics = log.topics.map((value) => { events.push({ from: log.address, topic: topicId, event: abi.event, args: abi.object.parse(log.topics, log.data) })
return value.indexOf('0x') === 0 ? value : '0x' + value
})
events.push({ from: log.address, topic: topicId, event: abi.event, args: abi.object.parse(topics, '0x' + log.data) })
} else { } else {
events.push({ from: log.address, data: log.data, topics: log.topics }) events.push({ from: log.address, data: log.data, topics: log.topics })
} }

@ -108,14 +108,14 @@ web3VmProvider.prototype.txProcessed = function (self, data) {
var topics = [] var topics = []
if (log[1].length > 0) { if (log[1].length > 0) {
for (var k in log[1]) { for (var k in log[1]) {
topics.push(log[1][k].toString('hex')) topics.push('0x' + log[1][k].toString('hex'))
} }
} else { } else {
topics.push('0x') topics.push('0x')
} }
logs.push({ logs.push({
address: log[0].toString('hex'), address: '0x' + log[0].toString('hex'),
data: log[2].toString('hex'), data: '0x' + log[2].toString('hex'),
topics: topics, topics: topics,
rawVMResponse: log rawVMResponse: log
}) })

Loading…
Cancel
Save