mirror of
https://github.com/luxfi/utxo.git
synced 2026-10-30 15:13:57 +00:00
52 lines
1.2 KiB
Go
52 lines
1.2 KiB
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package propertyfx
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/luxfi/runtime"
|
|
|
|
"github.com/luxfi/utxo/secp256k1fx"
|
|
"github.com/luxfi/vm/components/verify"
|
|
)
|
|
|
|
var errNilMintOperation = errors.New("nil mint operation")
|
|
|
|
type MintOperation struct {
|
|
MintInput secp256k1fx.Input `serialize:"true" json:"mintInput"`
|
|
MintOutput MintOutput `serialize:"true" json:"mintOutput"`
|
|
OwnedOutput OwnedOutput `serialize:"true" json:"ownedOutput"`
|
|
}
|
|
|
|
func (op *MintOperation) InitRuntime(rt *runtime.Runtime) {
|
|
op.MintOutput.OutputOwners.InitRuntime(rt)
|
|
op.OwnedOutput.OutputOwners.InitRuntime(rt)
|
|
}
|
|
|
|
// InitializeContext implements the fxs.FxOperation interface
|
|
func (op *MintOperation) InitializeRuntime(rt *runtime.Runtime) error {
|
|
op.InitRuntime(rt)
|
|
return nil
|
|
}
|
|
|
|
func (op *MintOperation) Cost() (uint64, error) {
|
|
return op.MintInput.Cost()
|
|
}
|
|
|
|
func (op *MintOperation) Outs() []verify.State {
|
|
return []verify.State{
|
|
&op.MintOutput,
|
|
&op.OwnedOutput,
|
|
}
|
|
}
|
|
|
|
func (op *MintOperation) Verify() error {
|
|
if op == nil {
|
|
return errNilMintOperation
|
|
}
|
|
|
|
return verify.All(&op.MintInput, &op.MintOutput, &op.OwnedOutput)
|
|
}
|