From 1af36a83ca28a35a6c45e4d32517fb27abef66c7 Mon Sep 17 00:00:00 2001 From: Steam Deck User <0xlomonoshka@gmail.com> Date: Wed, 13 Dec 2023 19:15:50 +0400 Subject: [PATCH] fix don't check allowance when token is native --- package.json | 2 +- src/Unit/Exchange/generateSwapCalldata.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 033ae51..476e451 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.20.31", + "version": "0.20.32", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/Unit/Exchange/generateSwapCalldata.ts b/src/Unit/Exchange/generateSwapCalldata.ts index f5cacde..cefce17 100644 --- a/src/Unit/Exchange/generateSwapCalldata.ts +++ b/src/Unit/Exchange/generateSwapCalldata.ts @@ -357,7 +357,7 @@ async function shouldUseExchangeBalance( additionalTransferAmount = amount; } else { additionalTransferAmount = exchangeBalance >= amount ? 0n : amount - exchangeBalance; - if (additionalTransferAmount > exchangeAllowance) { + if (srcToken !== ZeroAddress && additionalTransferAmount > exchangeAllowance) { throw new Error( `Not enough allowance to make swap, allowance - ${exchangeAllowance} needed allowance - ${additionalTransferAmount}` );