Skip to content

Commit

Permalink
Bubble up float approximation of minValueUsd
Browse files Browse the repository at this point in the history
  • Loading branch information
fedgiac committed Apr 16, 2024
1 parent 8b7fd63 commit def777c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/tasks/selfSell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ const setupSelfSellTask: () => void = () =>
tokens = await getTokensWithBalanceAbove({
chainId,
settlementContract: settlementDeployment.address,
minValueUsd: minValue,
minValueUsd: parseInt(minValue),
});
}
// Exclude the toToken if needed, as we can not sell it for itself (buyToken is not allowed to equal sellToken)
Expand Down
10 changes: 5 additions & 5 deletions src/tasks/withdraw/token_balances.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from "axios";

export interface GetTokensInput {
minValueUsd: string;
minValueUsd: number;
settlementContract: string;
chainId: number;
}
Expand Down Expand Up @@ -43,7 +43,7 @@ interface EthplorerAddressInfoResponse {
}

export async function getMainnetTokensWithBalanceAbove(
minValueUsd: string,
minValueUsd: number,
settlementContract: string,
): Promise<string[]> {
const response = await axios.get(
Expand All @@ -58,7 +58,7 @@ export async function getMainnetTokensWithBalanceAbove(
const tokenUsdValue =
token.tokenInfo.price.rate *
(token.balance / Math.pow(10, token.tokenInfo.decimals));
if (tokenUsdValue > parseInt(minValueUsd)) {
if (tokenUsdValue > minValueUsd) {
result.push(token.tokenInfo.address);
}
}
Expand All @@ -76,7 +76,7 @@ interface BlockscoutSingleTokenInfo {
}

export async function getGnosisChainTokensWithBalanceAbove(
minValueUsd: string,
minValueUsd: number,
settlementContract: string,
): Promise<string[]> {
const response = await axios.get(
Expand All @@ -91,7 +91,7 @@ export async function getGnosisChainTokensWithBalanceAbove(
const tokenUsdValue =
parseFloat(token.exchange_rate) *
(parseInt(value) / Math.pow(10, parseInt(token.decimals)));
if (tokenUsdValue > parseInt(minValueUsd)) {
if (tokenUsdValue > minValueUsd) {
result.push(token.address);
}
}
Expand Down

0 comments on commit def777c

Please sign in to comment.