-
Notifications
You must be signed in to change notification settings - Fork 170
/
params.go
49 lines (39 loc) · 1.09 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
package keeper
import (
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/umee-network/umee/v5/x/uibc"
)
// SetParams sets the x/uibc module's parameters.
func (k Keeper) SetParams(params uibc.Params) error {
bz, err := k.cdc.Marshal(¶ms)
if err != nil {
return err
}
k.store.Set(keyParams, bz)
return nil
}
// GetParams gets the x/uibc module's parameters.
func (k Keeper) GetParams() (params uibc.Params) {
bz := k.store.Get(keyParams)
if bz == nil {
return params
}
k.cdc.MustUnmarshal(bz, ¶ms)
return params
}
// UpdateQuotaParams update the ibc-transfer quota params for ibc denoms
func (k Keeper) UpdateQuotaParams(totalQuota, quotaPerDenom sdk.Dec, quotaDuration time.Duration,
) error {
params := k.GetParams()
params.TotalQuota = totalQuota
params.QuotaDuration = quotaDuration
params.TokenQuota = quotaPerDenom
return k.SetParams(params)
}
// SetIBCStatus update the ibc-transfer status in module params.
func (k Keeper) SetIBCStatus(ibcStatus uibc.IBCTransferStatus) error {
params := k.GetParams()
params.IbcStatus = ibcStatus
return k.SetParams(params)
}