Skip to content

Commit

Permalink
fix: 🩹 bebop: nil check SwapLimits (#547)
Browse files Browse the repository at this point in the history
Signed-off-by: thanhpp <[email protected]>
  • Loading branch information
thanhpp authored Oct 17, 2024
1 parent 1563b3c commit 5473e68
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/liquidity-source/bebop/pool_simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func NewPoolSimulator(entityPool entity.Pool) (*PoolSimulator, error) {
}

func (p *PoolSimulator) CalcAmountOut(params pool.CalcAmountOutParams) (*pool.CalcAmountOutResult, error) {
if params.Limit.GetLimit("") != nil {
if params.Limit != nil && params.Limit.GetLimit("") != nil {
return nil, pool.ErrNotEnoughInventory
}

Expand Down Expand Up @@ -131,6 +131,10 @@ func (p *PoolSimulator) UpdateBalance(params pool.UpdateBalanceParams) {
// to handle the "top levels of orderbook" issue
// the swapLimit will be updated to 0, to limit using bebopRFQ once each route
// ref:https://team-kyber.slack.com/archives/C061UNZDUVC/p1728974288547259
if params.SwapLimit == nil {
return
}

_, _, _ = params.SwapLimit.UpdateLimit(
"", "",
nil, nil,
Expand Down

0 comments on commit 5473e68

Please sign in to comment.