Skip to content

Commit 4c8b914

Browse files
authored
Merge pull request #694 from KiraCore/release/v0.4.2
release/v0.4.2 -> master
2 parents 1a5be2f + 1f78a88 commit 4c8b914

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jobs:
103103
echo -e "\`\`\`" >> ./bin/RELEASE.md
104104
tar -czvf deb.tar.gz -C ./bin .
105105
- name: Uploading artifacts
106-
uses: actions/upload-artifact@v3.0.0
106+
uses: actions/upload-artifact@v4.6.2
107107
with:
108108
name: sekai-bin-deb
109109
path: ./deb.tar.gz

types/constants.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ package types
33
const (
44
// we set page iteration limit for safety
55
PageIterationLimit = 512
6-
SekaiVersion = "v0.4.1"
6+
SekaiVersion = "v0.4.2"
77
CosmosVersion = "v0.47.6"
88
)

x/layer2/keeper/msg_server.go

+18-8
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,20 @@ func (k msgServer) BondDappProposal(goCtx context.Context, msg *types.MsgBondDap
8181
return nil, types.ErrInvalidDappBondDenom
8282
}
8383

84+
dapp.TotalBond = dapp.TotalBond.Add(msg.Bond)
85+
86+
properties := k.keeper.gk.GetNetworkProperties(ctx)
87+
if dapp.TotalBond.Amount.GT(sdk.NewInt(int64(properties.MaxDappBond)).Mul(sdk.NewInt(1000_000))) {
88+
return nil, types.ErrMaxDappBondReached
89+
}
90+
8491
// send initial bond to module account
8592
addr := sdk.MustAccAddressFromBech32(msg.Sender)
8693
err := k.keeper.bk.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, sdk.Coins{msg.Bond})
8794
if err != nil {
8895
return nil, err
8996
}
9097

91-
properties := k.keeper.gk.GetNetworkProperties(ctx)
92-
if dapp.TotalBond.Amount.GTE(sdk.NewInt(int64(properties.MaxDappBond)).Mul(sdk.NewInt(1000_000))) {
93-
return nil, types.ErrMaxDappBondReached
94-
}
95-
96-
dapp.TotalBond = dapp.TotalBond.Add(msg.Bond)
9798
k.keeper.SetDapp(ctx, dapp)
9899

99100
userDappBond := k.keeper.GetUserDappBond(ctx, msg.DappName, msg.Sender)
@@ -114,6 +115,11 @@ func (k msgServer) BondDappProposal(goCtx context.Context, msg *types.MsgBondDap
114115
func (k msgServer) ReclaimDappBondProposal(goCtx context.Context, msg *types.MsgReclaimDappBondProposal) (*types.MsgReclaimDappBondProposalResponse, error) {
115116
ctx := sdk.UnwrapSDKContext(goCtx)
116117

118+
dapp := k.keeper.GetDapp(ctx, msg.DappName)
119+
if dapp.Name == "" {
120+
return nil, types.ErrDappDoesNotExist
121+
}
122+
117123
userDappBond := k.keeper.GetUserDappBond(ctx, msg.DappName, msg.Sender)
118124
if userDappBond.DappName == "" {
119125
return nil, types.ErrUserDappBondDoesNotExist
@@ -125,8 +131,7 @@ func (k msgServer) ReclaimDappBondProposal(goCtx context.Context, msg *types.Msg
125131
return nil, types.ErrNotEnoughUserDappBond
126132
}
127133

128-
userDappBond.Bond.Amount = userDappBond.Bond.Amount.Sub(msg.Bond.Amount)
129-
k.keeper.SetUserDappBond(ctx, userDappBond)
134+
dapp.TotalBond = dapp.TotalBond.Sub(msg.Bond)
130135

131136
// send tokens back to user
132137
addr := sdk.MustAccAddressFromBech32(msg.Sender)
@@ -135,6 +140,11 @@ func (k msgServer) ReclaimDappBondProposal(goCtx context.Context, msg *types.Msg
135140
return nil, err
136141
}
137142

143+
k.keeper.SetDapp(ctx, dapp)
144+
145+
userDappBond.Bond.Amount = userDappBond.Bond.Amount.Sub(msg.Bond.Amount)
146+
k.keeper.SetUserDappBond(ctx, userDappBond)
147+
138148
return &types.MsgReclaimDappBondProposalResponse{}, nil
139149
}
140150

0 commit comments

Comments
 (0)