Skip to content

Commit a2bc3e7

Browse files
GMX tokens EA (#4468)
* Adds gmx-tokens EA to fetch GLV and GM token prices
1 parent 3ff13d2 commit a2bc3e7

33 files changed

+7297
-0
lines changed

.changeset/cold-rules-hide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@chainlink/gmx-tokens-adapter': major
3+
---
4+
5+
Adds gmx-token to fetch prices for GLV and GM tokens

.pnp.cjs

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/composites/gmx-tokens/CHANGELOG.md

Whitespace-only changes.
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# GMX_TOKENS
2+
3+
![0.0.0](https://img.shields.io/github/package-json/v/smartcontractkit/external-adapters-js?filename=packages/composites/gmx-tokens/package.json) ![v3](https://img.shields.io/badge/framework%20version-v3-blueviolet)
4+
5+
This document was generated automatically. Please see [README Generator](../../scripts#readme-generator) for more info.
6+
7+
## Environment Variables
8+
9+
| Required? | Name | Description | Type | Options | Default |
10+
| :-------: | :-----------------------------------: | :---------------------------------------------------------------------------------------: | :----: | :-----: | :------------------------------------------: |
11+
|| DATA_ENGINE_ADAPTER_URL | URL of Data Engine EA | string | | |
12+
| | ARBITRUM_RPC_URL | RPC url of Arbitrum node | string | | |
13+
| | ARBITRUM_CHAIN_ID | The chain id to connect to for Arbitrum | number | | `42161` |
14+
| | BOTANIX_RPC_URL | RPC url of Botanix node | string | | |
15+
| | BOTANIX_CHAIN_ID | The chain id to connect to for Botanix | number | | `3637` |
16+
| | AVALANCHE_RPC_URL | RPC url of Avalanche node | string | | |
17+
| | AVALANCHE_CHAIN_ID | The chain id to connect to for Avalanche | number | | `43114` |
18+
| | ARBITRUM_DATASTORE_CONTRACT_ADDRESS | Address of Data Store contract on Arbitrum | string | | `0xFD70de6b91282D8017aA4E741e9Ae325CAb992d8` |
19+
| | BOTANIX_DATASTORE_CONTRACT_ADDRESS | Address of Data Store contract on Botanix | string | | `0xA23B81a89Ab9D7D89fF8fc1b5d8508fB75Cc094d` |
20+
| | AVALANCHE_DATASTORE_CONTRACT_ADDRESS | Address of Data Store contract on Avalanche | string | | `0x2F0b22339414ADeD7D5F06f9D604c7fF5b2fe3f6` |
21+
| | ARBITRUM_GM_READER_CONTRACT_ADDRESS | Address of GM Reader contract on Arbitrum | string | | `0x470fbC46bcC0f16532691Df360A07d8Bf5ee0789` |
22+
| | BOTANIX_GM_READER_CONTRACT_ADDRESS | Address of GM Reader contract on Botanix | string | | `0x922766ca6234cD49A483b5ee8D86cA3590D0Fb0E` |
23+
| | AVALANCHE_GM_READER_CONTRACT_ADDRESS | Address of GM Reader contract on Avalanche | string | | `0x62Cb8740E6986B29dC671B2EB596676f60590A5B` |
24+
| | ARBITRUM_GLV_READER_CONTRACT_ADDRESS | Address of GLV Reader contract on Arbitrum | string | | `0x2C670A23f1E798184647288072e84054938B5497` |
25+
| | BOTANIX_GLV_READER_CONTRACT_ADDRESS | Address of GLV Reader contract on Botanix | string | | `0x955Aa50d2ecCeffa59084BE5e875eb676FfAFa98` |
26+
| | AVALANCHE_GLV_READER_CONTRACT_ADDRESS | Address of GLV Reader contract on Avalanche | string | | `0x5C6905A3002f989E1625910ba1793d40a031f947` |
27+
|| ARBITRUM_TOKENS_INFO_URL | URL to token metadata supported by GMX on Arbitrum | string | | `https://arbitrum-api.gmxinfra.io/tokens` |
28+
| | BOTANIX_TOKENS_INFO_URL | URL to token metadata supported by GMX on Botanix | string | | `https://botanix-api.gmxinfra.io/tokens` |
29+
| | AVALANCHE_TOKENS_INFO_URL | URL to token metadata supported by GMX on Avalanche | string | | `https://avalanche-api.gmxinfra.io/tokens` |
30+
| | ARBITRUM_MARKETS_INFO_URL | URL to market metadata supported by GMX on Arbitrum | string | | `https://arbitrum-api.gmxinfra.io/markets` |
31+
| | BOTANIX_MARKETS_INFO_URL | URL to market metadata supported by GMX on Botanix | string | | `https://botanix-api.gmxinfra.io/markets` |
32+
| | AVALANCHE_MARKETS_INFO_URL | URL to market metadata supported by GMX on Avalanche | string | | `https://avalanche-api.gmxinfra.io/markets` |
33+
| | GLV_INFO_API_TIMEOUT_MS | Timeout for metadata API requests. Distinct from API_TIMEOUT used for provider requests. | number | | `10000` |
34+
| | METADATA_REFRESH_INTERVAL_MS | How often metadata should be refreshed from GMX APIs | number | | `10800000` |
35+
|| PNL_FACTOR_TYPE | PnL factor type. See https://github.com/gmx-io/gmx-synthetics#market-token-price | string | | `MAX_PNL_FACTOR_FOR_TRADERS` |
36+
| | BACKGROUND_EXECUTE_MS | The amount of time the background execute should sleep before performing the next request | number | | `10000` |
37+
38+
---
39+
40+
## Data Provider Rate Limits
41+
42+
There are no rate limits for this adapter.
43+
44+
---
45+
46+
## Input Parameters
47+
48+
| Required? | Name | Description | Type | Options | Default |
49+
| :-------: | :------: | :-----------------: | :----: | :------------------------------------------------------------------------------------------------------------------------------------------: | :--------: |
50+
| | endpoint | The endpoint to use | string | [crypto-lwba](#glv-price-endpoint), [glv-crypto-lwba](#glv-price-endpoint), [glv-price](#glv-price-endpoint), [gm-price](#gm-price-endpoint) | `gm-price` |
51+
52+
## Gm-price Endpoint
53+
54+
`gm-price` is the only supported name for this endpoint.
55+
56+
### Input Params
57+
58+
| Required? | Name | Aliases | Description | Type | Options | Default | Depends On | Not Valid With |
59+
| :-------: | :----: | :-----: | :----------------------------------------------------------------------------------: | :----: | :--------------------------------: | :--------: | :--------: | :------------: |
60+
|| index | | Index token. Long and short tokens will be opened / closed based on this price feed. | string | | | | |
61+
|| long | | Long token. This is the token that will back long positions. | string | | | | |
62+
|| short | | Short token. This is the token that will back short positions. | string | | | | |
63+
|| market | | Market address of the market pool. | string | | | | |
64+
| | chain | | Target chain for GM market | string | `arbitrum`, `avalanche`, `botanix` | `arbitrum` | | |
65+
66+
### Example
67+
68+
Request:
69+
70+
```json
71+
{
72+
"data": {
73+
"endpoint": "gm-price",
74+
"index": "LINK",
75+
"long": "LINK",
76+
"short": "USDC",
77+
"market": "0x7f1fa204bb700853D36994DA19F830b6Ad18455C",
78+
"chain": "arbitrum"
79+
}
80+
}
81+
```
82+
83+
---
84+
85+
## Glv-price Endpoint
86+
87+
Supported names for this endpoint are: `crypto-lwba`, `glv-crypto-lwba`, `glv-price`.
88+
89+
### Input Params
90+
91+
| Required? | Name | Aliases | Description | Type | Options | Default | Depends On | Not Valid With |
92+
| :-------: | :---: | :-----: | :-------------------------: | :----: | :--------------------------------: | :--------: | :--------: | :------------: |
93+
|| glv | | Glv address | string | | | | |
94+
| | chain | | Target chain for GLV market | string | `arbitrum`, `avalanche`, `botanix` | `arbitrum` | | |
95+
96+
### Example
97+
98+
Request:
99+
100+
```json
101+
{
102+
"data": {
103+
"endpoint": "glv-price",
104+
"glv": "0x528A5bac7E746C9A509A1f4F6dF58A03d44279F9",
105+
"chain": "arbitrum"
106+
}
107+
}
108+
```
109+
110+
---
111+
112+
MIT License
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "@chainlink/gmx-tokens-adapter",
3+
"version": "0.0.0",
4+
"description": "Chainlink GM + GLV tokens composite adapter.",
5+
"keywords": [
6+
"Chainlink",
7+
"LINK",
8+
"blockchain",
9+
"oracle",
10+
"gmx",
11+
"gm-token",
12+
"glv-token"
13+
],
14+
"main": "dist/index.js",
15+
"types": "dist/index.d.ts",
16+
"files": [
17+
"dist"
18+
],
19+
"repository": {
20+
"url": "https://github.com/smartcontractkit/external-adapters-js",
21+
"type": "git"
22+
},
23+
"license": "MIT",
24+
"scripts": {
25+
"clean": "rm -rf dist && rm -f tsconfig.tsbuildinfo",
26+
"prepack": "yarn build",
27+
"build": "tsc -b",
28+
"server": "node -e 'require(\"./index.js\").server()'",
29+
"server:dist": "node -e 'require(\"./dist/index.js\").server()'",
30+
"start": "yarn server:dist"
31+
},
32+
"devDependencies": {
33+
"@sinonjs/fake-timers": "9.1.2",
34+
"@types/jest": "^29.5.14",
35+
"@types/node": "22.14.1",
36+
"@types/sinonjs__fake-timers": "8.1.5",
37+
"nock": "13.5.6",
38+
"typescript": "5.8.3"
39+
},
40+
"dependencies": {
41+
"@chainlink/data-engine-adapter": "workspace:^",
42+
"@chainlink/external-adapter-framework": "2.11.1",
43+
"decimal.js": "^10.3.1",
44+
"ethers": "^6.15.0",
45+
"tslib": "2.4.1"
46+
}
47+
}

0 commit comments

Comments
 (0)