git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 00b2375ce8a8d25dbfe66d174a6ea9ed9c2e867c

Interface: rename BALANCE_SIZE_BYTES to U128_SIZE_BYTES

Alex Beregszaszi committed on 8/25/2016, 2:39:12 AM
Parent: e471d345208468943e92014ec771d505815361d6

Files changed

constants.jschanged
interface.jschanged
constants.jsView
@@ -1,5 +1,5 @@
11 module.exports = {
2- BALANCE_SIZE_BYTES: 16, // Max balance size in bytes
2+ U128_SIZE_BYTES: 16, // Max balance size in bytes
33 ADDRESS_SIZE_BYTES: 20, // Address size in bytes
44 U256_SIZE_BYTES: 32
55 }
interface.jsView
@@ -101,9 +101,9 @@
101101
102102 const address = Address.fromMemory(this.getMemory(addressOffset, constants.ADDRESS_SIZE_BYTES))
103103 // call the parent contract and ask for the balance of one of its child contracts
104104 const balance = this.environment.getBalance(address)
105- this.setMemory(offset, constants.BALANCE_SIZE_BYTES, balance.toMemory(constants.BALANCE_SIZE_BYTES))
105+ this.setMemory(offset, constants.U128_SIZE_BYTES, balance.toMemory(constants.U128_SIZE_BYTES))
106106 }
107107
108108 /**
109109 * Gets the execution's origination address and loads it into memory at the
@@ -135,9 +135,9 @@
135135 */
136136 getCallValue (offset) {
137137 this.takeGas(2)
138138
139- this.setMemory(offset, constants.BALANCE_SIZE_BYTES, this.environment.callValue.toMemory(constants.BALANCE_SIZE_BYTES))
139+ this.setMemory(offset, constants.U128_SIZE_BYTES, this.environment.callValue.toMemory(constants.U128_SIZE_BYTES))
140140 }
141141
142142 /**
143143 * Get size of input data in current environment. This pertains to the input
@@ -332,9 +332,9 @@
332332 */
333333 create (valueOffset, dataOffset, length) {
334334 this.takeGas(32000)
335335
336- const value = U256.fromMemory(this.getMemory(valueOffset, constants.BALANCE_SIZE_BYTES))
336+ const value = U256.fromMemory(this.getMemory(valueOffset, constants.U128_SIZE_BYTES))
337337 const data = this.getMemory(dataOffset, length)
338338 const result = this.environment.create(value, data)
339339 return result
340340 }
@@ -355,9 +355,9 @@
355355 this.takeGas(40)
356356
357357 // Load the params from mem
358358 const address = Address.fromMemory(this.getMemory(addressOffset, constants.ADDRESS_SIZE_BYTES))
359- const value = U256.fromMemory(this.getMemory(valueOffset, constants.BALANCE_SIZE_BYTES))
359+ const value = U256.fromMemory(this.getMemory(valueOffset, constants.U128_SIZE_BYTES))
360360 const data = this.getMemory(dataOffset, dataLength)
361361 // Run the call
362362 const [result, errorCode] = this.environment.call(gas, address, value, data)
363363 this.setMemory(resultOffset, resultLength, result)
@@ -380,9 +380,9 @@
380380 this.takeGas(40)
381381
382382 // Load the params from mem
383383 const address = Address.fromMemory(this.getMemory(addressOffset, constants.ADDRESS_SIZE_BYTES))
384- const value = U256.fromMemory(this.getMemory(valueOffset, constants.BALANCE_SIZE_BYTES))
384+ const value = U256.fromMemory(this.getMemory(valueOffset, constants.U128_SIZE_BYTES))
385385 const data = this.getMemory(dataOffset, dataLength)
386386 // Run the call
387387 const [result, errorCode] = this.environment.callCode(gas, address, value, data)
388388 this.setMemory(resultOffset, resultLength, result)

Built with git-ssb-web