git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 7250d1d613c9fe437b5c03af7ff4973d93dd5227

renamed addGas -> useGas

wanderer committed on 7/17/2016, 3:05:57 PM
Parent: 81bc698eafe0e2013602fe8f6e9aae6fe7b0ee7b

Files changed

environment.jschanged
interface.jschanged
environment.jsView
@@ -5,9 +5,8 @@
55 constructor (data) {
66 const defaults = {
77 // gas tank
88 gasCounter: 0, // TODO: gasCounter is only 53 bits
9- gas: 0, // The amount of gas this contract has
109 gasPrice: 0,
1110 gasLimit: 0, // The gas limit for the block
1211 // call infromation
1312 address: new Uint8Array(20),
@@ -29,13 +28,14 @@
2928 this.state = new Graph()
3029
3130 if (data) {
3231 data = JSON.parse(data)
33- Object.assign(this, defaults, data)
3432 } else {
3533 data = {}
3634 }
3735
36+ Object.assign(this, defaults, data)
37+
3838 if (data.accounts) {
3939 this.accounts = new Graph()
4040 const self = this
4141 data.accounts.forEach((account) => {
interface.jsView
@@ -31,9 +31,9 @@
3131 /**
3232 * Subtracts an amount to the gas counter
3333 * @param {integer} amount the amount to subtract to the gas counter
3434 */
35- addGas (amount) {
35+ useGas (amount) {
3636 if (amount > 0) {
3737 ENV.gasCounter += amount
3838 }
3939 }
@@ -50,9 +50,9 @@
5050 * Returns the current gasCounter
5151 * @return {integer}
5252 */
5353 gasLeft () {
54- return ENV.gas - ENV.gasCounter
54+ return ENV.gasLimit - ENV.gasCounter
5555 }
5656
5757 /**
5858 * Gets address of currently executing account and loads it into memory at

Built with git-ssb-web