mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +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)
|
||||
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,
|
||||
minReturnAmount,
|
||||
receiverAddress,
|
||||
useContractBalance: walletBalance < BigInt(amount),
|
||||
useContractBalance: walletBalance < await exchangeToNativeDecimals(path.first().assetIn, amount, unit.provider),
|
||||
path,
|
||||
wethAddress,
|
||||
curveRegistryAddress,
|
||||
|
||||
Reference in New Issue
Block a user