diff --git a/README.md b/README.md index 14e9af2..0c800b3 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,12 @@ Value: 0x00 Total ticks crossed: 7 ``` +## Sepolia + +``` +./bin/cli quote --tokenIn 0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14 --tokenOut 0x94a9D9AC8a22534E3FaCa9F4e7F2E2cf85d5E4C8 --amount 10 --exactOut --minSplits 1 --router alpha --chainId 11155111 +``` + ## Rinkeby ``` diff --git a/src/providers/caching-token-provider.ts b/src/providers/caching-token-provider.ts index 7556873..8d9b9b4 100644 --- a/src/providers/caching-token-provider.ts +++ b/src/providers/caching-token-provider.ts @@ -23,8 +23,11 @@ import { DAI_POLYGON_MUMBAI, DAI_RINKEBY_1, DAI_RINKEBY_2, + DAI_SEPOLIA, EUROC_MAINNET, + EURS_SEPOLIA, ITokenProvider, + LINK_SEPOLIA, LsETH_MAINNET, TokenAccessor, UNI_ARBITRUM_RINKEBY, @@ -38,6 +41,7 @@ import { USDC_OPTIMISM_GOERLI, USDC_OPTIMISTIC_KOVAN, USDC_POLYGON, + USDC_SEPOLIA, USDT_ARBITRUM, USDT_ARBITRUM_RINKEBY, USDT_MAINNET, @@ -68,6 +72,13 @@ export const CACHE_SEED_TOKENS: { CBETH: cbETH_MAINNET, LSETH: LsETH_MAINNET, }, + [ChainId.SEPOLIA]: { + WETH: WRAPPED_NATIVE_CURRENCY[ChainId.SEPOLIA]!, + USDC: USDC_SEPOLIA, + DAI: DAI_SEPOLIA, + LINK: LINK_SEPOLIA, + EURS: EURS_SEPOLIA, + }, [ChainId.RINKEBY]: { WETH: WRAPPED_NATIVE_CURRENCY[ChainId.RINKEBY]!, DAI_1: DAI_RINKEBY_1, diff --git a/src/providers/token-provider.ts b/src/providers/token-provider.ts index 8a8e94f..9e95300 100644 --- a/src/providers/token-provider.ts +++ b/src/providers/token-provider.ts @@ -105,6 +105,35 @@ export const UNI_MAINNET = new Token( 'Uniswap' ); + +export const USDC_SEPOLIA = new Token( + ChainId.SEPOLIA, + '0x94a9D9AC8a22534E3FaCa9F4e7F2E2cf85d5E4C8', + 18, + 'USDC', + 'USDC Token' +); +export const DAI_SEPOLIA = new Token( + ChainId.SEPOLIA, + '0xFF34B3d4Aee8ddCd6F9AFFFB6Fe49bD371b8a357', + 18, + 'DAI', + 'DAI Token' +); +export const EURS_SEPOLIA = new Token( + ChainId.SEPOLIA, + '0x6d906e526a4e2Ca02097BA9d0caA3c382F52278E', + 18, + 'EURS', + 'STASIS EURS Token' +); +export const LINK_SEPOLIA = new Token( + ChainId.SEPOLIA, + '0xf8Fb3713D459D7C1018BD0A49D19b4C44290EBE5', + 18, + 'LINK', + 'Chainlink Token' +); export const USDC_ROPSTEN = new Token( ChainId.ROPSTEN, '0x07865c6e87b9f70255377e024ace6630c1eaa37f', @@ -704,6 +733,8 @@ export const DAI_ON = (chainId: ChainId): Token => { switch (chainId) { case ChainId.MAINNET: return DAI_MAINNET; + case ChainId.SEPOLIA: + return DAI_SEPOLIA; case ChainId.ROPSTEN: return DAI_ROPSTEN; case ChainId.RINKEBY: @@ -772,6 +803,8 @@ export const USDC_ON = (chainId: ChainId): Token => { return USDC_MAINNET; case ChainId.ROPSTEN: return USDC_ROPSTEN; + case ChainId.SEPOLIA: + return USDC_SEPOLIA; case ChainId.RINKEBY: return USDC_RINKEBY; case ChainId.GOERLI: diff --git a/src/providers/v2/static-subgraph-provider.ts b/src/providers/v2/static-subgraph-provider.ts index ad85856..ce564f1 100644 --- a/src/providers/v2/static-subgraph-provider.ts +++ b/src/providers/v2/static-subgraph-provider.ts @@ -34,6 +34,7 @@ const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = { DAI_RINKEBY_2, ], [ChainId.GOERLI]: [WRAPPED_NATIVE_CURRENCY[ChainId.GOERLI]!], + [ChainId.SEPOLIA]: [WRAPPED_NATIVE_CURRENCY[ChainId.SEPOLIA]!], [ChainId.KOVAN]: [WRAPPED_NATIVE_CURRENCY[ChainId.KOVAN]!], //v2 not deployed on [optimism, arbitrum, polygon, celo, gnosis, moonbeam] and their testnets [ChainId.OPTIMISM]: [], diff --git a/src/providers/v3/static-subgraph-provider.ts b/src/providers/v3/static-subgraph-provider.ts index 2720553..73f6aad 100644 --- a/src/providers/v3/static-subgraph-provider.ts +++ b/src/providers/v3/static-subgraph-provider.ts @@ -29,6 +29,7 @@ import { DAI_RINKEBY_1, DAI_RINKEBY_2, DAI_ROPSTEN, + DAI_SEPOLIA, UNI_ARBITRUM_RINKEBY, USDC_ARBITRUM, USDC_ARBITRUM_GOERLI, @@ -43,6 +44,7 @@ import { USDC_POLYGON, USDC_RINKEBY, USDC_ROPSTEN, + USDC_SEPOLIA, USDT_ARBITRUM, USDT_ARBITRUM_RINKEBY, USDT_GOERLI, @@ -103,6 +105,11 @@ const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = { WBTC_GOERLI, DAI_GOERLI, ], + [ChainId.SEPOLIA]: [ + WRAPPED_NATIVE_CURRENCY[ChainId.SEPOLIA]!, + USDC_SEPOLIA, + DAI_SEPOLIA, + ], [ChainId.KOVAN]: [ WRAPPED_NATIVE_CURRENCY[ChainId.KOVAN]!, USDC_KOVAN, diff --git a/src/routers/alpha-router/functions/get-candidate-pools.ts b/src/routers/alpha-router/functions/get-candidate-pools.ts index 6ebe0a6..d38bdc6 100644 --- a/src/routers/alpha-router/functions/get-candidate-pools.ts +++ b/src/routers/alpha-router/functions/get-candidate-pools.ts @@ -21,6 +21,7 @@ import { DAI_POLYGON_MUMBAI, DAI_RINKEBY_1, DAI_RINKEBY_2, + DAI_SEPOLIA, FEI_MAINNET, ITokenProvider, USDC_ARBITRUM, @@ -32,6 +33,7 @@ import { USDC_OPTIMISM_GOERLI, USDC_OPTIMISTIC_KOVAN, USDC_POLYGON, + USDC_SEPOLIA, USDT_ARBITRUM, USDT_ARBITRUM_RINKEBY, USDT_MAINNET, @@ -132,6 +134,7 @@ const baseTokensByChain: { [chainId in ChainId]?: Token[] } = { FEI_MAINNET, ], [ChainId.RINKEBY]: [DAI_RINKEBY_1, DAI_RINKEBY_2], + [ChainId.SEPOLIA]: [USDC_SEPOLIA, DAI_SEPOLIA], [ChainId.OPTIMISM]: [ DAI_OPTIMISM, USDC_OPTIMISM, diff --git a/src/routers/alpha-router/gas-models/gas-model.ts b/src/routers/alpha-router/gas-models/gas-model.ts index aeb99b5..aaae47d 100644 --- a/src/routers/alpha-router/gas-models/gas-model.ts +++ b/src/routers/alpha-router/gas-models/gas-model.ts @@ -15,6 +15,7 @@ import { DAI_RINKEBY_1, DAI_RINKEBY_2, DAI_ROPSTEN, + DAI_SEPOLIA, USDC_ARBITRUM, USDC_ARBITRUM_GOERLI, USDC_ETHEREUM_GNOSIS, @@ -27,6 +28,7 @@ import { USDC_OPTIMISTIC_KOVAN, USDC_POLYGON, USDC_ROPSTEN, + USDC_SEPOLIA, USDT_ARBITRUM, USDT_ARBITRUM_RINKEBY, USDT_GOERLI, @@ -73,6 +75,7 @@ export const usdGasTokensByChain: { [chainId in ChainId]?: Token[] } = { [ChainId.KOVAN]: [DAI_KOVAN, USDC_KOVAN, USDT_KOVAN], [ChainId.GOERLI]: [DAI_GOERLI, USDC_GOERLI, USDT_GOERLI, WBTC_GOERLI], [ChainId.ROPSTEN]: [DAI_ROPSTEN, USDC_ROPSTEN, USDT_ROPSTEN], + [ChainId.SEPOLIA]: [DAI_SEPOLIA, USDC_SEPOLIA], [ChainId.POLYGON]: [USDC_POLYGON], [ChainId.POLYGON_MUMBAI]: [DAI_POLYGON_MUMBAI], [ChainId.CELO]: [CUSD_CELO], diff --git a/src/routers/alpha-router/gas-models/v3/gas-costs.ts b/src/routers/alpha-router/gas-models/v3/gas-costs.ts index dc22914..5be6652 100644 --- a/src/routers/alpha-router/gas-models/v3/gas-costs.ts +++ b/src/routers/alpha-router/gas-models/v3/gas-costs.ts @@ -12,6 +12,7 @@ export const BASE_SWAP_COST = (id: ChainId): BigNumber => { case ChainId.ROPSTEN: case ChainId.RINKEBY: case ChainId.GOERLI: + case ChainId.SEPOLIA: case ChainId.OPTIMISM: case ChainId.OPTIMISM_GOERLI: case ChainId.OPTIMISTIC_KOVAN: @@ -42,6 +43,7 @@ export const COST_PER_INIT_TICK = (id: ChainId): BigNumber => { case ChainId.ROPSTEN: case ChainId.RINKEBY: case ChainId.GOERLI: + case ChainId.SEPOLIA: case ChainId.KOVAN: return BigNumber.from(31000); case ChainId.OPTIMISM: @@ -71,6 +73,7 @@ export const COST_PER_HOP = (id: ChainId): BigNumber => { case ChainId.ROPSTEN: case ChainId.RINKEBY: case ChainId.GOERLI: + case ChainId.SEPOLIA: case ChainId.OPTIMISM: case ChainId.OPTIMISM_GOERLI: case ChainId.OPTIMISTIC_KOVAN: diff --git a/src/util/addresses.ts b/src/util/addresses.ts index b0bc789..6db0db7 100644 --- a/src/util/addresses.ts +++ b/src/util/addresses.ts @@ -23,6 +23,14 @@ const MAINNET_QUOTER_V2 = '0x8443289e5dd694eFA46440B52C7Fe4b828E668D6'; const MAINNET_MAUVE_MULTICALL_ADDRESS = '0xDB98e266D090b1A6538d56459CbEE0fE0f38d879'; +// SEPOLIA Deployment +const SEPOLIA_FACTORY_ADDRESS = + '0x1a0917A5d4ca70D9982D0988a0DEA3373d162F6d'; +const SEPOLIA_QUOTER = '0x398Ac7008037CA54526Ce6e8c0Cd4E8808B09D91'; +const SEPOLIA_QUOTER_V2 = '0x90f1e4d85e19883CA8f01F380c9F584581b19260'; +const SEPOLIA_MAUVE_MULTICALL_ADDRESS = + '0x29e2C6276A59C8dD8631Bc49cf16E685d43fA221'; + export const V3_CORE_FACTORY_ADDRESSES: AddressMap = { ...constructSameAddressMap(MAINNET_FACTORY_ADDRESS), // [ChainId.CELO]: CELO_V3_CORE_FACTORY_ADDRESSES, @@ -34,6 +42,7 @@ export const V3_CORE_FACTORY_ADDRESSES: AddressMap = { [ChainId.MAINNET]: MAINNET_FACTORY_ADDRESS, [ChainId.GOERLI]: GOERLI_FACTORY_ADDRESS, [ChainId.OPTIMISM_GOERLI]: OPTIMISM_GOERLI_FACTORY_ADDRESS, + [ChainId.SEPOLIA]: SEPOLIA_FACTORY_ADDRESS, }; export const QUOTER_V2_ADDRESSES: AddressMap = { @@ -47,6 +56,7 @@ export const QUOTER_V2_ADDRESSES: AddressMap = { [ChainId.MAINNET]: MAINNET_QUOTER_V2, [ChainId.GOERLI]: GOERLI_QUOTER_V2, [ChainId.OPTIMISM_GOERLI]: OPTIMISM_GOERLI_QUOTER_V2, + [ChainId.SEPOLIA]: SEPOLIA_QUOTER_V2, }; export const MIXED_ROUTE_QUOTER_V1_ADDRESSES: AddressMap = { @@ -56,6 +66,7 @@ export const MIXED_ROUTE_QUOTER_V1_ADDRESSES: AddressMap = { // // override GOERLI [ChainId.GOERLI]: GOERLI_QUOTER, [ChainId.OPTIMISM_GOERLI]: OPTIMISM_GOERLI_QUOTER, + [ChainId.SEPOLIA]: SEPOLIA_QUOTER, }; export const UNISWAP_MULTICALL_ADDRESSES: AddressMap = { @@ -67,6 +78,7 @@ export const UNISWAP_MULTICALL_ADDRESSES: AddressMap = { // TODO: Gnosis + Moonbeam contracts to be deployed [ChainId.MAINNET]: MAINNET_MAUVE_MULTICALL_ADDRESS, [ChainId.OPTIMISM_GOERLI]: OPTIMISM_GOERLI_MAUVE_MULTICALL_ADDRESS, + [ChainId.SEPOLIA]: SEPOLIA_MAUVE_MULTICALL_ADDRESS, }; export const OVM_GASPRICE_ADDRESS = @@ -120,6 +132,13 @@ export const WETH9: { 'WETH', 'Wrapped Ether' ), + [ChainId.SEPOLIA]: new Token( + ChainId.SEPOLIA, + '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14', + 18, + 'WETH', + 'Wrapped Ether' + ), [ChainId.RINKEBY]: new Token( ChainId.RINKEBY, '0xc778417E063141139Fce010982780140Aa0cD5Ab', diff --git a/src/util/chains.ts b/src/util/chains.ts index 4214b0a..017c235 100644 --- a/src/util/chains.ts +++ b/src/util/chains.ts @@ -11,6 +11,7 @@ export enum ChainId { RINKEBY = 4, GOERLI = 5, KOVAN = 42, + SEPOLIA = 11155111, OPTIMISM = 10, OPTIMISTIC_KOVAN = 69, OPTIMISM_GOERLI = 420, @@ -28,6 +29,7 @@ export enum ChainId { // WIP: Gnosis, Moonbeam export const SUPPORTED_CHAINS: ChainId[] = [ ChainId.MAINNET, + ChainId.SEPOLIA, // ChainId.RINKEBY, // ChainId.ROPSTEN, // ChainId.KOVAN, @@ -84,6 +86,8 @@ export const ID_TO_CHAIN_ID = (id: number): ChainId => { return ChainId.RINKEBY; case 5: return ChainId.GOERLI; + case 11155111: + return ChainId.SEPOLIA; case 42: return ChainId.KOVAN; case 10: @@ -121,6 +125,7 @@ export enum ChainName { RINKEBY = 'rinkeby', GOERLI = 'goerli', KOVAN = 'kovan', + SEPOLIA = 'sepolia', OPTIMISM = 'optimism-mainnet', OPTIMISM_GOERLI = 'optimism-goerli', OPTIMISTIC_KOVAN = 'optimism-kovan', @@ -169,6 +174,11 @@ export const NATIVE_NAMES_BY_ID: { [chainId: number]: string[] } = { 'ETHER', '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', ], + [ChainId.SEPOLIA]: [ + 'ETH', + 'ETHER', + '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', + ], [ChainId.OPTIMISM]: [ 'ETH', 'ETHER', @@ -216,6 +226,7 @@ export const NATIVE_CURRENCY: { [chainId: number]: NativeCurrencyName } = { [ChainId.RINKEBY]: NativeCurrencyName.ETHER, [ChainId.GOERLI]: NativeCurrencyName.ETHER, [ChainId.KOVAN]: NativeCurrencyName.ETHER, + [ChainId.SEPOLIA]: NativeCurrencyName.ETHER, [ChainId.OPTIMISM]: NativeCurrencyName.ETHER, [ChainId.OPTIMISM_GOERLI]: NativeCurrencyName.ETHER, [ChainId.OPTIMISTIC_KOVAN]: NativeCurrencyName.ETHER, @@ -242,6 +253,8 @@ export const ID_TO_NETWORK_NAME = (id: number): ChainName => { return ChainName.GOERLI; case 42: return ChainName.KOVAN; + case 11155111: + return ChainName.SEPOLIA; case 10: return ChainName.OPTIMISM; case 420: @@ -285,6 +298,8 @@ export const ID_TO_PROVIDER = (id: ChainId): string => { return process.env.JSON_RPC_PROVIDER_GORLI!; case ChainId.KOVAN: return process.env.JSON_RPC_PROVIDER_KOVAN!; + case ChainId.SEPOLIA: + return process.env.JSON_RPC_PROVIDER_SEPOLIA!; case ChainId.OPTIMISM: return process.env.JSON_RPC_PROVIDER_OPTIMISM!; case ChainId.OPTIMISM_GOERLI: @@ -318,6 +333,13 @@ export const WRAPPED_NATIVE_CURRENCY: { [chainId in ChainId]: Token } = { 'WETH', 'Wrapped Ether' ), + [ChainId.SEPOLIA]: new Token( + 11155111, + '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14', + 18, + 'WETH', + 'Wrapped Ether' + ), [ChainId.ROPSTEN]: new Token( 3, '0xc778417E063141139Fce010982780140Aa0cD5Ab', diff --git a/test/test-util/whales.ts b/test/test-util/whales.ts index b029821..1cabe8a 100644 --- a/test/test-util/whales.ts +++ b/test/test-util/whales.ts @@ -53,6 +53,8 @@ export const WHALES = (token: Currency): string => { return '0x47ac0fb4f2d84898e4d9e7b4dab3c24507a6d503'; case USDC_ON(ChainId.ROPSTEN): return '0x366d1dd8558b59398439a01fb6935f6f40ebcd60'; + case USDC_ON(ChainId.SEPOLIA): + return '0x33FaabBe19057C30d1405Fd8d16039255ff7EEf4'; case USDC_ON(ChainId.RINKEBY): return '0x65671d573fc0e62139fbde470bfd03a38b4d5f26'; case UNI_GOERLI: @@ -77,6 +79,8 @@ export const WHALES = (token: Currency): string => { return '0x48520ff9b32d8b5bf87abf789ea7b3c394c95ebe'; case DAI_ON(ChainId.ROPSTEN): return '0x922b992698381c7dc8d23684e2caef396b0b73a4'; + case DAI_ON(ChainId.SEPOLIA): + return '0x33FaabBe19057C30d1405Fd8d16039255ff7EEf4'; case DAI_ON(ChainId.RINKEBY): return '0xcea4e535d03086dbaa04c71675129654e92cc055'; case DAI_ON(ChainId.GOERLI):