From 64d2cbe5d6b1763616cc344f47252a8a356dd291 Mon Sep 17 00:00:00 2001 From: George Tsagkarelis Date: Wed, 14 Jun 2023 14:12:17 +0300 Subject: [PATCH] liquidity: respect feeppm if set for easyautoloop --- liquidity/liquidity.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/liquidity/liquidity.go b/liquidity/liquidity.go index 9efd526..97da8ad 100644 --- a/liquidity/liquidity.go +++ b/liquidity/liquidity.go @@ -600,11 +600,21 @@ func (m *Manager) dispatchBestEasyAutoloopSwap(ctx context.Context) error { return err } - // Override our current parameters in order to use the const percent - // limit of easy-autoloop. + // If no fee is set, override our current parameters in order to use the + // default percent limit of easy-autoloop. easyParams := m.params - easyParams.FeeLimit = &FeePortion{ - PartsPerMillion: defaultFeePPM, + + switch feeLimit := easyParams.FeeLimit.(type) { + case *FeePortion: + if feeLimit.PartsPerMillion == 0 { + feeLimit = &FeePortion{ + PartsPerMillion: defaultFeePPM, + } + } + default: + feeLimit = &FeePortion{ + PartsPerMillion: defaultFeePPM, + } } // Set the swap outgoing channel to the chosen channel.