mirror of
https://github.com/luxfi/node.git
synced 2026-10-30 15:24:05 +00:00
79 lines
2.4 KiB
Go
79 lines
2.4 KiB
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package fxs
|
|
|
|
import (
|
|
"github.com/luxfi/ids"
|
|
"github.com/luxfi/node/vms/components/verify"
|
|
lux "github.com/luxfi/utxo"
|
|
"github.com/luxfi/utxo/bls12381fx"
|
|
"github.com/luxfi/utxo/ed25519fx"
|
|
"github.com/luxfi/utxo/mldsafx"
|
|
"github.com/luxfi/utxo/nftfx"
|
|
"github.com/luxfi/utxo/propertyfx"
|
|
"github.com/luxfi/utxo/schnorrfx"
|
|
"github.com/luxfi/utxo/secp256k1fx"
|
|
"github.com/luxfi/utxo/secp256r1fx"
|
|
"github.com/luxfi/utxo/slhdsafx"
|
|
)
|
|
|
|
var (
|
|
_ Fx = (*secp256k1fx.Fx)(nil)
|
|
_ Fx = (*nftfx.Fx)(nil)
|
|
_ Fx = (*propertyfx.Fx)(nil)
|
|
_ Fx = (*mldsafx.Fx)(nil)
|
|
_ Fx = (*slhdsafx.Fx)(nil)
|
|
_ Fx = (*ed25519fx.Fx)(nil)
|
|
_ Fx = (*secp256r1fx.Fx)(nil)
|
|
_ Fx = (*schnorrfx.Fx)(nil)
|
|
_ Fx = (*bls12381fx.Fx)(nil)
|
|
_ verify.Verifiable = (*FxCredential)(nil)
|
|
)
|
|
|
|
type ParsedFx struct {
|
|
ID ids.ID
|
|
Fx Fx
|
|
}
|
|
|
|
// Fx is the interface a feature extension must implement to support the XVM.
|
|
type Fx interface {
|
|
// Initialize this feature extension to be running under this VM. Should
|
|
// return an error if the VM is incompatible.
|
|
Initialize(vm interface{}) error
|
|
|
|
// Notify this Fx that the VM is in bootstrapping
|
|
Bootstrapping() error
|
|
|
|
// Notify this Fx that the VM is bootstrapped
|
|
Bootstrapped() error
|
|
|
|
// VerifyTransfer verifies that the specified transaction can spend the
|
|
// provided utxo with no restrictions on the destination. If the transaction
|
|
// can't spend the output based on the input and credential, a non-nil error
|
|
// should be returned.
|
|
VerifyTransfer(tx, in, cred, utxo interface{}) error
|
|
|
|
// VerifyOperation verifies that the specified transaction can spend the
|
|
// provided utxos conditioned on the result being restricted to the provided
|
|
// outputs. If the transaction can't spend the output based on the input and
|
|
// credential, a non-nil error should be returned.
|
|
VerifyOperation(tx, op, cred interface{}, utxos []interface{}) error
|
|
}
|
|
|
|
type FxOperation interface {
|
|
verify.Verifiable
|
|
lux.Coster
|
|
|
|
Outs() []verify.State
|
|
}
|
|
|
|
type FxCredential struct {
|
|
FxID ids.ID `serialize:"false" json:"fxID"`
|
|
Credential verify.Verifiable `serialize:"true" json:"credential"`
|
|
}
|
|
|
|
func (f *FxCredential) Verify() error {
|
|
return f.Credential.Verify()
|
|
}
|