Skip to content

Commit

Permalink
Remove 1inch token list (#81)
Browse files Browse the repository at this point in the history
The 1inch token list is used to decrease the number of network requests
when fetching token information from the node.
The related API has been broken since a long time, so there is no actual
efficiency gain from using this list.
The [updated version of their token
API](https://portal.1inch.dev/documentation/tokens/quick-start) requires
an API key, which is by far not worth it for this use case.

Pruning this code also removes the very annoying warning "unable to
recover token list from 1inch" that is shown on every invocation of a
Hardhat command, since the list is prefetched to make execution faster.

### Test Plan

Code compiles.
  • Loading branch information
fedgiac authored Mar 26, 2024
1 parent 5cb4180 commit 350dcb5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 41 deletions.
3 changes: 1 addition & 2 deletions src/tasks/selfSell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import {
SupportedNetwork,
} from "./ts/deployment";
import { createGasEstimator, IGasEstimator } from "./ts/gas";
import { fastTokenDetails } from "./ts/oneinch_tokens";
import {
DisappearingLogFunctions,
promiseAllWithRateLimit,
Expand Down Expand Up @@ -296,7 +295,7 @@ async function getOrders({
const computeOrderInstructions = tokens.map(
(tokenAddress) =>
async ({ consoleLog }: DisappearingLogFunctions) => {
const sellToken = await fastTokenDetails(tokenAddress, hre);
const sellToken = await erc20Token(tokenAddress, hre);
if (sellToken === null) {
throw new Error(
`There is no valid ERC20 token at address ${tokenAddress}`,
Expand Down
36 changes: 0 additions & 36 deletions src/tasks/ts/oneinch_tokens.ts

This file was deleted.

5 changes: 2 additions & 3 deletions src/tasks/withdraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ import {
SupportedNetwork,
} from "./ts/deployment";
import { createGasEstimator, IGasEstimator } from "./ts/gas";
import { fastTokenDetails } from "./ts/oneinch_tokens";
import {
DisappearingLogFunctions,
promiseAllWithRateLimit,
} from "./ts/rate_limits";
import { getSolvers } from "./ts/solver";
import { Align, displayTable } from "./ts/table";
import { Erc20Token } from "./ts/tokens";
import { erc20Token, Erc20Token } from "./ts/tokens";
import {
formatTokenValue,
formatUsdValue,
Expand Down Expand Up @@ -246,7 +245,7 @@ async function getWithdrawals({
const computeWithdrawalInstructions = tokens.map(
(tokenAddress) =>
async ({ consoleLog }: DisappearingLogFunctions) => {
const token = await fastTokenDetails(tokenAddress, hre);
const token = await erc20Token(tokenAddress, hre);
if (token === null) {
throw new Error(
`There is no valid ERC20 token at address ${tokenAddress}`,
Expand Down

0 comments on commit 350dcb5

Please sign in to comment.