/
params.go
59 lines (50 loc) · 1.39 KB
/
params.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
package types
import (
"fmt"
"github.com/cosmos/cosmos-sdk/x/params"
)
var _ params.ParamSet = (*Params)(nil)
var (
KeyActivationFee = []byte("ActivationFee")
KeyLockCoinsFreeTime = []byte("LockCoinsFreeTime")
KeyLockCoinsFeePerDay = []byte("LockCoinsFeePerDay")
)
type Params struct {
ActivationFee int64 `json:"activation_fee"`
LockCoinsFreeTime int64 `json:"lock_coins_free_time"`
LockCoinsFeePerDay int64 `json:"lock_coins_fee_per_day"`
}
func NewParams(activation int64, freeTime, lock int64) Params {
return Params{
ActivationFee: activation,
LockCoinsFreeTime: freeTime,
LockCoinsFeePerDay: lock,
}
}
func DefaultParams() Params {
return Params{
ActivationFee: 100000000,
LockCoinsFreeTime: 604800000000000,
LockCoinsFeePerDay: 1e6,
}
}
// ParamKeyTable type declaration for parameters
func ParamKeyTable() params.KeyTable {
return params.NewKeyTable().RegisterParamSet(&Params{})
}
func (p *Params) ParamSetPairs() params.ParamSetPairs {
return params.ParamSetPairs{
{Key: KeyActivationFee, Value: &p.ActivationFee},
{Key: KeyLockCoinsFreeTime, Value: &p.LockCoinsFreeTime},
{Key: KeyLockCoinsFeePerDay, Value: &p.LockCoinsFeePerDay},
}
}
func (p Params) String() string {
return fmt.Sprintf(`BankX Params:
ActivationFee: %d
LockCoinsFreeTime: %d
LockCoinsFeePerDay: %d`,
p.ActivationFee,
p.LockCoinsFreeTime,
p.LockCoinsFeePerDay)
}