Skip to content

Commit

Permalink
Merge pull request #249 from scorpioborn/fix/withdraw-liquidity-removal
Browse files Browse the repository at this point in the history
Fix / Current round liquidity check
  • Loading branch information
3eyedraga authored Sep 7, 2023
2 parents c24a91b + 4a00c96 commit b68bb02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion x/orderbook/keeper/exposure_odds.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (k Keeper) removeNotWithdrawableFromFulfillmentQueue(
ctx sdk.Context,
bp types.OrderBookParticipation,
) error {
if !bp.IsWithdrawable() {
if !bp.IsLiquidityInCurrentRound() {
boes, err := k.GetOddsExposuresByOrderBook(ctx, bp.OrderBookUID)
if err != nil {
return err
Expand Down
7 changes: 3 additions & 4 deletions x/orderbook/types/participation.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ func (p *OrderBookParticipation) maxWithdrawalAmount() sdkmath.Int {
return p.CurrentRoundLiquidity.Sub(p.CurrentRoundMaxLoss)
}

// IsWithdrawable determines if the participation has enough funds in
// current round to be able to withdraw.
func (p *OrderBookParticipation) IsWithdrawable() bool {
return p.maxWithdrawalAmount().GT(sdk.ZeroInt())
// IsLiquidityInCurrentRound determines if the participation has liquidity in current round.
func (p *OrderBookParticipation) IsLiquidityInCurrentRound() bool {
return p.CurrentRoundLiquidity.GT(sdk.ZeroInt())
}

// WithdrawableAmount returns the withdrawal amount according to the withdrawal mode and max withdrawable amount.
Expand Down

0 comments on commit b68bb02

Please sign in to comment.