Skip to content

Commit 68a42ea

Browse files
committed
fix the bug when the position requires gatewayBasisPoints
1 parent 6ce47bf commit 68a42ea

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/agent/positionsCreateWithAnyTokens.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,13 @@ export async function positionsCreateWithAnyTokens(
8787
: options.tokenAmount
8888
? await cont.getEstimatedDevForTokens(
8989
options.path,
90-
options.tokenAmount,
90+
typeof options.gatewayBasisPoints === 'number'
91+
? (
92+
(BigInt(options.tokenAmount) *
93+
BigInt(options.gatewayBasisPoints)) /
94+
BigInt('10000')
95+
).toString()
96+
: options.tokenAmount,
9197
)
9298
: 'Neither devAmountOut nor tokenAmount provided'
9399
const deadline = options.deadline

0 commit comments

Comments
 (0)