git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit a6db0750f91c745388ddb58fe60c2d8b9efba077

Interface: use U256 for values

Alex Beregszaszi committed on 8/17/2016, 10:42:16 AM
Parent: 026b99c4df17c82be9f9255083a7271d8d3437b6

Files changed

interface.jschanged
interface.jsView
@@ -3,8 +3,9 @@
33 * enables to interact with the Ethereum Environment
44 */
55 const constants = require('./constants.js')
66 const Address = require('./address.js')
7+const U256 = require('./u256.js')
78
89 // The interface exposed to the WebAessembly Core
910 module.exports = class Interface {
1011 constructor (environment) {
@@ -276,9 +277,9 @@
276277 * @param {integer} dataOffset the offset to load the code for the new contract from
277278 * @param {integer} length the data length
278279 */
279280 create (valueOffset, dataOffset, length) {
280- const value = this.getMemory(valueOffset, constants.BALANCE_SIZE_BYTES)
281+ const value = new U256(this.getMemory(valueOffset, constants.BALANCE_SIZE_BYTES))
281282 const data = this.getMemory(dataOffset, length)
282283 const result = this.environment.create(value, data)
283284 return result
284285 }
@@ -300,9 +301,9 @@
300301 gas = this.gasLeft()
301302 }
302303 // Load the params from mem
303304 const address = new Address(this.getMemory(addressOffset, constants.ADDRESS_SIZE_BYTES))
304- const value = this.getMemory(valueOffset, constants.BALANCE_SIZE_BYTES)
305+ const value = new U256(this.getMemory(valueOffset, constants.BALANCE_SIZE_BYTES))
305306 const data = this.getMemory(dataOffset, dataLength)
306307 // Run the call
307308 const [result, errorCode] = this.environment.call(gas, address, value, data)
308309 this.setMemory(resultOffset, resultLength, result)

Built with git-ssb-web