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 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a4bde2b
add synthetics
vipineth Feb 28, 2024
fec2062
add open interest
vipineth Feb 29, 2024
431b450
refactor
vipineth Feb 29, 2024
32eb1d5
refactor
vipineth Feb 29, 2024
2a79b28
add spot pairs
vipineth Mar 1, 2024
5889a51
add funding fees to perps
vipineth Mar 1, 2024
01cd768
refactor
vipineth Mar 1, 2024
1826f96
fix type errors
vipineth Mar 1, 2024
1f3e16a
fix funding rate avax
vipineth Mar 1, 2024
286fb47
refactor
vipineth Mar 4, 2024
d4e0375
Merge remote-tracking branch 'origin/main' into add-synthetics
K-Lascar Sep 27, 2024
f6462e5
Added new tokens to tokens list
K-Lascar Sep 27, 2024
6c442a5
Optimize Pairs Info
K-Lascar Sep 27, 2024
546f2f4
Remove Default Pricing for Stables
K-Lascar Oct 6, 2024
9ea742a
Remove Default Pricing and Single Token GM Pools
K-Lascar Oct 6, 2024
2e4cf26
Optimise async calls
K-Lascar Oct 18, 2024
fb2be5f
Fetch volumes daily
K-Lascar Oct 18, 2024
ad1059c
Remove default pricing for stables.
K-Lascar Oct 18, 2024
4c745bb
Add functionality for the liquidity and funding rates
K-Lascar Oct 18, 2024
675cdfe
Added in the funding factor in results
K-Lascar Oct 18, 2024
4b0398c
Added new tokens
K-Lascar Oct 18, 2024
5687ad1
Add recent tokens
K-Lascar Nov 24, 2024
13de695
Add in liquidity for swap pairs
K-Lascar Nov 24, 2024
f0a315c
Update yarn
K-Lascar Nov 24, 2024
a4dbce3
Update gitignore
K-Lascar Nov 24, 2024
17eb0fe
Update compiler options
K-Lascar Nov 28, 2024
66c5f18
Correct USD_DIVISOR
K-Lascar Nov 28, 2024
499c445
Add constant for MAX_PNL_FACTOR_FOR_TRADERS
K-Lascar Nov 28, 2024
92462f8
Updated compiler target
K-Lascar Nov 28, 2024
ec53f78
remove start and end timestamps
K-Lascar Nov 28, 2024
74ce15f
Merge pull request #5 from K-Lascar/add-synthetics
gdev8317 Jan 21, 2025
0847daf
parallelize requests
gdev8317 Jan 21, 2025
4f9872f
fixes
gdev8317 Jan 21, 2025
269c5b4
refactor
gdev8317 Jan 21, 2025
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