-
Notifications
You must be signed in to change notification settings - Fork 6
/
vesting_updates.go
79 lines (65 loc) · 2.47 KB
/
vesting_updates.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
76
77
78
79
package v131
import (
cfeupgradetypes "github.com/chain4energy/c4e-chain/app/upgrades"
cfevestingtypes "github.com/chain4energy/c4e-chain/x/cfevesting/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"time"
)
const (
VcRoundTypeName = "VC round"
ValidatorRoundTypeName = "Validator round"
PublicRoundTypeName = "Public round"
EarlyBirdRoundTypeName = "Early-bird round"
)
func ModifyVestingTypes(ctx sdk.Context, appKeepers cfeupgradetypes.AppKeepers) error {
ctx.Logger().Info("modifying vesting types")
_, err := appKeepers.GetC4eVestingKeeper().MustGetVestingType(ctx, VcRoundTypeName)
if err != nil {
ctx.Logger().Info("vesting type not found", "vestingType", VcRoundTypeName)
return nil
}
_, err = appKeepers.GetC4eVestingKeeper().MustGetVestingType(ctx, ValidatorRoundTypeName)
if err != nil {
ctx.Logger().Info("vesting type not found", "vestingType", ValidatorRoundTypeName)
return nil
}
_, err = appKeepers.GetC4eVestingKeeper().MustGetVestingType(ctx, PublicRoundTypeName)
if err != nil {
ctx.Logger().Info("vesting type not found", "vestingType", PublicRoundTypeName)
return nil
}
_, err = appKeepers.GetC4eVestingKeeper().MustGetVestingType(ctx, EarlyBirdRoundTypeName)
if err != nil {
ctx.Logger().Info("vesting type not found", "vestingType", EarlyBirdRoundTypeName)
return nil
}
vcRoundPoolType := cfevestingtypes.VestingType{
Name: VcRoundTypeName,
Free: sdk.MustNewDecFromStr("0.08"),
LockupPeriod: 122 * 24 * time.Hour,
VestingPeriod: 305 * 24 * time.Hour,
}
appKeepers.GetC4eVestingKeeper().SetVestingType(ctx, vcRoundPoolType)
validatorRoundType := cfevestingtypes.VestingType{
Name: ValidatorRoundTypeName,
Free: sdk.MustNewDecFromStr("0.08"),
LockupPeriod: 122 * 24 * time.Hour,
VestingPeriod: 305 * 24 * time.Hour,
}
appKeepers.GetC4eVestingKeeper().SetVestingType(ctx, validatorRoundType)
publicRoundType := cfevestingtypes.VestingType{
Name: PublicRoundTypeName,
Free: sdk.MustNewDecFromStr("0.2"),
LockupPeriod: 30 * 24 * time.Hour,
VestingPeriod: 152 * 24 * time.Hour,
}
appKeepers.GetC4eVestingKeeper().SetVestingType(ctx, publicRoundType)
earlyBirdRoundType := cfevestingtypes.VestingType{
Name: EarlyBirdRoundTypeName,
Free: sdk.MustNewDecFromStr("0.15"),
LockupPeriod: 61 * 24 * time.Hour,
VestingPeriod: 213 * 24 * time.Hour,
}
appKeepers.GetC4eVestingKeeper().SetVestingType(ctx, earlyBirdRoundType)
return nil
}