-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: map Uniswap token list to Gnosis chain (#359)
* feat: map Uniswap token list to Gnosis chain * chore: remove node-fetch * chore: rename generateGnosisChainList * chore: fix scripts
- Loading branch information
Showing
19 changed files
with
1,802 additions
and
764 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Editor configuration, see http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
end_of_line = lf | ||
|
||
[*.md] | ||
max_line_length = off | ||
trim_trailing_whitespace = false | ||
|
||
[{*.ts,*.tsx}] | ||
ij_typescript_force_quote_style = true | ||
ij_typescript_use_double_quotes = false | ||
ij_typescript_use_semicolon_after_statement = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
export const MULTICALL_ABI = [ | ||
{ | ||
'inputs': [ | ||
{ | ||
'internalType': 'bool', | ||
'name': 'requireSuccess', | ||
'type': 'bool' | ||
}, | ||
{ | ||
'components': [ | ||
{ | ||
'internalType': 'address', | ||
'name': 'target', | ||
'type': 'address' | ||
}, | ||
{ | ||
'internalType': 'bytes', | ||
'name': 'callData', | ||
'type': 'bytes' | ||
} | ||
], | ||
'internalType': 'struct Multicall3.Call[]', | ||
'name': 'calls', | ||
'type': 'tuple[]' | ||
} | ||
], | ||
'name': 'tryAggregate', | ||
'outputs': [ | ||
{ | ||
'components': [ | ||
{ | ||
'internalType': 'bool', | ||
'name': 'success', | ||
'type': 'bool' | ||
}, | ||
{ | ||
'internalType': 'bytes', | ||
'name': 'returnData', | ||
'type': 'bytes' | ||
} | ||
], | ||
'internalType': 'struct Multicall3.Result[]', | ||
'name': 'returnData', | ||
'type': 'tuple[]' | ||
} | ||
], | ||
'stateMutability': 'payable', | ||
'type': 'function' | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const OMNIBRIDGE_CONTRACT_ABI = [{ | ||
'inputs': [{'internalType': 'address', 'name': '_nativeToken', 'type': 'address'}], | ||
'name': 'bridgedTokenAddress', | ||
'outputs': [{'internalType': 'address', 'name': '', 'type': 'address'}], | ||
'stateMutability': 'view', | ||
'type': 'function' | ||
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
import { env } from 'node:process' | ||
import { join } from 'node:path' | ||
import {SupportedChainId} from '@cowprotocol/cow-sdk' | ||
|
||
// CoW protocol contract address. Could be any address in theory for checking the token is permittable | ||
export const SPENDER_ADDRESS = '0xC92E8bdf79f0507f65a392b0ab4667716BFE0110' | ||
|
||
export const DEFAULT_RPC_URLS: Record<number, string> = { | ||
1: 'https://mainnet.infura.io/v3/' + env.INFURA_API_KEY, | ||
100: 'https://rpc.gnosischain.com', | ||
11155111: 'https://ethereum-sepolia.publicnode.com', | ||
export const DEFAULT_RPC_URLS: Record<SupportedChainId, string> = { | ||
[SupportedChainId.MAINNET]: 'https://mainnet.infura.io/v3/' + env.INFURA_API_KEY, | ||
[SupportedChainId.GNOSIS_CHAIN]: 'https://rpc.gnosischain.com', | ||
[SupportedChainId.SEPOLIA]: 'https://ethereum-sepolia.publicnode.com', | ||
} | ||
|
||
export const BASE_PATH = join('..', 'public') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
import { JsonRpcProvider } from '@ethersproject/providers' | ||
import { DEFAULT_RPC_URLS } from '../const.ts' | ||
import { env } from 'node:process' | ||
import { DEFAULT_RPC_URLS } from '../const' | ||
import { ethers } from 'ethers' | ||
import {SupportedChainId} from '@cowprotocol/cow-sdk' | ||
|
||
export function getProvider(chainId: number, rpcUrl: string | undefined): JsonRpcProvider { | ||
const rpcEndpoint = rpcUrl ? rpcUrl : DEFAULT_RPC_URLS[chainId] | ||
const rpcEndpoint = rpcUrl ? rpcUrl : DEFAULT_RPC_URLS[chainId as SupportedChainId] | ||
|
||
if (!rpcEndpoint) { | ||
throw new Error(`No RPC found for network ${chainId}`) | ||
} | ||
|
||
if (!rpcUrl && chainId === 1 && !env.INFURA_API_KEY) { | ||
throw new Error(`INFURA_API_KEY is required`) | ||
} | ||
|
||
return new ethers.providers.JsonRpcProvider(rpcEndpoint) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.