Commit 2742cd2e28df452d516de47fe16c907543b98f0f
Interface: support create resultOffset (EEI r1)
Alex Beregszaszi committed on 8/28/2016, 12:38:13 AMParent: 3cb8a54180de3ba70e81bfebcd2e944557d99715
Files changed
interface.js | changed |
interface.js | ||
---|---|---|
@@ -352,16 +352,19 @@ | ||
352 | 352 | * Creates a new contract with a given value. |
353 | 353 | * @param {integer} valueOffset the offset in memory to the value from |
354 | 354 | * @param {integer} dataOffset the offset to load the code for the new contract from |
355 | 355 | * @param {integer} length the data length |
356 | + * @param (integer} resultOffset the offset to write the new contract address to | |
357 | + * @return {integer} Return 1 or 0 depending on if the VM trapped on the message or not | |
356 | 358 | */ |
357 | - create (valueOffset, dataOffset, length) { | |
359 | + create (valueOffset, dataOffset, length, resultOffset) { | |
358 | 360 | this.takeGas(32000) |
359 | 361 | |
360 | 362 | const value = U256.fromMemory(this.getMemory(valueOffset, U128_SIZE_BYTES)) |
361 | 363 | const data = this.getMemory(dataOffset, length).slice(0) |
362 | - const result = this.environment.create(value, data) | |
363 | - return result | |
364 | + const [result, errorCode] = this.environment.create(value, data) | |
365 | + this.setMemory(resultOffset, ADDRESS_SIZE_BYTES, result) | |
366 | + return errorCode | |
364 | 367 | } |
365 | 368 | |
366 | 369 | /** |
367 | 370 | * Sends a message with arbiatary data to a given address path |
Built with git-ssb-web