-
Notifications
You must be signed in to change notification settings - Fork 18
/
runtime.go
75 lines (63 loc) · 1.5 KB
/
runtime.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Package runtime provides low-level components of the Solana Execution Layer.
package runtime
import "time"
type Account struct {
Lamports uint64
Data []byte
Owner [32]byte
Executable bool
RentEpoch uint64
}
type PohParams struct {
TickDuration time.Duration
HasTickCount bool
TickCount uint64
HasHashesPerTick bool
HashesPerTick uint64
}
type InflationParams struct {
Initial float64
Terminal float64
Taper float64
Foundation float64
FoundationTerm float64
Padding00 [8]byte
}
type EpochSchedule struct {
SlotPerEpoch uint64
LeaderScheduleSlotOffset uint64
Warmup bool
FirstNormalEpoch uint64
FirstNormalSlot uint64
}
type FeeParams struct {
TargetLamportsPerSig uint64
TargetSigsPerSlot uint64
MinLamportsPerSig uint64
MaxLamportsPerSig uint64
BurnPercent uint8
}
type RentParams struct {
LamportsPerByteYear uint64
ExemptionThreshold float64
BurnPercent uint8
}
type Accounts interface {
GetAccount(pubkey *[32]byte) (*Account, error)
SetAccount(pubkey *[32]byte, acc *Account) error
}
type MemAccounts struct {
Map map[[32]byte]*Account
}
func NewMemAccounts() MemAccounts {
return MemAccounts{
Map: make(map[[32]byte]*Account),
}
}
func (m MemAccounts) GetAccount(pubkey *[32]byte) (*Account, error) {
return m.Map[*pubkey], nil
}
func (m MemAccounts) SetAccount(pubkey *[32]byte, acc *Account) error {
m.Map[*pubkey] = acc
return nil
}