mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-22 21:59:44 +03:00
fix exchangeToNativeDecimal function
This commit is contained in:
@@ -99,5 +99,5 @@ export async function toNativeDecimals(token: AddressLike, amount: BigNumberish,
|
|||||||
const contract = ERC20__factory.connect(token, provider)
|
const contract = ERC20__factory.connect(token, provider)
|
||||||
decimals = BigInt(await contract.decimals())
|
decimals = BigInt(await contract.decimals())
|
||||||
}
|
}
|
||||||
return BigInt(amount) * (BigInt(10) ** decimals) / (BigInt(10) ** 8n)
|
return BigInt(amount) * (BigInt(10) ** decimals)
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ export async function generateSwapCalldataWithUnit({
|
|||||||
amount,
|
amount,
|
||||||
minReturnAmount,
|
minReturnAmount,
|
||||||
receiverAddress,
|
receiverAddress,
|
||||||
useContractBalance: walletBalance < BigInt(amount),
|
useContractBalance: walletBalance < await exchangeToNativeDecimals(path.first().assetIn, amount, unit.provider),
|
||||||
path,
|
path,
|
||||||
wethAddress,
|
wethAddress,
|
||||||
curveRegistryAddress,
|
curveRegistryAddress,
|
||||||
|
|||||||
Reference in New Issue
Block a user