Refactor buffer constructor

pull/5370/head
noelyoo 6 years ago
parent ac0cc676f2
commit e4570e1a3d
  1. 2
      remix-debug/test/decoder/localDecoder.js
  2. 2
      remix-debug/test/decoder/stateTests/mapping.js
  3. 2
      remix-debug/test/decoder/vmCall.js
  4. 2
      remix-debug/test/tests.js
  5. 2
      remix-debug/test/vmCall.js
  6. 2
      remix-lib/src/code/codeResolver.js
  7. 2
      remix-lib/src/execution/eventsDecoder.js
  8. 4
      remix-lib/src/execution/txRunner.js

@ -14,7 +14,7 @@ var compilerInput = remixLib.helpers.compiler.compilerInput
tape('solidity', function (t) {
t.test('local decoder', function (st) {
var privateKey = new Buffer('dae9801649ba2d95a21e688b56f77905e5667c44ce868ec83f82e838712a2c7a', 'hex')
var privateKey = Buffer.from('dae9801649ba2d95a21e688b56f77905e5667c44ce868ec83f82e838712a2c7a', 'hex')
var vm = vmCall.initVM(st, privateKey)
test(st, vm, privateKey)
})

@ -11,7 +11,7 @@ var StorageViewer = require('../../../src/storage/storageViewer')
module.exports = function testMappingStorage (st, cb) {
var mappingStorage = require('../contracts/mappingStorage')
var privateKey = new Buffer('dae9801649ba2d95a21e688b56f77905e5667c44ce868ec83f82e838712a2c7a', 'hex')
var privateKey = Buffer.from('dae9801649ba2d95a21e688b56f77905e5667c44ce868ec83f82e838712a2c7a', 'hex')
var vm = vmCall.initVM(st, privateKey)
var output = compiler.compileStandardWrapper(compilerInput(mappingStorage.contract))
output = JSON.parse(output)

@ -12,7 +12,7 @@ function sendTx (vm, from, to, value, data, cb) {
gasLimit: new BN(3000000, 10),
to: to,
value: new BN(value, 10),
data: new Buffer(data, 'hex')
data: Buffer.from(data, 'hex')
})
tx.sign(from.privateKey)
var block = new Block({

@ -15,7 +15,7 @@ var BreakpointManager = remixLib.code.BreakpointManager
tape('debug contract', function (t) {
t.plan(12)
var privateKey = new Buffer('dae9801649ba2d95a21e688b56f77905e5667c44ce868ec83f82e838712a2c7a', 'hex')
var privateKey = Buffer.from('dae9801649ba2d95a21e688b56f77905e5667c44ce868ec83f82e838712a2c7a', 'hex')
var vm = vmCall.initVM(t, privateKey)
var output = compiler.compileStandardWrapper(compilerInput(ballot))
output = JSON.parse(output)

@ -12,7 +12,7 @@ function sendTx (vm, from, to, value, data, cb) {
gasLimit: new BN(3000000, 10),
to: to,
value: new BN(value, 10),
data: new Buffer(data, 'hex')
data: Buffer.from(data, 'hex')
})
tx.sign(from.privateKey)
var block = new Block({

@ -48,7 +48,7 @@ CodeResolver.prototype.cacheExecutingCode = function (address, hexCode) {
}
CodeResolver.prototype.formatCode = function (hexCode) {
var code = codeUtils.nameOpCodes(new Buffer(hexCode.substring(2), 'hex'))
var code = codeUtils.nameOpCodes(Buffer.from(hexCode.substring(2), 'hex'))
return {
code: code[0],
instructionsIndexByBytesOffset: code[1]

@ -42,7 +42,7 @@ class EventsDecoder {
var abi = new ethers.Interface(contract.abi)
for (var e in abi.events) {
var event = abi.events[e]
eventABI[ethJSUtil.sha3(new Buffer(event.signature)).toString('hex')] = { event: event.name, inputs: event.inputs, object: event }
eventABI[ethJSUtil.sha3(Buffer.from(event.signature)).toString('hex')] = { event: event.name, inputs: event.inputs, object: event }
}
return eventABI
}

@ -100,7 +100,7 @@ class TxRunner {
gasLimit: new BN(gasLimit, 10),
to: to,
value: new BN(value, 10),
data: new Buffer(data.slice(2), 'hex')
data: Buffer.from(data.slice(2), 'hex')
})
tx.sign(account.privateKey)
@ -133,7 +133,7 @@ class TxRunner {
}
callback(err, {
result: result,
transactionHash: ethJSUtil.bufferToHex(new Buffer(tx.hash()))
transactionHash: ethJSUtil.bufferToHex(Buffer.from(tx.hash()))
})
})
}

Loading…
Cancel
Save