From 5473e68f1439131395b8bb676cb3566e06798b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Phan=20Ph=C3=BA=20Th=C3=A0nh?= Date: Thu, 17 Oct 2024 10:54:15 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=A9=B9=20bebop:=20nil=20check=20Sw?= =?UTF-8?q?apLimits=20(#547)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: thanhpp --- pkg/liquidity-source/bebop/pool_simulator.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/liquidity-source/bebop/pool_simulator.go b/pkg/liquidity-source/bebop/pool_simulator.go index 2996a63cc..71f4f3e39 100644 --- a/pkg/liquidity-source/bebop/pool_simulator.go +++ b/pkg/liquidity-source/bebop/pool_simulator.go @@ -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 } @@ -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,