interface.jsView |
---|
38 | 38 | 'gasLimit', |
39 | 39 | 'log', |
40 | 40 | 'create', |
41 | 41 | 'call', |
| 42 | + 'callCode', |
42 | 43 | 'callDelegate', |
43 | 44 | 'sstore', |
44 | 45 | 'sload', |
45 | 46 | 'return', |
310 | 311 | return errorCode |
311 | 312 | } |
312 | 313 | |
313 | 314 | |
| 315 | + * Message-call into this account with an alternative account’s code. |
| 316 | + * @param {integer} addressOffset the offset to load the address path from |
| 317 | + * @param {integer} valueOffset the offset to load the value from |
| 318 | + * @param {integer} dataOffset the offset to load data from |
| 319 | + * @param {integer} dataLength the length of data |
| 320 | + * @param {integer} resultOffset the offset to store the result data at |
| 321 | + * @param {integer} resultLength |
| 322 | + * @param {integer} gas |
| 323 | + * @return {integer} Returns 1 or 0 depending on if the VM trapped on the message or not |
| 324 | + * TODO: add proper gas counting |
| 325 | + */ |
| 326 | + callCode (addressOffset, valueOffset, dataOffset, dataLength, resultOffset, resultLength, gas) { |
| 327 | + |
| 328 | + const address = new Address(this.getMemory(addressOffset, constants.ADDRESS_SIZE_BYTES)) |
| 329 | + const value = new U256(this.getMemory(valueOffset, constants.BALANCE_SIZE_BYTES)) |
| 330 | + const data = this.getMemory(dataOffset, dataLength) |
| 331 | + |
| 332 | + const [result, errorCode] = this.environment.callCode(gas, address, value, data) |
| 333 | + this.setMemory(resultOffset, resultLength, result) |
| 334 | + return errorCode |
| 335 | + } |
| 336 | + |
| 337 | + |
314 | 338 | * Message-call into this account with an alternative account’s code, but |
315 | 339 | * persisting the current values for sender and value. |
316 | 340 | * @param {integer} gas |
317 | 341 | * @param {integer} addressOffset the offset to load the address path from |