-
Notifications
You must be signed in to change notification settings - Fork 95
/
Copy pathtoken_scheme.go
48 lines (37 loc) · 1.2 KB
/
token_scheme.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
41
42
43
44
45
46
47
48
package iotago
import (
"fmt"
"math/big"
"github.com/iotaledger/hive.go/constraints"
)
// TokenSchemeType defines the type of token schemes.
type TokenSchemeType byte
const (
// TokenSchemeSimple denotes a type of output which is locked by a signature and deposits onto a single address.
TokenSchemeSimple TokenSchemeType = iota
)
func (tokenSchemeType TokenSchemeType) String() string {
if int(tokenSchemeType) >= len(tokenSchemeNames) {
return fmt.Sprintf("unknown token scheme type: %d", tokenSchemeType)
}
return tokenSchemeNames[tokenSchemeType]
}
var (
tokenSchemeNames = [TokenSchemeSimple + 1]string{
"SimpleTokenScheme",
}
)
// TokenScheme defines a scheme for to be used for an OutputFoundry.
type TokenScheme interface {
Sizer
NonEphemeralObject
ProcessableObject
constraints.Cloneable[TokenScheme]
constraints.Equalable[TokenScheme]
// Type returns the type of the TokenScheme.
Type() TokenSchemeType
// StateTransition validates the transition of the token scheme against its new state.
StateTransition(transType ChainTransitionType, nextState TokenScheme, in *big.Int, out *big.Int) error
// SyntacticalValidation validates the syntactical rules.
SyntacticalValidation() error
}