-
Notifications
You must be signed in to change notification settings - Fork 319
/
params.go
47 lines (40 loc) · 1.23 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
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/dymensionxyz/dymension/v3/x/rollapp/types"
)
// GetParams get all parameters as types.Params
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
return types.NewParams(
k.RollappsEnabled(ctx),
k.DisputePeriodInBlocks(ctx),
k.DeployerWhitelist(ctx),
)
}
// SetParams set the params
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramstore.SetParamSet(ctx, ¶ms)
}
// DisputePeriodInBlocks returns the DisputePeriodInBlocks param
func (k Keeper) DisputePeriodInBlocks(ctx sdk.Context) (res uint64) {
k.paramstore.Get(ctx, types.KeyDisputePeriodInBlocks, &res)
return
}
// DeployerWhitelist returns the DeployerWhitelist param
func (k Keeper) DeployerWhitelist(ctx sdk.Context) (res []types.DeployerParams) {
k.paramstore.Get(ctx, types.KeyDeployerWhitelist, &res)
return
}
func (k Keeper) RollappsEnabled(ctx sdk.Context) (res bool) {
k.paramstore.Get(ctx, types.KeyRollappsEnabled, &res)
return
}
func (k Keeper) IsAddressInDeployerWhiteList(ctx sdk.Context, address string) bool {
whitelist := k.DeployerWhitelist(ctx)
for _, item := range whitelist {
if item.Address == address {
return true
}
}
return false
}