Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
6ed9e1f
WIP: add ibc rate limit middleware to ibc transfer
gsk967 Nov 7, 2022
4ce49c9
Merge main
gsk967 Nov 9, 2022
aada85f
WIP: add cll tx,query cmds
gsk967 Nov 9, 2022
08e3d08
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 10, 2022
16b50cd
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 11, 2022
57870ca
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 11, 2022
8412c70
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 12, 2022
9a4d380
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 12, 2022
28e2422
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 12, 2022
8e24765
WIP: add check rate limits for ibc denom
gsk967 Nov 14, 2022
4ad23eb
remove ibc-rate-limits and move rate limits into ibctransfer module
gsk967 Nov 14, 2022
9bf0109
move the umme ibctransfer into ics20 folder
gsk967 Nov 14, 2022
a87ff0d
fix: fix the lint
gsk967 Nov 14, 2022
bdeaec3
refactor: change the module structure to 'authz' type of cosmos-sdk
gsk967 Nov 15, 2022
aba25e0
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 15, 2022
7981d0d
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 16, 2022
37b15b3
remove inflow_limit in rate limits
gsk967 Nov 16, 2022
ea1316e
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 16, 2022
ac8381c
Merge remote-tracking branch 'origin/sai/ibc-rate-limit' into sai/ibc…
gsk967 Nov 16, 2022
a8206d3
chore: check the rate limits by exchange rate
gsk967 Nov 17, 2022
990db76
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 17, 2022
49c2bbb
add denom exponent to calculate amount in USD
gsk967 Nov 17, 2022
b5435b1
calculating the sent amount with exponent of registerd token
gsk967 Nov 17, 2022
3143115
fix: fix the amount calculation
gsk967 Nov 17, 2022
db358cf
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 17, 2022
0b30201
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 19, 2022
bce7a99
Merge main
gsk967 Nov 22, 2022
30bbdfc
fix: fix the rate-limit reset issue
gsk967 Nov 22, 2022
c2d0bc5
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 23, 2022
01ce260
refactor: update the params
gsk967 Nov 23, 2022
223f094
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 24, 2022
7b55068
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 28, 2022
c4b7de8
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 29, 2022
b27ff0d
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 5, 2022
e75b6f9
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 23, 2022
90f82b5
fix: fix the build
gsk967 Dec 23, 2022
47f09be
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 27, 2022
ff6239a
chore: update the limits and quota interval
gsk967 Dec 27, 2022
ecacc9e
chore: fix the lint issues
gsk967 Dec 27, 2022
6968250
chore: fix the lint issues
gsk967 Dec 27, 2022
0e2ef16
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 27, 2022
eea2115
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 29, 2022
be02147
chore: addree the pr comments
gsk967 Dec 29, 2022
e9a8717
chore: remove the param subspace from uibc
gsk967 Dec 29, 2022
be8bc11
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 30, 2022
267e958
refactor: refactor the proto and logic
gsk967 Dec 30, 2022
1aeb647
chore: address the pr comments
gsk967 Dec 30, 2022
b952683
fix: fix the buf lint
gsk967 Dec 30, 2022
1b119c7
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 2, 2023
1db2900
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 10, 2023
aa1daea
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 11, 2023
c5bfd75
chore: get the exchange price from TokenValue of leverage
gsk967 Jan 11, 2023
860795b
Merge remote-tracking branch 'origin/sai/ibc-rate-limit' into sai/ibc…
gsk967 Jan 11, 2023
b28f8f4
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 11, 2023
e485b2a
chore: convert uToken to baseToken in ibc-transfer quota checking
gsk967 Jan 11, 2023
3ae43d4
chore: add typed events for emit events
gsk967 Jan 12, 2023
f1d1e54
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 12, 2023
64600ef
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 16, 2023
4da6298
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 16, 2023
85e7486
address the review comments
gsk967 Jan 16, 2023
16e6488
refactor the code
gsk967 Jan 17, 2023
db8e103
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 17, 2023
a3f01de
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 18, 2023
07d05c5
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 23, 2023
14cdcd3
address the pr comments
gsk967 Jan 23, 2023
1dee0e7
chore: fix the build issue
gsk967 Jan 23, 2023
8f052ec
chore: add tests for params
gsk967 Jan 23, 2023
0d71fd2
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 23, 2023
07fe9b4
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 24, 2023
8f1cbe9
fix: fix the update quota params
gsk967 Jan 24, 2023
14c2558
Merge remote-tracking branch 'origin/sai/ibc-rate-limit' into sai/ibc…
gsk967 Jan 24, 2023
a3c1e58
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 24, 2023
14badea
chore: address the pr comments
gsk967 Jan 24, 2023
78184a5
chore: fix the lint
gsk967 Jan 24, 2023
e7ca80f
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 27, 2023
6e8cde5
address the pr comments++
gsk967 Jan 27, 2023
d558dc9
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 30, 2023
b62b3db
address the pr comments
gsk967 Jan 30, 2023
9cc1660
Merge remote-tracking branch 'origin' into sai/ibc-rate-limit
gsk967 Jan 30, 2023
afcf52a
Merge remote-tracking branch 'origin/sai/ibc-rate-limit' into sai/ibc…
gsk967 Jan 30, 2023
16642e6
update reset quota
robert-zaremba Jan 30, 2023
f0ecf0a
move to Marshal to MustMarshal in uibc
gsk967 Jan 30, 2023
87d72ae
add TODO for ibc middleware acknowledgement
gsk967 Jan 30, 2023
8feec2a
add comment to outflow_sum
gsk967 Jan 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP: add cll tx,query cmds
1. add cli queries for rate_limits and params
2. add updateProposal for rate_limits and ibcPause status
  • Loading branch information
