Skip to content

Commit 9c1b207

Browse files
committed
use ethers 5.0.13
1 parent d92d307 commit 9c1b207

File tree

6 files changed

+543
-117
lines changed

6 files changed

+543
-117
lines changed

apps/remix-ide-e2e/src/commands/testFunction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ class TestFunction extends EventEmitter {
4848
const equal: boolean = deepequal(logs[key], expectedValue[key])
4949

5050
if (!equal) {
51-
browser.assert.fail(`Expected ${expectedValue[key]} but got ${logs[key]}`)
51+
browser.assert.fail(`Expected ${JSON.stringify(expectedValue[key])} but got ${JSON.stringify(logs[key])}`)
5252
} else {
53-
browser.assert.ok(true, `Expected value matched returned value ${expectedValue[key]}`)
53+
browser.assert.ok(true, `Expected value matched returned value ${JSON.stringify(expectedValue[key])}`)
5454
}
5555
})
5656
this.emit('complete')

apps/remix-ide-e2e/src/tests/transactionExecution.test.ts

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -119,34 +119,30 @@ module.exports = {
119119
'1': 'bytes8[4]: _b8ret 0x1234000000000000,0x1234000000000000,0x1234000000000000,0x1234000000000000'
120120
},
121121
logs: [
122-
{
123-
'from': '0x8c1ed7e19abaa9f23c476da86dc1577f1ef401f5',
124-
'topic': '0xd30981760edbf605bda8689e945f622877f230c9a77cbfbd448aa4b7d8ac6e7f',
125-
'event': 'event1',
126-
'args': {
127-
'0': '-123',
128-
'1': '123',
129-
'2': {
130-
'hash': '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',
131-
'type': 'Indexed'
132-
},
133-
'3': '0x12340000',
134-
'4': 'test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ',
135-
'_i': '-123',
136-
'_u': '123',
137-
'_str': {
138-
'hash': '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',
139-
'type': 'Indexed'
140-
},
141-
'_b': '0x12340000',
142-
'_notIndexed': 'test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ',
143-
'length': 5
144-
}
145-
}
146-
]
122+
{"from":"0x8c1ed7e19abaa9f23c476da86dc1577f1ef401f5",
123+
"topic":"0xd30981760edbf605bda8689e945f622877f230c9a77cbfbd448aa4b7d8ac6e7f",
124+
"event":"event1",
125+
"args":{
126+
"0":"-123",
127+
"1":"123",
128+
"2":{
129+
"_isIndexed":true,
130+
"hash":"0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658"
131+
},
132+
"3":"0x12340000",
133+
"4":"test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test "}
134+
}]
147135
})
148136
.click('*[data-id="deployAndRunClearInstances"]')
149-
.end()
137+
},
138+
139+
'Should Compile and Deploy a contract which has an event declaring a function as parameter': function (browser: NightwatchBrowser) {
140+
browser.testContracts('eventFunctionInput.sol', sources[3]['browser/eventFunctionInput.sol'], ['C'])
141+
.clickLaunchIcon('udapp')
142+
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
143+
.click('#runTabView button[class^="instanceButton"]')
144+
.waitForElementPresent('.instance:nth-of-type(2)')
145+
.end()
150146
},
151147

152148
tearDown: sauce
@@ -207,5 +203,11 @@ const sources = [
207203
_b8ret = _b8;
208204
emit event1(-123, 123, "test", hex"1234", "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ");
209205
}
206+
}`}},
207+
// https://github.com/ethereum/remix-project/issues/404
208+
{'browser/eventFunctionInput.sol': {content: `
209+
pragma solidity >= 0.7.0;
210+
contract C {
211+
event Test(function() external);
210212
}`}}
211213
]

libs/remix-lib/src/execution/eventsDecoder.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class EventsDecoder {
4040
const eventABI = {}
4141
const abi = new ethers.utils.Interface(contract.abi)
4242
for (let e in abi.events) {
43-
const event = abi.events[e]
44-
eventABI[event.topic.replace('0x', '')] = { event: event.name, inputs: event.inputs, object: event, abi: abi }
43+
const event = abi.getEvent(e)
44+
eventABI[abi.getEventTopic(e).replace('0x', '')] = { event: event.name, inputs: event.inputs, object: event, abi: abi }
4545
}
4646
return eventABI
4747
}
@@ -57,14 +57,21 @@ class EventsDecoder {
5757
_event (hash, eventsABI) {
5858
for (let k in eventsABI) {
5959
if (eventsABI[k][hash]) {
60-
return eventsABI[k][hash]
60+
let event = eventsABI[k][hash]
61+
for (let input of event.inputs) {
62+
if (input.type === 'function') {
63+
input.type = 'bytes24'
64+
input.baseType = 'bytes24'
65+
}
66+
}
67+
return event
6168
}
6269
}
6370
return null
6471
}
6572

6673
_stringifyBigNumber (value) {
67-
return value._ethersType === 'BigNumber' ? value.toString() : value
74+
return value._isBigNumber ? value.toString() : value
6875
}
6976

7077
_stringifyEvent (value) {
@@ -89,8 +96,8 @@ class EventsDecoder {
8996
if (eventAbi) {
9097
const decodedlog = eventAbi.abi.parseLog(log)
9198
const decoded = {}
92-
for (const v in decodedlog.values) {
93-
decoded[v] = this._stringifyEvent(decodedlog.values[v])
99+
for (const v in decodedlog.args) {
100+
decoded[v] = this._stringifyEvent(decodedlog.args[v])
94101
}
95102
events.push({ from: log.address, topic: topicId, event: eventAbi.event, args: decoded })
96103
} else {

libs/remix-lib/src/execution/txHelper.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ module.exports = {
3636
encodeFunctionId: function (funABI) {
3737
if (funABI.type === 'fallback' || funABI.type === 'receive') return '0x'
3838
let abi = new ethers.utils.Interface([funABI])
39-
abi = abi.functions[funABI.name]
40-
return abi.sighash
39+
return abi.getSighash(funABI.name)
4140
},
4241

4342
sortAbiFunction: function (contractabi) {

0 commit comments

Comments
 (0)