Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add synthetics #4

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,442 changes: 1,442 additions & 0 deletions abis/DataStore.json

Large diffs are not rendered by default.

4,031 changes: 4,031 additions & 0 deletions abis/SyntheticReader.json

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions config/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { Abi, Address } from 'viem'
import DataStore from '../abis/DataStore.json'
import SyntheticsReader from '../abis/SyntheticReader.json'
export const AVALANCHE = 43114
export const ARBITRUM = 42161
export const AddressZero = '0x0000000000000000000000000000000000000000'
Expand All @@ -15,10 +18,46 @@ export const currentPriceUrls: { [key: number]: string } = {
[AVALANCHE]: 'https://gmx-avax-server.uc.r.appspot.com/prices',
}

export const CONTRACTS: {
[key: number]: { [key: string]: string }
} = {
[ARBITRUM]: {
DataStore: '0xFD70de6b91282D8017aA4E741e9Ae325CAb992d8',
SyntheticsReader: '0xf60becbba223EEA9495Da3f606753867eC10d139',
},
[AVALANCHE]: {
DataStore: '0x2F0b22339414ADeD7D5F06f9D604c7fF5b2fe3f6',
SyntheticsReader: '0x73BA021ACF4Bb6741E82690DdB821e7936050f8C',
},
}

export const CHAINLINK_CONTRACTS: { [key: string]: string } = {
USDC: '0x789190466e21a8b78b8027866cbbdc151542a26c',
'USDC.e': '0x789190466e21a8b78b8027866cbbdc151542a26c',
USDT: '0x838a42bd3b727880ef27920acb637abeff2f73d4',
DAI: '0xdec0a100ead1faa37407f0edc76033426cf90b82',
FRAX: '0x61eb091ea16a32ea5b880d0b3d09d518c340d750',
}

export function getDataStoreContract(chainId: number) {
const address = CONTRACTS[chainId].DataStore
return {
address: address as Address,
abi: DataStore.abi as Abi,
} as const
}

export function getSyntheticsReaderContract(chainId: number) {
const address = CONTRACTS[chainId].SyntheticsReader
return {
address: address as Address,
abi: SyntheticsReader.abi as Abi,
} as const
}

export function getContractAddress(chainId: number, contract: string) {
const address = CONTRACTS[chainId][contract]
if (!address) return

return address
}
17 changes: 0 additions & 17 deletions config/pairs.ts

This file was deleted.

Loading