Skip to content

Commit

Permalink
fix: current round liquidity check
Browse files Browse the repository at this point in the history
  • Loading branch information
scorpioborn committed Sep 7, 2023
1 parent 2110d3f commit 4a00c96
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 4a00c96

Please sign in to comment.