4 "github.com/holiman/uint256"
7 func opCheckOutput(vm *virtualMachine) error {
8 if err := vm.applyCost(16); err != nil {
12 code, err := vm.pop(true)
17 vmVersion, err := vm.popBigInt(true)
22 assetID, err := vm.pop(true)
27 amountInt, err := vm.popBigInt(true)
32 amount, overflow := amountInt.Uint64WithOverflow()
37 index, err := vm.popBigInt(true)
42 if vm.context.CheckOutput == nil {
46 ok, err := vm.context.CheckOutput(uint64(index.Uint64()), amount, assetID, uint64(vmVersion.Uint64()), code, vm.altStack, vm.expansionReserved)
50 return vm.pushBool(ok, true)
53 func opAsset(vm *virtualMachine) error {
54 if err := vm.applyCost(1); err != nil {
58 if vm.context.AssetID == nil {
61 return vm.pushDataStack(*vm.context.AssetID, true)
64 func opAmount(vm *virtualMachine) error {
65 if err := vm.applyCost(1); err != nil {
69 if vm.context.Amount == nil {
73 return vm.pushBigInt(uint256.NewInt().SetUint64(*vm.context.Amount), true)
76 func opProgram(vm *virtualMachine) error {
77 if err := vm.applyCost(1); err != nil {
81 return vm.pushDataStack(vm.context.Code, true)
84 func opIndex(vm *virtualMachine) error {
85 if err := vm.applyCost(1); err != nil {
89 if vm.context.DestPos == nil {
93 return vm.pushBigInt(uint256.NewInt().SetUint64(*vm.context.DestPos), true)
96 func opEntryID(vm *virtualMachine) error {
97 if err := vm.applyCost(1); err != nil {
100 return vm.pushDataStack(vm.context.EntryID, true)
103 func opOutputID(vm *virtualMachine) error {
104 if err := vm.applyCost(1); err != nil {
108 if vm.context.SpentOutputID == nil {
111 return vm.pushDataStack(*vm.context.SpentOutputID, true)
114 func opBlockHeight(vm *virtualMachine) error {
115 if err := vm.applyCost(1); err != nil {
119 if vm.context.BlockHeight == nil {
123 return vm.pushBigInt(uint256.NewInt().SetUint64(*vm.context.BlockHeight), true)