Merge pull request #421 from ethereum/useEther_5013

use ethers 5.0.13
pull/471/head
yann300 4 years ago committed by GitHub
commit 22c1e665fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      apps/remix-ide-e2e/src/commands/testFunction.ts
  2. 54
      apps/remix-ide-e2e/src/tests/transactionExecution.test.ts
  3. 19
      libs/remix-lib/src/execution/eventsDecoder.js
  4. 3
      libs/remix-lib/src/execution/txHelper.js
  5. 1672
      package-lock.json
  6. 2
      package.json

@ -48,9 +48,9 @@ class TestFunction extends EventEmitter {
const equal: boolean = deepequal(logs[key], expectedValue[key])
if (!equal) {
browser.assert.fail(`Expected ${expectedValue[key]} but got ${logs[key]}`)
browser.assert.fail(`Expected ${JSON.stringify(expectedValue[key])} but got ${JSON.stringify(logs[key])}`)
} else {
browser.assert.ok(true, `Expected value matched returned value ${expectedValue[key]}`)
browser.assert.ok(true, `Expected value matched returned value ${JSON.stringify(expectedValue[key])}`)
}
})
this.emit('complete')

@ -119,34 +119,30 @@ module.exports = {
'1': 'bytes8[4]: _b8ret 0x1234000000000000,0x1234000000000000,0x1234000000000000,0x1234000000000000'
},
logs: [
{
'from': '0x8c1ed7e19abaa9f23c476da86dc1577f1ef401f5',
'topic': '0xd30981760edbf605bda8689e945f622877f230c9a77cbfbd448aa4b7d8ac6e7f',
'event': 'event1',
'args': {
'0': '-123',
'1': '123',
'2': {
'hash': '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',
'type': 'Indexed'
},
'3': '0x12340000',
'4': 'test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ',
'_i': '-123',
'_u': '123',
'_str': {
'hash': '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',
'type': 'Indexed'
},
'_b': '0x12340000',
'_notIndexed': 'test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ',
'length': 5
}
}
]
{"from":"0x8c1ed7e19abaa9f23c476da86dc1577f1ef401f5",
"topic":"0xd30981760edbf605bda8689e945f622877f230c9a77cbfbd448aa4b7d8ac6e7f",
"event":"event1",
"args":{
"0":"-123",
"1":"123",
"2":{
"_isIndexed":true,
"hash":"0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658"
},
"3":"0x12340000",
"4":"test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test "}
}]
})
.click('*[data-id="deployAndRunClearInstances"]')
.end()
},
'Should Compile and Deploy a contract which has an event declaring a function as parameter': function (browser: NightwatchBrowser) {
browser.testContracts('eventFunctionInput.sol', sources[3]['browser/eventFunctionInput.sol'], ['C'])
.clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite
.click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)')
.end()
},
tearDown: sauce
@ -207,5 +203,11 @@ const sources = [
_b8ret = _b8;
emit event1(-123, 123, "test", hex"1234", "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ");
}
}`}},
// https://github.com/ethereum/remix-project/issues/404
{'browser/eventFunctionInput.sol': {content: `
pragma solidity >= 0.7.0;
contract C {
event Test(function() external);
}`}}
]

@ -40,8 +40,8 @@ class EventsDecoder {
const eventABI = {}
const abi = new ethers.utils.Interface(contract.abi)
for (let e in abi.events) {
const event = abi.events[e]
eventABI[event.topic.replace('0x', '')] = { event: event.name, inputs: event.inputs, object: event, abi: abi }
const event = abi.getEvent(e)
eventABI[abi.getEventTopic(e).replace('0x', '')] = { event: event.name, inputs: event.inputs, object: event, abi: abi }
}
return eventABI
}
@ -57,14 +57,21 @@ class EventsDecoder {
_event (hash, eventsABI) {
for (let k in eventsABI) {
if (eventsABI[k][hash]) {
return eventsABI[k][hash]
let event = eventsABI[k][hash]
for (let input of event.inputs) {
if (input.type === 'function') {
input.type = 'bytes24'
input.baseType = 'bytes24'
}
}
return event
}
}
return null
}
_stringifyBigNumber (value) {
return value._ethersType === 'BigNumber' ? value.toString() : value
return value._isBigNumber ? value.toString() : value
}
_stringifyEvent (value) {
@ -89,8 +96,8 @@ class EventsDecoder {
if (eventAbi) {
const decodedlog = eventAbi.abi.parseLog(log)
const decoded = {}
for (const v in decodedlog.values) {
decoded[v] = this._stringifyEvent(decodedlog.values[v])
for (const v in decodedlog.args) {
decoded[v] = this._stringifyEvent(decodedlog.args[v])
}
events.push({ from: log.address, topic: topicId, event: eventAbi.event, args: decoded })
} else {

@ -36,8 +36,7 @@ module.exports = {
encodeFunctionId: function (funABI) {
if (funABI.type === 'fallback' || funABI.type === 'receive') return '0x'
let abi = new ethers.utils.Interface([funABI])
abi = abi.functions[funABI.name]
return abi.sighash
return abi.getSighash(funABI.name)
},
sortAbiFunction: function (contractabi) {

1672
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -199,7 +199,7 @@
"eslint": "6.8.0",
"eslint-config-prettier": "^6.11.0",
"ethereumjs-util": "^6.2.0",
"ethers": "^4.0.27",
"ethers": "^5.0.13",
"events": "^3.0.0",
"execr": "^1.0.1",
"exorcist": "^0.4.0",

Loading…
Cancel
Save