core,vm: implement System.Runtime.GasLeft syscall

This commit is contained in:
Evgenii Stratonikov 2020-06-16 12:04:08 +03:00
parent a7d4fff897
commit a4e4439967
5 changed files with 31 additions and 0 deletions

View file

@ -0,0 +1,12 @@
package runtime
import (
"github.com/nspcc-dev/neo-go/pkg/core/interop"
"github.com/nspcc-dev/neo-go/pkg/vm"
)
// GasLeft returns remaining amount of GAS.
func GasLeft(_ *interop.Context, v *vm.VM) error {
v.Estack().PushVal(int64(v.GasLimit - v.GasConsumed()))
return nil
}