Commit a6db0750f91c745388ddb58fe60c2d8b9efba077
Interface: use U256 for values
Alex Beregszaszi committed on 8/17/2016, 10:42:16 AMParent: 026b99c4df17c82be9f9255083a7271d8d3437b6
Files changed
interface.js | changed |
interface.js | ||
---|---|---|
@@ -3,8 +3,9 @@ | ||
3 | 3 | * enables to interact with the Ethereum Environment |
4 | 4 | */ |
5 | 5 | const constants = require('./constants.js') |
6 | 6 | const Address = require('./address.js') |
7 | +const U256 = require('./u256.js') | |
7 | 8 | |
8 | 9 | // The interface exposed to the WebAessembly Core |
9 | 10 | module.exports = class Interface { |
10 | 11 | constructor (environment) { |
@@ -276,9 +277,9 @@ | ||
276 | 277 | * @param {integer} dataOffset the offset to load the code for the new contract from |
277 | 278 | * @param {integer} length the data length |
278 | 279 | */ |
279 | 280 | 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)) | |
281 | 282 | const data = this.getMemory(dataOffset, length) |
282 | 283 | const result = this.environment.create(value, data) |
283 | 284 | return result |
284 | 285 | } |
@@ -300,9 +301,9 @@ | ||
300 | 301 | gas = this.gasLeft() |
301 | 302 | } |
302 | 303 | // Load the params from mem |
303 | 304 | 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)) | |
305 | 306 | const data = this.getMemory(dataOffset, dataLength) |
306 | 307 | // Run the call |
307 | 308 | const [result, errorCode] = this.environment.call(gas, address, value, data) |
308 | 309 | this.setMemory(resultOffset, resultLength, result) |
Built with git-ssb-web