aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/common.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/vm/common.go')
-rw-r--r--core/vm/common.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/vm/common.go b/core/vm/common.go
index 8d8f4253f..5226f4828 100644
--- a/core/vm/common.go
+++ b/core/vm/common.go
@@ -80,3 +80,13 @@ func getData(data []byte, start, size *big.Int) []byte {
e := common.BigMin(new(big.Int).Add(s, size), dlen)
return common.RightPadBytes(data[s.Uint64():e.Uint64()], int(size.Uint64()))
}
+
+func UseGas(gas, amount *big.Int) bool {
+ if gas.Cmp(amount) < 0 {
+ return false
+ }
+
+ // Sub the amount of gas from the remaining
+ gas.Sub(gas, amount)
+ return true
+}