@@ -71,7 +71,7 @@ export async function positionsCreateWithAnyTokens(
7171 ? await cont . getEstimatedDevForTokens (
7272 options . path ,
7373 options . tokenAmount ,
74- )
74+ )
7575 : 'No tokenAmount provided' ,
7676 estimatedTokens : options . devAmount
7777 ? await cont . getEstimatedTokensForDev ( options . path , options . devAmount )
@@ -80,36 +80,19 @@ export async function positionsCreateWithAnyTokens(
8080 const tokenAmount = options . tokenAmount
8181 ? options . tokenAmount
8282 : options . devAmount
83- ? await cont . getEstimatedTokensForDev (
84- options . path ,
85- options . devAmount ,
86- )
87- : 'Neither tokenAmount nor devAmount provided'
83+ ? await cont . getEstimatedTokensForDev (
84+ options . path ,
85+ options . devAmount ,
86+ )
87+ : 'Neither tokenAmount nor devAmount provided'
8888 const _overrides = {
8989 overrides : {
9090 ...{ value : useERC20 ? undefined : tokenAmount } ,
9191 ...options . overrides ?. overrides ,
9292 } ,
9393 }
9494
95- const devAmountOut = options . devAmountOut
96- ? options . devAmountOut
97- : options . tokenAmount
98- ? await cont . getEstimatedDevForTokens (
99- options . path ,
100- typeof options . gatewayBasisPoints === 'number'
101- ? new BigNumber ( options . tokenAmount )
102- . times (
103- new BigNumber ( 10000 )
104- . minus ( options . gatewayBasisPoints )
105- . div ( 10000 ) ,
106- )
107- . times ( 0.8 ) // x0.8 = Hardcoded tolerance for quote and transaction differences
108- . dp ( 0 )
109- . toFixed ( )
110- : options . tokenAmount ,
111- )
112- : 'Neither devAmountOut nor tokenAmount provided'
95+ const devAmountOut = options . devAmountOut ? options . devAmountOut : '0'
11396 const deadline = options . deadline
11497 ? options . deadline
11598 : ( ( await options . provider . provider ?. getBlock ( 'latest' ) )
@@ -138,7 +121,7 @@ export async function positionsCreateWithAnyTokens(
138121 options . gatewayAddress ,
139122 options . gatewayBasisPoints . toString ( ) ,
140123 _overrides ,
141- )
124+ )
142125 : cont . swapTokensAndStakeDev (
143126 options . mintTo ,
144127 options . path ,
@@ -151,10 +134,10 @@ export async function positionsCreateWithAnyTokens(
151134 undefined ,
152135 undefined ,
153136 _overrides ,
154- )
137+ )
155138 } ,
156139 } )
157- } )
140+ } )
158141 : ( {
159142 approvalNeeded : false ,
160143 approveIfNeeded : async (
@@ -181,7 +164,7 @@ export async function positionsCreateWithAnyTokens(
181164 options . gatewayAddress ,
182165 options . gatewayBasisPoints . toString ( ) ,
183166 _overrides ,
184- )
167+ )
185168 : cont . swapTokensAndStakeDev (
186169 options . mintTo ,
187170 options . path ,
@@ -194,11 +177,11 @@ export async function positionsCreateWithAnyTokens(
194177 undefined ,
195178 undefined ,
196179 _overrides ,
197- ) ,
180+ ) ,
198181 } ) ,
199182 } ) ,
200- } as ApproveIfNeededResultForApproveIsNotNeeded )
183+ } as ApproveIfNeededResultForApproveIsNotNeeded )
201184 } ,
202- }
185+ }
203186 : undefined
204187}
0 commit comments