-
Notifications
You must be signed in to change notification settings - Fork 194
/
msg_server_resume_host_zone.go
40 lines (31 loc) · 1.09 KB
/
msg_server_resume_host_zone.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
package keeper
import (
"context"
"fmt"
"github.com/Stride-Labs/stride/v18/x/stakeibc/types"
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
)
func (k msgServer) ResumeHostZone(goCtx context.Context, msg *types.MsgResumeHostZone) (*types.MsgResumeHostZoneResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
// Get Host Zone
hostZone, found := k.GetHostZone(ctx, msg.ChainId)
if !found {
errMsg := fmt.Sprintf("invalid chain id, zone for %s not found", msg.ChainId)
k.Logger(ctx).Error(errMsg)
return nil, errorsmod.Wrapf(types.ErrHostZoneNotFound, errMsg)
}
// Check the zone is halted
if !hostZone.Halted {
errMsg := fmt.Sprintf("invalid chain id, zone for %s not halted", msg.ChainId)
k.Logger(ctx).Error(errMsg)
return nil, errorsmod.Wrapf(types.ErrHostZoneNotHalted, errMsg)
}
// remove from blacklist
stDenom := types.StAssetDenomFromHostZoneDenom(hostZone.HostDenom)
k.RatelimitKeeper.RemoveDenomFromBlacklist(ctx, stDenom)
// Resume zone
hostZone.Halted = false
k.SetHostZone(ctx, hostZone)
return &types.MsgResumeHostZoneResponse{}, nil
}