Skip to content

Commit ff4aa82

Browse files
committed
fix(x/escrow): use only funds that requested
during deposit authorization use only funds that remaining unset after deducting from owner balance Signed-off-by: Artur Troian <troian@users.noreply.github.com>
1 parent 0d3edd3 commit ff4aa82

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

x/escrow/keeper/keeper.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,11 @@ func (k *keeper) AuthorizeDeposits(sctx sdk.Context, msg sdk.Msg) ([]etypes.Depo
238238

239239
authorizedSpend = authorizedSpend.Sub(deplAuthz.SpendLimit)
240240

241+
// if authorized amount is bigger to what is remaining then just use remainder
242+
if remainder.LT(authorizedSpend.Amount) {
243+
authorizedSpend = sdk.NewCoin(authorizedSpend.Denom, remainder)
244+
}
245+
241246
depositors = append(depositors, etypes.Depositor{
242247
Owner: granter.String(),
243248
Height: sctx.BlockHeight(),

0 commit comments

Comments
 (0)