diff --git a/adapters/izumiswap/package.json b/adapters/izumiswap/package.json new file mode 100644 index 00000000..1783b197 --- /dev/null +++ b/adapters/izumiswap/package.json @@ -0,0 +1,32 @@ +{ + "name": "izumiswap", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node dist/index.js", + "compile": "tsc", + "watch": "tsc -w", + "clear": "rm -rf dist" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "@types/big.js": "^6.2.2", + "big.js": "^6.2.1", + "bignumber.js": "^9.1.2", + "csv-parser": "^3.0.0", + "decimal.js-light": "^2.5.1", + "fast-csv": "^5.0.1", + "jsbi": "^4.3.0", + "tiny-invariant": "^1.3.1", + "toformat": "^2.0.0", + "viem": "^2.8.13" + }, + "devDependencies": { + "@types/node": "^20.11.17", + "typescript": "^5.3.3" + } +} diff --git a/adapters/izumiswap/src/config/config.ts b/adapters/izumiswap/src/config/config.ts new file mode 100644 index 00000000..d76dc42c --- /dev/null +++ b/adapters/izumiswap/src/config/config.ts @@ -0,0 +1,30 @@ +export const enum CHAINS{ + MODE = 34443, + LINEA = 59144, +} +export const enum PROTOCOLS{ + SUPSWAP = 0, + IZISWAP = 1, +} + +export const enum AMM_TYPES{ + UNISWAPV3 = 0, + IZISWAP = 1 +} + +export const SUBGRAPH_URLS = { + [CHAINS.MODE]: { + [PROTOCOLS.IZISWAP]: { + [AMM_TYPES.IZISWAP]: "https://graph-node-api.izumi.finance/query/subgraphs/name/izi-swap-mode" + } + }, + [CHAINS.LINEA]: { + [PROTOCOLS.IZISWAP]: { + [AMM_TYPES.IZISWAP]: "https://api.studio.thegraph.com/query/24334/izumi-subgraph-linea/version/latest" + } + } +} +export const RPC_URLS = { + [CHAINS.MODE]: "https://rpc.goldsky.com", + [CHAINS.LINEA]: "https://rpc.linea.build", +} \ No newline at end of file diff --git a/adapters/izumiswap/src/index.ts b/adapters/izumiswap/src/index.ts new file mode 100644 index 00000000..e86bc0e8 --- /dev/null +++ b/adapters/izumiswap/src/index.ts @@ -0,0 +1,137 @@ +import BigNumber from "bignumber.js"; +import { CHAINS, PROTOCOLS, AMM_TYPES } from "./config/config"; +import { getLPValueByUserAndPoolFromPositions, getPositionAtBlock, getPositionDetailsFromPosition, getPositionsForAddressByPoolAtBlock, getTimestampAtBlock } from "./utils/subgraphDetails"; +(BigInt.prototype as any).toJSON = function () { + return this.toString(); +}; + +import { promisify } from 'util'; +import stream from 'stream'; +import csv from 'csv-parser'; +import fs from 'fs'; +import { format } from 'fast-csv'; +import { write } from 'fast-csv'; + +//Uncomment the following lines to test the getPositionAtBlock function + +// const position = getPositionAtBlock( +// 0, // block number 0 for latest block +// 2, // position id +// CHAINS.MODE, // chain id +// PROTOCOLS.SUPSWAP, // protocol +// AMM_TYPES.UNISWAPV3 // amm type +// ); +// position.then((position) => { +// // print response +// const result = getPositionDetailsFromPosition(position); +// console.log(`${JSON.stringify(result,null, 4)} +// `) +// }); + +interface BlockData { + blockNumber: number; + blockTimestamp: number; +} + +interface CSVRow { + block_number: number; + timestamp: number; + user_address: string; + token_address: string; + token_balance: string; + token_symbol: string; + usd_price: number; +} + +const pipeline = promisify(stream.pipeline); + +const readBlocksFromCSV = async (filePath: string): Promise => { + const blocks: number[] = []; + await pipeline( + fs.createReadStream(filePath), + csv(), + async function* (source) { + for await (const chunk of source) { + // Assuming each row in the CSV has a column 'block' with the block number + if (chunk.block) blocks.push(parseInt(chunk.block, 10)); + } + } + ); + return blocks; +}; + + +const getData = async () => { + const snapshotBlocks = [ + 3055683 + ]; //await readBlocksFromCSV('src/sdk/mode_chain_daily_blocks.csv'); + + const csvRows: CSVRow[] = []; + + for (let block of snapshotBlocks) { + const positions = await getPositionsForAddressByPoolAtBlock( + block, "", "", CHAINS.LINEA, PROTOCOLS.IZISWAP, AMM_TYPES.IZISWAP + ); + + console.log(`Block: ${block}`); + console.log("Positions: ", positions.length); + + const timestamp = await getTimestampAtBlock(block); + + // Assuming this part of the logic remains the same + let positionsWithUSDValue = positions.map(getPositionDetailsFromPosition); + let lpValueByUsers = getLPValueByUserAndPoolFromPositions(positionsWithUSDValue); + + lpValueByUsers.forEach((value, key) => { + value.forEach((tokenBalance, tokenKey) => { + // Accumulate CSV row data + csvRows.push({ + block_number: block, + timestamp: timestamp / 1000, + user_address: key, + token_address: tokenKey, + token_symbol: tokenBalance.tokenSymbol, + token_balance: tokenBalance.tokenBalance.toString(), + usd_price: tokenBalance.usdPrice, + }); + }); + }); + } + + // Write the CSV output to a file + const ws = fs.createWriteStream('outputData.csv'); + write(csvRows, { headers: true }).pipe(ws).on('finish', () => { + console.log("CSV file has been written."); + }); +}; + +export const getUserTVLByBlock = async (blocks: BlockData) => { + const { blockNumber, blockTimestamp } = blocks + const positions = await getPositionsForAddressByPoolAtBlock( + blockNumber, "", "", CHAINS.LINEA, PROTOCOLS.IZISWAP, AMM_TYPES.IZISWAP + ); + + let positionsWithUSDValue = positions.map(getPositionDetailsFromPosition); + let lpValueByUsers = getLPValueByUserAndPoolFromPositions(positionsWithUSDValue); + + const csvRows: CSVRow[] = []; + lpValueByUsers.forEach((value, key) => { + value.forEach((tokenBalance, tokenKey) => { + csvRows.push({ + block_number: blockNumber, + timestamp: blockTimestamp, + user_address: key, + token_address: tokenKey, + token_symbol: tokenBalance.tokenSymbol, + token_balance: tokenBalance.tokenBalance.toString(), + usd_price: tokenBalance.usdPrice, + }); + }); + }); + + return csvRows +}; + +getData().then(() => { + console.log("Done"); +}); \ No newline at end of file diff --git a/adapters/izumiswap/src/utils/positionMath.ts b/adapters/izumiswap/src/utils/positionMath.ts new file mode 100644 index 00000000..bb7052fe --- /dev/null +++ b/adapters/izumiswap/src/utils/positionMath.ts @@ -0,0 +1,143 @@ +import BigNumber from "bignumber.js"; + +export interface TokenInfoFormatted { + chainId: number; + name?: string; + symbol: string; + address: string; + decimal: number; +} +export interface Liquidity { + leftPoint: number; + rightPoint: number; + liquidity: string; + decimalX: number; + decimalY: number; +} + +export const point2PoolPriceUndecimalSqrt = (point: number) : number => { + return (1.0001 ** point) ** 0.5; +} + +export const _getAmountY = ( + liquidity: BigNumber, + sqrtPriceL: number, + sqrtPriceR: number, + sqrtRate: number, + upper: boolean, +): BigNumber => { + const numerator = sqrtPriceR - sqrtPriceL; + const denominator = sqrtRate - 1; + if (!upper) { + const amount = new BigNumber(liquidity.times(numerator).div(denominator).toFixed(0, 3)); + return amount; + } else { + const amount = new BigNumber(liquidity.times(numerator).div(denominator).toFixed(0, 2)); + return amount; + } +} + +export const _getAmountX = ( + liquidity: BigNumber, + leftPt: number, + rightPt: number, + sqrtPriceR: number, + sqrtRate: number, + upper: boolean, +): BigNumber => { + const sqrtPricePrPc = Math.pow(sqrtRate, rightPt - leftPt + 1); + const sqrtPricePrPd = Math.pow(sqrtRate, rightPt + 1); + + const numerator = sqrtPricePrPc - sqrtRate; + const denominator = sqrtPricePrPd - sqrtPriceR; + + if (!upper) { + const amount = new BigNumber(liquidity.times(numerator).div(denominator).toFixed(0, 3)); + return amount; + } else { + const amount = new BigNumber(liquidity.times(numerator).div(denominator).toFixed(0, 2)); + return amount; + } +} + +export const _liquidity2AmountYAtPoint = ( + liquidity: BigNumber, + sqrtPrice: number, + upper: boolean +): BigNumber => { + const amountY = liquidity.times(sqrtPrice); + if (!upper) { + return new BigNumber(amountY.toFixed(0, 3)); + } else { + return new BigNumber(amountY.toFixed(0, 2)); + } +} + +export const _liquidity2AmountXAtPoint = ( + liquidity: BigNumber, + sqrtPrice: number, + upper: boolean +): BigNumber => { + const amountX = liquidity.div(sqrtPrice); + if (!upper) { + return new BigNumber(amountX.toFixed(0, 3)); + } else { + return new BigNumber(amountX.toFixed(0, 2)); + } +} + +export const amount2Decimal = (amount: BigNumber, decimal: number): number => { + return Number(amount.div(10 ** decimal)) +} + +export const getLiquidityValue = ( + liquidity: Liquidity, + currentPoint: number +): {amountXDecimal: number, amountYDecimal: number, amountX: BigNumber, amountY: BigNumber} => { + + let amountX = new BigNumber(0); + let amountY = new BigNumber(0); + const liquid = liquidity.liquidity; + const sqrtRate = Math.sqrt(1.0001); + const leftPtNum = Number(liquidity.leftPoint); + const rightPtNum = Number(liquidity.rightPoint); + // compute amountY without currentPt + if (leftPtNum < currentPoint) { + const rightPt: number = Math.min(currentPoint, rightPtNum); + const sqrtPriceR = point2PoolPriceUndecimalSqrt(rightPt); + const sqrtPriceL = point2PoolPriceUndecimalSqrt(leftPtNum); + amountY = _getAmountY(new BigNumber(liquid), sqrtPriceL, sqrtPriceR, sqrtRate, false); + } + + // compute amountX without currentPt + if (rightPtNum > currentPoint + 1) { + const leftPt: number = Math.max(currentPoint + 1, leftPtNum); + const sqrtPriceR = point2PoolPriceUndecimalSqrt(rightPtNum); + amountX = _getAmountX(new BigNumber(liquid), leftPt, rightPtNum, sqrtPriceR, sqrtRate, false); + } + + // compute amountX and amountY on currentPt + if (leftPtNum <= currentPoint && rightPtNum > currentPoint) { + const liquidityValue = new BigNumber(liquidity.liquidity); + const maxLiquidityYAtCurrentPt = new BigNumber(0); + const liquidityYAtCurrentPt = liquidityValue.gt(maxLiquidityYAtCurrentPt) ? maxLiquidityYAtCurrentPt : liquidityValue; + const liquidityXAtCurrentPt = liquidityValue.minus(liquidityYAtCurrentPt); + const currentSqrtPrice = point2PoolPriceUndecimalSqrt(currentPoint); + amountX = amountX.plus(_liquidity2AmountXAtPoint(liquidityXAtCurrentPt, currentSqrtPrice, false)); + amountY = amountY.plus(_liquidity2AmountYAtPoint(liquidityYAtCurrentPt, currentSqrtPrice, false)); + } + const amountXDecimal:number = amount2Decimal( + amountX, liquidity.decimalX + )?? 0; + const amountYDecimal:number = amount2Decimal( + amountY, liquidity.decimalY + )?? 0; + return { + amountX, amountXDecimal, + amountY, amountYDecimal + }; +} + +export const PositionMath = { + getLiquidityValue +} diff --git a/adapters/izumiswap/src/utils/subgraphDetails.ts b/adapters/izumiswap/src/utils/subgraphDetails.ts new file mode 100644 index 00000000..1ada3e6d --- /dev/null +++ b/adapters/izumiswap/src/utils/subgraphDetails.ts @@ -0,0 +1,310 @@ +import BigNumber from "bignumber.js"; +import { AMM_TYPES, CHAINS, PROTOCOLS, RPC_URLS, SUBGRAPH_URLS } from "../config/config"; +import { PositionMath } from "./positionMath"; +import { createPublicClient, extractChain, http } from "viem"; +import { linea } from "viem/chains"; + +export interface Position{ + id: string; + liquidity: string; + owner: string; + pool: { + tick: number; + id: string; + }; + leftPt: number; + rightPt: number; + tokenX: { + id: string; + decimals: number; + priceUSD: number; + name: string; + symbol: string; + }; + tokenY: { + id: string; + decimals: number; + priceUSD: number; + name: string; + symbol: string; + } +}; + + +export interface PositionWithUSDValue extends Position{ + token0USDValue: string; + token1USDValue: string; + token0AmountsInWei: bigint; + token1AmountsInWei: bigint; + token0DecimalValue: number; + token1DecimalValue: number; +} + +export interface UserTokenBalanceInfo { + tokenBalance: BigNumber; + tokenSymbol: string; + usdPrice: number; +} + +export const getPositionsForAddressByPoolAtBlock = async ( + blockNumber: number, + address: string, + poolId: string, + chainId: CHAINS, + protocol: PROTOCOLS, + ammType: AMM_TYPES +): Promise => { + let subgraphUrl = (SUBGRAPH_URLS as any)[chainId][protocol][ammType]; + let blockQuery = blockNumber !== 0 ? ` block: {number: ${blockNumber}}` : ``; + let poolQuery = poolId !== "" ? ` pool_:{id: "${poolId.toLowerCase()}"}` : ``; + let ownerQuery = address !== "" ? `owner: "${address.toLowerCase()}"` : ``; + + let whereQuery = ownerQuery !== "" && poolQuery !== "" ? `where: {${ownerQuery} , ${poolQuery}}` : ownerQuery !== "" ?`where: {${ownerQuery}}`: poolQuery !== "" ? `where: {${poolQuery}}`: ``; + let lastTimestamp = 0; + let fetchNext = true; + let result: Position[] = []; + while(fetchNext){ + let query = `{ + liquidities(${whereQuery} ${blockQuery} orderBy: transaction__timestamp, first:1000, where:{transaction_:{timestamp_gt:${lastTimestamp}}}) { + id + + liquidity + owner + pool { + tick + id + } + leftPt + rightPt + tokenX { + id + decimals + priceUSD + name + symbol + } + tokenY { + id + decimals + priceUSD + name + symbol + } + transaction{ + timestamp + } + }, + _meta{ + block{ + number + } + } + }`; + + // console.log(query) + + let response = await fetch(subgraphUrl, { + method: "POST", + body: JSON.stringify({ query }), + headers: { "Content-Type": "application/json" }, + }); + let data = await response.json(); + let positions = data.data.liquidities; + for (let i = 0; i < positions.length; i++) { + let position = positions[i]; + let transformedPosition: Position = { + id: position.id, + liquidity: position.liquidity, + owner: position.owner, + pool: { + tick: Number(position.pool.tick), + id: position.pool.id, + }, + leftPt: position.leftPt, + rightPt: position.rightPt, + tokenX: { + id: position.tokenX.id, + decimals: position.tokenX.decimals, + priceUSD: position.tokenX.priceUSD, + name: position.tokenX.name, + symbol: position.tokenX.symbol, + }, + tokenY: { + id: position.tokenY.id, + decimals: position.tokenY.decimals, + priceUSD: position.tokenY.priceUSD, + name: position.tokenY.name, + symbol: position.tokenY.symbol, + }, + }; + result.push(transformedPosition); + lastTimestamp = position.transaction.timestamp + + } + if(positions.length < 1000){ + fetchNext = false; + } + } + return result; +} + + +export const getPositionAtBlock = async ( + blockNumber: number, + positionId: number, + chainId: CHAINS, + protocol: PROTOCOLS, + ammType: AMM_TYPES +): Promise => { + let subgraphUrl = (SUBGRAPH_URLS as any)[chainId][protocol][ammType]; + let blockQuery = blockNumber !== 0 ? `, block: {number: ${blockNumber}}` : ``; + let query = `{ + position(id: "${positionId}" ${blockQuery}) { + id + pool { + id + tick + } + leftPt + rightPt + } + liquidity + tokenX { + id + decimals + priceUSD + name + symbol + } + tokenY { + id + decimals + priceUSD + name + symbol + } + }, + _meta{ + block{ + number + } + } + }`; + let response = await fetch(subgraphUrl, { + method: "POST", + body: JSON.stringify({ query }), + headers: { "Content-Type": "application/json" }, + }); + let data = await response.json(); + let position = data.data.position; + + + return { + id: position.id, + liquidity: position.liquidity, + owner: position.owner, + pool: { + tick: Number(position.pool.tick), + id: position.pool.id, + }, + leftPt: position.leftPt, + rightPt: position.rightPt, + tokenX: { + id: position.tokenX.id, + decimals: position.tokenX.decimals, + priceUSD: position.tokenX.priceUSD, + name: position.tokenX.name, + symbol: position.tokenX.symbol, + }, + tokenY: { + id: position.tokenY.id, + decimals: position.tokenY.decimals, + priceUSD: position.tokenY.derivedUSD, + name: position.tokenY.name, + symbol: position.tokenY.symbol, + }, + }; + +} + +export const getPositionDetailsFromPosition = ( + position: Position +):PositionWithUSDValue => { + let leftPoint = position.leftPt; + let rightPoint = position.rightPt; + let liquidity = position.liquidity; + let tick = Number(position.pool.tick); + let decimalX = position.tokenX.decimals; + let decimalY = position.tokenY.decimals; + let tokenXDerivedUSD = position.tokenX.priceUSD; + let tokenYDerivedUSD = position.tokenY.priceUSD; + // let token0AmountsInWei = PositionMath.getToken0Amount(tick, tickLow, tickHigh, sqrtPriceX96, liquidity); + // let token1AmountsInWei = PositionMath.getToken1Amount(tick, tickLow, tickHigh, sqrtPriceX96, liquidity); + + let amountResult = PositionMath.getLiquidityValue({liquidity, leftPoint, rightPoint, decimalX, decimalY}, tick) + + let token0AmountsInWei = BigInt(amountResult.amountX.toFixed()) + let token1AmountsInWei = BigInt(amountResult.amountY.toFixed()) + + let token0DecimalValue = amountResult.amountXDecimal; + let token1DecimalValue = amountResult.amountYDecimal; + + let token0UsdValue = new BigNumber(token0DecimalValue.toString()).multipliedBy(tokenXDerivedUSD).toFixed(4); + let token1UsdValue = new BigNumber(token1DecimalValue.toString()).multipliedBy(tokenYDerivedUSD).toFixed(4); + + return {...position, token0USDValue: token0UsdValue, token1USDValue: token1UsdValue, token0AmountsInWei, token1AmountsInWei, token0DecimalValue, token1DecimalValue}; + +} + +export const getLPValueByUserAndPoolFromPositions = ( + positions: Position[] +): Map> => { + let result = new Map>(); + for (let i = 0; i < positions.length; i++) { + let position = positions[i]; + + let positionWithUSDValue = getPositionDetailsFromPosition(position); + if (positionWithUSDValue.token0DecimalValue == 0 || positionWithUSDValue.token1DecimalValue == 0){ + continue + } + + let tokenXAddress = position.tokenX.id; + let tokenYAddress = position.tokenY.id; + let owner = position.owner; + if (owner == '0x0000000000000000000000000000000000000000') continue; + let userPositions = result.get(owner); + if (userPositions === undefined) { + userPositions = new Map(); + result.set(owner, userPositions); + } + + let tokenXAmount = userPositions.get(tokenXAddress); + if (tokenXAmount === undefined) { + tokenXAmount = {tokenBalance: new BigNumber(0), tokenSymbol: position.tokenX.symbol, usdPrice: 0}; + } + + let tokenYAmount = userPositions.get(tokenYAddress); + if (tokenYAmount === undefined) { + tokenYAmount = {tokenBalance: new BigNumber(0), tokenSymbol: position.tokenY.symbol, usdPrice: 0}; + } + + tokenXAmount.tokenBalance = tokenXAmount.tokenBalance.plus(new BigNumber(positionWithUSDValue.token0DecimalValue)); + tokenYAmount.tokenBalance = tokenYAmount.tokenBalance.plus(new BigNumber(positionWithUSDValue.token1DecimalValue)); + + userPositions.set(tokenXAddress, tokenXAmount); + userPositions.set(tokenYAddress, tokenYAmount); + } + return result; +} + +export const getTimestampAtBlock = async (blockNumber: number) => { + const publicClient = createPublicClient({ + chain: extractChain({ chains: [linea], id: CHAINS.LINEA }), + transport: http(RPC_URLS[CHAINS.LINEA]), + }); + + const block = await publicClient.getBlock({ + blockNumber: BigInt(blockNumber), + }); + return Number(block.timestamp * 1000n); +}; \ No newline at end of file diff --git a/adapters/izumiswap/tsconfig.json b/adapters/izumiswap/tsconfig.json new file mode 100644 index 00000000..a1736e1c --- /dev/null +++ b/adapters/izumiswap/tsconfig.json @@ -0,0 +1,109 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + "rootDir": "src/", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "dist/", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/adapters/izumiswap/yarn.lock b/adapters/izumiswap/yarn.lock new file mode 100644 index 00000000..9a16cd7d --- /dev/null +++ b/adapters/izumiswap/yarn.lock @@ -0,0 +1,211 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@adraffy/ens-normalize@1.10.0": + version "1.10.0" + resolved "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz#d2a39395c587e092d77cbbc80acf956a54f38bf7" + integrity sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q== + +"@fast-csv/format@5.0.0": + version "5.0.0" + resolved "https://registry.npmjs.org/@fast-csv/format/-/format-5.0.0.tgz#f2e557fdd4370360b418cc78636684c07b12d0ba" + integrity sha512-IyMpHwYIOGa2f0BJi6Wk55UF0oBA5urdIydoEDYxPo88LFbeb3Yr4rgpu98OAO1glUWheSnNtUgS80LE+/dqmw== + dependencies: + lodash.escaperegexp "^4.1.2" + lodash.isboolean "^3.0.3" + lodash.isequal "^4.5.0" + lodash.isfunction "^3.0.9" + lodash.isnil "^4.0.0" + +"@fast-csv/parse@5.0.0": + version "5.0.0" + resolved "https://registry.npmjs.org/@fast-csv/parse/-/parse-5.0.0.tgz#091665753f9e58f0dda6a55ae30f582526042903" + integrity sha512-ecF8tCm3jVxeRjEB6VPzmA+1wGaJ5JgaUX2uesOXdXD6qQp0B3EdshOIed4yT1Xlj/F2f8v4zHSo0Oi31L697g== + dependencies: + lodash.escaperegexp "^4.1.2" + lodash.groupby "^4.6.0" + lodash.isfunction "^3.0.9" + lodash.isnil "^4.0.0" + lodash.isundefined "^3.0.1" + lodash.uniq "^4.5.0" + +"@noble/curves@1.2.0", "@noble/curves@~1.2.0": + version "1.2.0" + resolved "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== + dependencies: + "@noble/hashes" "1.3.2" + +"@noble/hashes@1.3.2": + version "1.3.2" + resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== + +"@noble/hashes@~1.3.0", "@noble/hashes@~1.3.2": + version "1.3.3" + resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz#39908da56a4adc270147bb07968bf3b16cfe1699" + integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA== + +"@scure/base@~1.1.0", "@scure/base@~1.1.2": + version "1.1.6" + resolved "https://registry.npmjs.org/@scure/base/-/base-1.1.6.tgz#8ce5d304b436e4c84f896e0550c83e4d88cb917d" + integrity sha512-ok9AWwhcgYuGG3Zfhyqg+zwl+Wn5uE+dwC0NV/2qQkx4dABbb/bx96vWu8NSj+BNjjSjno+JRYRjle1jV08k3g== + +"@scure/bip32@1.3.2": + version "1.3.2" + resolved "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.2.tgz#90e78c027d5e30f0b22c1f8d50ff12f3fb7559f8" + integrity sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA== + dependencies: + "@noble/curves" "~1.2.0" + "@noble/hashes" "~1.3.2" + "@scure/base" "~1.1.2" + +"@scure/bip39@1.2.1": + version "1.2.1" + resolved "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz#5cee8978656b272a917b7871c981e0541ad6ac2a" + integrity sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg== + dependencies: + "@noble/hashes" "~1.3.0" + "@scure/base" "~1.1.0" + +"@types/big.js@^6.2.2": + version "6.2.2" + resolved "https://registry.npmjs.org/@types/big.js/-/big.js-6.2.2.tgz#69422ec9ef59df1330ccfde2106d9e1159a083c3" + integrity sha512-e2cOW9YlVzFY2iScnGBBkplKsrn2CsObHQ2Hiw4V1sSyiGbgWL8IyqE3zFi1Pt5o1pdAtYkDAIsF3KKUPjdzaA== + +"@types/node@^20.11.17": + version "20.11.30" + resolved "https://registry.npmjs.org/@types/node/-/node-20.11.30.tgz#9c33467fc23167a347e73834f788f4b9f399d66f" + integrity sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw== + dependencies: + undici-types "~5.26.4" + +abitype@1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/abitype/-/abitype-1.0.0.tgz#237176dace81d90d018bebf3a45cb42f2a2d9e97" + integrity sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ== + +big.js@^6.2.1: + version "6.2.1" + resolved "https://registry.npmjs.org/big.js/-/big.js-6.2.1.tgz#7205ce763efb17c2e41f26f121c420c6a7c2744f" + integrity sha512-bCtHMwL9LeDIozFn+oNhhFoq+yQ3BNdnsLSASUxLciOb1vgvpHsIO1dsENiGMgbb4SkP5TrzWzRiLddn8ahVOQ== + +bignumber.js@^9.1.2: + version "9.1.2" + resolved "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" + integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== + +csv-parser@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/csv-parser/-/csv-parser-3.0.0.tgz#b88a6256d79e090a97a1b56451f9327b01d710e7" + integrity sha512-s6OYSXAK3IdKqYO33y09jhypG/bSDHPuyCme/IdEHfWpLf/jKcpitVFyOC6UemgGk8v7Q5u2XE0vvwmanxhGlQ== + dependencies: + minimist "^1.2.0" + +decimal.js-light@^2.5.1: + version "2.5.1" + resolved "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz#134fd32508f19e208f4fb2f8dac0d2626a867934" + integrity sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg== + +fast-csv@^5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/fast-csv/-/fast-csv-5.0.1.tgz#2beaa2437ea83bd335cc3a39a41e69d9936f3987" + integrity sha512-Q43zC4NdQD5MAWOVQOF8KA+D6ddvTJjX2ib8zqysm74jZhtk6+dc8C75/OqRV6Y9CLc4kgvbC3PLG8YL4YZfgw== + dependencies: + "@fast-csv/format" "5.0.0" + "@fast-csv/parse" "5.0.0" + +isows@1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/isows/-/isows-1.0.3.tgz#93c1cf0575daf56e7120bab5c8c448b0809d0d74" + integrity sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg== + +jsbi@^4.3.0: + version "4.3.0" + resolved "https://registry.npmjs.org/jsbi/-/jsbi-4.3.0.tgz#b54ee074fb6fcbc00619559305c8f7e912b04741" + integrity sha512-SnZNcinB4RIcnEyZqFPdGPVgrg2AcnykiBy0sHVJQKHYeaLUvi3Exj+iaPpLnFVkDPZIV4U0yvgC9/R4uEAZ9g== + +lodash.escaperegexp@^4.1.2: + version "4.1.2" + resolved "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz#64762c48618082518ac3df4ccf5d5886dae20347" + integrity sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw== + +lodash.groupby@^4.6.0: + version "4.6.0" + resolved "https://registry.npmjs.org/lodash.groupby/-/lodash.groupby-4.6.0.tgz#0b08a1dcf68397c397855c3239783832df7403d1" + integrity sha512-5dcWxm23+VAoz+awKmBaiBvzox8+RqMgFhi7UvX9DHZr2HdxHXM/Wrf8cfKpsW37RNrvtPn6hSwNqurSILbmJw== + +lodash.isboolean@^3.0.3: + version "3.0.3" + resolved "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz#6c2e171db2a257cd96802fd43b01b20d5f5870f6" + integrity sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg== + +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== + +lodash.isfunction@^3.0.9: + version "3.0.9" + resolved "https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz#06de25df4db327ac931981d1bdb067e5af68d051" + integrity sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw== + +lodash.isnil@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/lodash.isnil/-/lodash.isnil-4.0.0.tgz#49e28cd559013458c814c5479d3c663a21bfaa6c" + integrity sha512-up2Mzq3545mwVnMhTDMdfoG1OurpA/s5t88JmQX809eH3C8491iu2sfKhTfhQtKY78oPNhiaHJUpT/dUDAAtng== + +lodash.isundefined@^3.0.1: + version "3.0.1" + resolved "https://registry.npmjs.org/lodash.isundefined/-/lodash.isundefined-3.0.1.tgz#23ef3d9535565203a66cefd5b830f848911afb48" + integrity sha512-MXB1is3s899/cD8jheYYE2V9qTHwKvt+npCwpD+1Sxm3Q3cECXCiYHjeHWXNwr6Q0SOBPrYUDxendrO6goVTEA== + +lodash.uniq@^4.5.0: + version "4.5.0" + resolved "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" + integrity sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ== + +minimist@^1.2.0: + version "1.2.8" + resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== + +tiny-invariant@^1.3.1: + version "1.3.3" + resolved "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz#46680b7a873a0d5d10005995eb90a70d74d60127" + integrity sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg== + +toformat@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/toformat/-/toformat-2.0.0.tgz#7a043fd2dfbe9021a4e36e508835ba32056739d8" + integrity sha512-03SWBVop6nU8bpyZCx7SodpYznbZF5R4ljwNLBcTQzKOD9xuihRo/psX58llS1BMFhhAI08H3luot5GoXJz2pQ== + +typescript@^5.3.3: + version "5.4.3" + resolved "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz#5c6fedd4c87bee01cd7a528a30145521f8e0feff" + integrity sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg== + +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + +viem@^2.8.13: + version "2.8.18" + resolved "https://registry.npmjs.org/viem/-/viem-2.8.18.tgz#ffb051bf80381ffefc98087a20c177b25463c9f4" + integrity sha512-Kq3kwkKziJ8rQeLkmdbSLheHDnA+tx2EdLKLmQ3N4FVtjKYjBP9tPL1r+fI6KltVUM1TDOhIHOdslDSp57VMMg== + dependencies: + "@adraffy/ens-normalize" "1.10.0" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@scure/bip32" "1.3.2" + "@scure/bip39" "1.2.1" + abitype "1.0.0" + isows "1.0.3" + ws "8.13.0" + +ws@8.13.0: + version "8.13.0" + resolved "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" + integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==