git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 2742cd2e28df452d516de47fe16c907543b98f0f

Interface: support create resultOffset (EEI r1)

Alex Beregszaszi committed on 8/28/2016, 12:38:13 AM
Parent: 3cb8a54180de3ba70e81bfebcd2e944557d99715

Files changed

interface.jschanged
interface.jsView
@@ -352,16 +352,19 @@
352352 * Creates a new contract with a given value.
353353 * @param {integer} valueOffset the offset in memory to the value from
354354 * @param {integer} dataOffset the offset to load the code for the new contract from
355355 * @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
356358 */
357- create (valueOffset, dataOffset, length) {
359+ create (valueOffset, dataOffset, length, resultOffset) {
358360 this.takeGas(32000)
359361
360362 const value = U256.fromMemory(this.getMemory(valueOffset, U128_SIZE_BYTES))
361363 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
364367 }
365368
366369 /**
367370 * Sends a message with arbiatary data to a given address path

Built with git-ssb-web