forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fx.go
40 lines (32 loc) · 1.24 KB
/
fx.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package avm
import (
"github.com/ava-labs/gecko/ids"
"github.com/ava-labs/gecko/vms/components/verify"
)
type parsedFx struct {
ID ids.ID
Fx Fx
}
// Fx is the interface a feature extension must implement to support the AVM.
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
// 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
}
// FxOperation ...
type FxOperation interface {
verify.Verifiable
Outs() []verify.Verifiable
}