gsk967 committed Nov 9, 2022
commit aada85fe082e8e366c91cacaa35c026399704011
9 changes: 7 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ func New(

app.ibcRateLimitKeeper = ibcratelimitkeeper.NewKeeper(
appCodec,
keys[ibchost.StoreKey], app.GetSubspace(ibcratelimittypes.ModuleName),
keys[ibcratelimittypes.StoreKey], app.GetSubspace(ibcratelimittypes.ModuleName),
app.IBCKeeper.ChannelKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
Expand Down Expand Up @@ -643,6 +643,7 @@ func New(
leverage.NewAppModule(appCodec, app.LeverageKeeper, app.AccountKeeper, app.BankKeeper),
oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper),
bech32ibc.NewAppModule(appCodec, app.bech32IbcKeeper),
ibcratelimit.NewAppModule(appCodec, app.ibcRateLimitKeeper),
}
if Experimental {
appModules = append(appModules,
Expand All @@ -669,6 +670,7 @@ func New(
oracletypes.ModuleName,
gravitytypes.ModuleName,
bech32ibctypes.ModuleName,
ibcratelimittypes.ModuleName,
}
endBlockers := []string{
crisistypes.ModuleName,
Expand All @@ -684,6 +686,7 @@ func New(
leveragetypes.ModuleName,
gravitytypes.ModuleName,
bech32ibctypes.ModuleName,
ibcratelimittypes.ModuleName,
}

// NOTE: The genutils module must occur after staking so that pools are
Expand All @@ -704,6 +707,7 @@ func New(
leveragetypes.ModuleName,
gravitytypes.ModuleName,
bech32ibctypes.ModuleName,
ibcratelimittypes.ModuleName,
}
orderMigrations := []string{
capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName,
Expand All @@ -717,7 +721,7 @@ func New(
leveragetypes.ModuleName,
gravitytypes.ModuleName,
bech32ibctypes.ModuleName,
}
ibcratelimittypes.ModuleName}

if Experimental {
beginBlockers = append(beginBlockers, wasm.ModuleName)
Expand Down Expand Up @@ -1018,6 +1022,7 @@ func initParamsKeeper(
paramsKeeper.Subspace(ibchost.ModuleName)
// paramsKeeper.Subspace(icacontrollertypes.SubModuleName)
// paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(ibcratelimittypes.ModuleName)
paramsKeeper.Subspace(gravitytypes.ModuleName)
paramsKeeper.Subspace(leveragetypes.ModuleName)
paramsKeeper.Subspace(oracletypes.ModuleName)
Expand Down
30 changes: 22 additions & 8 deletions proto/umee/ibc_rate_limit/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ option (gogoproto.goproto_getters_all) = false;

// Query defines the gRPC querier service.
service Query {
// Params queries the parameters of the x/leverage module.
// Params queries the parameters of the x/ibc-rate-limit module.
rpc Params(QueryParams) returns (QueryParamsResponse) {
option (google.api.http).get = "/umee/ibc_rate_limit/v1/params";
}

// RateLimits
rpc RateLimits(QueryRateLimits) returns (QueryRateLimitsResponse) {
// RateLimitsOfIBCDenoms queries the rate limits of ibc denoms.
rpc RateLimitsOfIBCDenoms(QueryRateLimitsOfIBCDenoms) returns (QueryRateLimitsOfIBCDenomsResponse) {
option (google.api.http).get = "/umee/ibc_rate_limit/v1/rate_limits";
}

// RateLimitsOfIBCDenom queries the rate limits of ibc denom.
rpc RateLimitsOfIBCDenom(QueryRateLimitsOfIBCDenom) returns (QueryRateLimitsOfIBCDenomResponse) {
option (google.api.http).get = "/umee/ibc_rate_limit/v1/rate_limits/{ibc_denom}";
}
}

// QueryParams defines the request structure for the Params gRPC service
Expand All @@ -33,11 +38,20 @@ message QueryParamsResponse {
Params params = 1 [(gogoproto.nullable) = false];
}

// QueryRateLimits
message QueryRateLimits{}
// QueryRateLimitsOfIBCDenoms defines request type
message QueryRateLimitsOfIBCDenoms{}

// QueryRateLimitsResponse defines
message QueryRateLimitsResponse{
repeated RateLimit rate_limits = 1 [(gogoproto.nullable) = false];
// QueryRateLimitsOfIBCDenomsResponse defines response type
message QueryRateLimitsOfIBCDenomsResponse{
repeated RateLimit rate_limits = 1 [(gogoproto.nullable) = false];
}

// QueryRateLimitsOfIBCDenom defines request type
message QueryRateLimitsOfIBCDenom{
string ibc_denom = 1;
}

// QueryRateLimitsOfIBCDenomResponse defines response type of QueryRateLimitsOfIBCDenom
message QueryRateLimitsOfIBCDenomResponse{
RateLimit rate_limit = 1 [(gogoproto.nullable) = false];
}
22 changes: 20 additions & 2 deletions proto/umee/ibc_rate_limit/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ service Msg {
// UpdateIBCDenomsRateLimit adds new rate limits for ibc denoms or
// updates the rate limits for existed ibc denoms.
rpc UpdateIBCDenomsRateLimit(MsgUpdateIBCDenomsRateLimit) returns (MsgUpdateIBCDenomsRateLimitResponse);

// UpdateIBCTransferPauseStatus
rpc UpdateIBCTransferPauseStatus(MsgUpdateIBCTransferPauseStatus) returns (MsgUpdateIBCTransferPauseStatusResponse);
}

// MsgUpdateIBCDenomsRateLimit defines the Msg/UpdateIBCDenomsRateLimit request type.
message MsgUpdateIBCDenomsRateLimit {
// option (gogoproto.equal) = true;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;
option (cosmos.msg.v1.signer) = "authority";
Expand All @@ -36,5 +38,21 @@ message MsgUpdateIBCDenomsRateLimit {
repeated RateLimit update_ibc_denoms_rate_limits = 5 [(gogoproto.nullable) = false];
}

// MsgUpdateIBCDenomsRateLimitResponse defines the Msg/UpdateIBCDenomsRateLimit response type.
// MsgUpdateIBCDenomsRateLimitResponse defines response type for the Msg/UpdateIBCDenomsRateLimit
message MsgUpdateIBCDenomsRateLimitResponse {};

// MsgUpdateIBCTransferPauseStatus defines request type for UpdateIBCTransferStatus
message MsgUpdateIBCTransferPauseStatus {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;
option (cosmos.msg.v1.signer) = "authority";
// authority is the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string title = 2;
string description = 3;
// ibc_pause_status defines ibc transfer pause status
bool ibc_pause_status = 4;
}

// MsgUpdateIBCTransferPauseStatusResponse definesresponse type for Msg/MsgUpdateIBCTransferPauseStatus
message MsgUpdateIBCTransferPauseStatusResponse {}
60 changes: 58 additions & 2 deletions x/ibc-rate-limit/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import (
"fmt"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/umee-network/umee/v3/util/cli"
"github.com/umee-network/umee/v3/x/ibc-rate-limit/types"
)

// GetQueryCmd returns the CLI query commands for the x/ibc-rate-limit module.
func GetQueryCmd() *cobra.Command {
func GetQueryCmd(queryRoute string) *cobra.Command {
cmd := &cobra.Command{
Use: types.ModuleName,
Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName),
Expand All @@ -18,7 +20,61 @@ func GetQueryCmd() *cobra.Command {
RunE: client.ValidateCmd,
}

cmd.AddCommand()
cmd.AddCommand(
GetCmdQueryParams(),
GetRateLimitsForIBCDenoms(),
)

return cmd
}

// GetCmdQueryParams creates a Cobra command to query for the x/ibc-rate-limit
// module parameters.
func GetCmdQueryParams() *cobra.Command {
cmd := &cobra.Command{
Use: "params",
Args: cobra.NoArgs,
Short: "Query the x/ibc-rate-limit module parameters",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}

queryClient := types.NewQueryClient(clientCtx)
resp, err := queryClient.Params(cmd.Context(), &types.QueryParams{})
return cli.PrintOrErr(resp, err, clientCtx)
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}

// GetRateLimitsForIBCDenoms
func GetRateLimitsForIBCDenoms() *cobra.Command {
cmd := &cobra.Command{
Use: "rate-limits [ibc-denom]",
Args: cobra.MaximumNArgs(1),
Short: "Get the rate limits for ibc denoms",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}

queryClient := types.NewQueryClient(clientCtx)
if len(args) > 0 {
resp, err := queryClient.RateLimitsOfIBCDenom(cmd.Context(), &types.QueryRateLimitsOfIBCDenom{IbcDenom: args[0]})
return cli.PrintOrErr(resp, err, clientCtx)
}

resp, err := queryClient.RateLimitsOfIBCDenoms(cmd.Context(), &types.QueryRateLimitsOfIBCDenoms{})
return cli.PrintOrErr(resp, err, clientCtx)
},
}

flags.AddQueryFlagsToCmd(cmd)
return cmd
}
40 changes: 39 additions & 1 deletion x/ibc-rate-limit/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"fmt"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"
"github.com/umee-network/umee/v3/x/ibc-rate-limit/types"
)
Expand All @@ -18,7 +20,43 @@ func GetTxCmd() *cobra.Command {
RunE: client.ValidateCmd,
}

cmd.AddCommand()
cmd.AddCommand(
SampleTOkenRegistration(),
)

return cmd
}

func SampleTOkenRegistration() *cobra.Command {
cmd := &cobra.Command{
Use: "register",
Args: cobra.NoArgs,
Short: "Supply a specified amount of a supported asset",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
addRateLimits := []types.RateLimit{
{
IbcDenom: "sai",
OutflowLimit: 1234,
Window: 1000,
},
{
IbcDenom: "raj",
OutflowLimit: 1234,
Window: 1000,
},
}

msg := types.NewIbcDenomsRateLimits(clientCtx.FromAddress.String(), "title", "desc", addRateLimits, nil)

return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}

flags.AddTxFlagsToCmd(cmd)

return cmd
}
11 changes: 10 additions & 1 deletion x/ibc-rate-limit/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@ import (
// state.
func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) {
k.SetParams(ctx, genState.Params)
if err := k.SetRateLimitsOfIBCDenoms(ctx, genState.RateLimits); err != nil {
panic(err)
}
}

// ExportGenesis returns the x/leverage module's exported genesis state.
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
rateLimits, err := k.GetRateLimitsOfIBCDenoms(ctx)
if err != nil {
panic(err)
}

return &types.GenesisState{
Params: k.GetParams(ctx),
Params: k.GetParams(ctx),
RateLimits: rateLimits,
}
}
33 changes: 29 additions & 4 deletions x/ibc-rate-limit/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

var _ types.QueryServer = Querier{}

// Querier implements a QueryServer for the x/leverage module.
// Querier implements a QueryServer for the x/ibc-rate-limit module.
type Querier struct {
Keeper
}
Expand All @@ -32,7 +32,32 @@ func (q Querier) Params(goCtx context.Context, req *types.QueryParams) (*types.Q
return &types.QueryParamsResponse{Params: params}, nil
}

// RateLimits implements types.QueryServer
func (Querier) RateLimits(context.Context, *types.QueryRateLimits) (*types.QueryRateLimitsResponse, error) {
return &types.QueryRateLimitsResponse{}, nil
// RateLimitsOfIBCDenom implements types.QueryServer
func (q Querier) RateLimitsOfIBCDenom(goCtx context.Context, req *types.QueryRateLimitsOfIBCDenom) (*types.QueryRateLimitsOfIBCDenomResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}

ctx := sdk.UnwrapSDKContext(goCtx)
rateLimit, err := q.Keeper.GetRateLimitsOfIBCDenom(ctx, req.IbcDenom)
if err != nil {
return &types.QueryRateLimitsOfIBCDenomResponse{}, nil
}

return &types.QueryRateLimitsOfIBCDenomResponse{RateLimit: rateLimit}, nil
}

// RateLimitsOfIBCDenoms implements types.QueryServer
func (q Querier) RateLimitsOfIBCDenoms(goCtx context.Context, req *types.QueryRateLimitsOfIBCDenoms) (*types.QueryRateLimitsOfIBCDenomsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}

ctx := sdk.UnwrapSDKContext(goCtx)
rateLimits, err := q.Keeper.GetRateLimitsOfIBCDenoms(ctx)
if err != nil {
return &types.QueryRateLimitsOfIBCDenomsResponse{}, err
}

return &types.QueryRateLimitsOfIBCDenomsResponse{RateLimits: rateLimits}, nil
}
21 changes: 21 additions & 0 deletions x/ibc-rate-limit/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper
import (
"github.com/cosmos/cosmos-sdk/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/umee-network/umee/v3/x/ibc-rate-limit/types"
)
Expand All @@ -19,6 +20,11 @@ func NewKeeper(
cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramtypes.Subspace, ics4Wrapper types.ICS4Wrapper,
authority string,
) Keeper {
// set KeyTable if it has not already been set
if !paramSpace.HasKeyTable() {
paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable())
}

return Keeper{
cdc: cdc,
storeKey: key,
Expand All @@ -27,3 +33,18 @@ func NewKeeper(
authority: authority,
}
}

// UpdateIBCTansferStatus update the ibc pause status in module params.
func (k Keeper) UpdateIBCTansferStatus(ctx sdk.Context, ibcStatus bool) error {
var ibcPause bool
k.paramSpace.Get(ctx, types.KeyIBCPause, &ibcPause)

if ibcPause == ibcPause {
return types.ErrIBCPauseStatus
}

// update the ibc status
k.paramSpace.Set(ctx, types.KeyIBCPause, ibcStatus)

return nil
}
Loading