Skip to content

Commit f98be29

Browse files
authored
Merge pull request #4 from stabilitydao/dev
0.5.0
2 parents 49fd3d1 + 71c0d80 commit f98be29

File tree

9 files changed

+247
-8
lines changed

9 files changed

+247
-8
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Test and coverage
2-
on: [push, pull_request]
2+
on: [pull_request]
33
jobs:
44
run:
55
runs-on: ubuntu-latest

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ console.log('Platform address on Polygon', deployments["137"].platform)
2626

2727
Comprehensive information about platform strategies for managing DeFi assets. Includes developed strategies and those currently in development or awaiting development.
2828

29+
#### Methods
30+
31+
* `getMerklStrategies()`
32+
* `getStrategyShortId(id: string): StrategyShortId|undefined`
33+
2934
### Networks
3035

3136
Blockchains known to the platform and their integration statuses.
@@ -34,6 +39,14 @@ Blockchains known to the platform and their integration statuses.
3439

3540
DeFi organizations, protocols, their integration statuses, usage and other information.
3641

42+
#### Methods
43+
44+
* `getIntegrationStatus(p: DeFiProtocol): IntegrationStatus`
45+
46+
### Tokenlist
47+
48+
`stability.tokenlist.json`
49+
3750
## Develop
3851

3952
```shell

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stabilitydao/stability",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"description": "Stability Integration Library",
55
"main": "out/index.js",
66
"types": "out/index.d.ts",
@@ -19,13 +19,15 @@
1919
"test": "jest",
2020
"coverage": "jest --collect-coverage",
2121
"overview": "ts-node tools/overview.ts",
22-
"overview-full": "ts-node tools/overview-full.ts"
22+
"overview-full": "ts-node tools/overview-full.ts",
23+
"postbuild": "shx cp src/*.tokenlist.json out/"
2324
},
2425
"devDependencies": {
2526
"@types/jest": "^29.5.12",
2627
"ansis": "^3.2.0",
2728
"console-table-printer": "^2.12.0",
2829
"jest": "^29.7.0",
30+
"shx": "^0.3.4",
2931
"ts-jest": "^29.1.4",
3032
"ts-node": "^10.9.2",
3133
"typescript": "^5.4.5"

src/stability.tokenlist.json

+168
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
{
2+
"name": "Stability Token List",
3+
"logoURI": "https://stability.farm/logo.svg",
4+
"keywords": [],
5+
"timestamp": "2024-06-10T00:00:00+00:00",
6+
"version": {
7+
"major": 1,
8+
"minor": 2,
9+
"patch": 0
10+
},
11+
"tags": {
12+
"stablecoin": {
13+
"name": "Stablecoin",
14+
"description": "Tokens that are fixed to an external asset, e.g. the US dollar"
15+
},
16+
"bridged": {
17+
"name": "Bridged",
18+
"description": "Tokens that are bridged to current chain from another"
19+
},
20+
"lst": {
21+
"name": "Liquid Staking",
22+
"description": "Liquid staking token"
23+
}
24+
},
25+
"tokens": [
26+
{
27+
"chainId": 137,
28+
"address": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
29+
"symbol": "USDC.e",
30+
"name": "Bridged USDC",
31+
"decimals": 6,
32+
"logoURI": "https://raw.githubusercontent.com/sushiswap/list/master/logos/token-logos/token/usdc.jpg",
33+
"tags": ["stablecoin", "bridged"]
34+
},
35+
{
36+
"chainId": 137,
37+
"address": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
38+
"symbol": "USDC",
39+
"name": "USD Coin",
40+
"decimals": 6,
41+
"logoURI": "https://raw.githubusercontent.com/sushiswap/list/master/logos/token-logos/token/usdc.jpg",
42+
"tags": ["stablecoin"]
43+
},
44+
{
45+
"chainId": 137,
46+
"address": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
47+
"symbol": "USDT",
48+
"name": "(PoS) Tether USD",
49+
"decimals": 6,
50+
"logoURI": "https://raw.githubusercontent.com/sushiswap/list/master/logos/token-logos/token/usdt.jpg",
51+
"tags": ["stablecoin", "bridged"]
52+
},
53+
{
54+
"chainId": 137,
55+
"address": "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063",
56+
"symbol": "DAI",
57+
"name": "Dai Stablecoin",
58+
"decimals": 18,
59+
"logoURI": "https://raw.githubusercontent.com/sushiswap/list/master/logos/token-logos/token/dai.jpg",
60+
"tags": ["stablecoin", "bridged"]
61+
},
62+
{
63+
"chainId": 137,
64+
"address": "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
65+
"symbol": "WMATIC",
66+
"name": "Wrapped Matic",
67+
"decimals": 18,
68+
"logoURI": "https://raw.githubusercontent.com/sushiswap/list/master/logos/token-logos/token/polygon.jpg"
69+
},
70+
{
71+
"chainId": 137,
72+
"address": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
73+
"symbol": "WETH",
74+
"name": "Wrapped Ether",
75+
"decimals": 18,
76+
"logoURI": "https://raw.githubusercontent.com/sushiswap/list/master/logos/token-logos/token/eth.jpg",
77+
"tags": ["bridged"]
78+
},
79+
{
80+
"chainId": 137,
81+
"address": "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6",
82+
"symbol": "WBTC",
83+
"name": "(PoS) Wrapped BTC",
84+
"decimals": 8,
85+
"logoURI": "https://raw.githubusercontent.com/sushiswap/list/master/logos/token-logos/token/btc.jpg",
86+
"tags": ["bridged"]
87+
},
88+
{
89+
"chainId": 137,
90+
"address": "0x48469a0481254d5945e7e56c1eb9861429c02f44",
91+
"symbol": "PROFIT",
92+
"name": "Stability",
93+
"decimals": 18,
94+
"logoURI": "https://stabilitydao.org/profit.png"
95+
},
96+
{
97+
"chainId": 137,
98+
"address": "0x9844a1c30462b55cd383a2c06f90bb4171f9d4bb",
99+
"symbol": "SDIV",
100+
"name": "Stability Dividend",
101+
"decimals": 18,
102+
"logoURI": "https://stabilitydao.org/SDIV.svg"
103+
},
104+
{
105+
"chainId": 137,
106+
"address": "0xc4ce1d6f5d98d65ee25cf85e9f2e9dcfee6cb5d6",
107+
"symbol": "crvUSD",
108+
"name": "Curve.Fi USD",
109+
"decimals": 18,
110+
"logoURI": "https://polygonscan.com/token/images/crvusd_32.png",
111+
"tags": ["stablecoin", "bridged"]
112+
},
113+
{
114+
"chainId": 8453,
115+
"address": "0x4200000000000000000000000000000000000006",
116+
"symbol": "WETH",
117+
"name": "Wrapped Ether",
118+
"decimals": 18,
119+
"logoURI": "https://raw.githubusercontent.com/sushiswap/list/master/logos/token-logos/token/eth.jpg",
120+
"tags": ["bridged"]
121+
},
122+
{
123+
"chainId": 8453,
124+
"address": "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452",
125+
"symbol": "wstETH",
126+
"name": "Wrapped Liquid Staked Ether 2.0",
127+
"decimals": 18,
128+
"logoURI": "https://raw.githubusercontent.com/sushiswap/list/master/logos/token-logos/token/wsteth.jpg",
129+
"tags": ["lst","bridged"]
130+
},
131+
{
132+
"chainId": 8453,
133+
"address": "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22",
134+
"symbol": "cbETH",
135+
"name": "Coinbase Wrapped Staked ETH",
136+
"decimals": 18,
137+
"logoURI": "https://raw.githubusercontent.com/sushiswap/list/master/logos/token-logos/network/ethereum/0xBe9895146f7AF43049ca1c1AE358B0541Ea49704.jpg",
138+
"tags": ["lst"]
139+
},
140+
{
141+
"chainId": 8453,
142+
"address": "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",
143+
"symbol": "USDT",
144+
"name": "Tether USD",
145+
"decimals": 6,
146+
"logoURI": "https://raw.githubusercontent.com/sushiswap/list/master/logos/token-logos/token/usdt.jpg",
147+
"tags": ["stablecoin"]
148+
},
149+
{
150+
"chainId": 8453,
151+
"address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
152+
"symbol": "USDC",
153+
"name": "USDC",
154+
"decimals": 6,
155+
"logoURI": "https://raw.githubusercontent.com/sushiswap/list/master/logos/token-logos/token/usdc.jpg",
156+
"tags": ["stablecoin"]
157+
},
158+
{
159+
"chainId": 8453,
160+
"address": "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA",
161+
"symbol": "USDbC",
162+
"name": "USD Base Coin",
163+
"decimals": 6,
164+
"logoURI": "https://basescan.org/token/images/usdbc_ofc_32.png",
165+
"tags": ["stablecoin", "bridged"]
166+
}
167+
]
168+
}

src/strategies.ts

+9
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,12 @@ export const getMerklStrategies = (): string[] => {
200200
return strategy.id
201201
})
202202
}
203+
204+
export const getStrategyShortId = (strategyId: string): StrategyShortId|undefined => {
205+
for (const strategyShortId of Object.keys(strategies)) {
206+
if (strategies[strategyShortId as StrategyShortId].id === strategyId) {
207+
return strategyShortId as StrategyShortId;
208+
}
209+
}
210+
return undefined
211+
}

tests/strategies.test.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
import {getMerklStrategies} from "../src/strategies";
1+
import {getMerklStrategies, getStrategyShortId} from "../src/strategies";
2+
import {StrategyShortId} from "../src";
23

34
describe('testing strategies', () => {
5+
test('get merkl strategies', () => {
6+
expect(getStrategyShortId('QuickSwap Static Merkl Farm')).toBe(StrategyShortId.QSMF)
7+
expect(getStrategyShortId('unknown')).toBe(undefined)
8+
})
49
test('get merkl strategies', () => {
510
const merklStrategies = getMerklStrategies();
611
expect(merklStrategies.includes('Gamma UniswapV3 Merkl Farm')).toBe(true);

tools/overview-full.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import {deployments, integrations, IntegrationStatus, networks, strategies, StrategyShortId} from "../src";
22
import {Table} from "console-table-printer";
33
import {version} from '../package.json';
4-
import ansis, {red, green, cyan, black, ansi256, hex, bold, rgb} from 'ansis';
4+
import {hex, bold} from 'ansis';
55
import {getIntegrationStatus} from "../src/integrations";
6+
import tokenlist from '../src/stability.tokenlist.json'
67

78
console.log(bold`== Stability Integration Library v${version} ==`)
89
console.log('')
@@ -16,7 +17,7 @@ console.log(`${Object.keys(networks).map(n => `${networks[n].id} [${n}]`).join('
1617
console.log('')
1718
// @ts-ignore
1819
console.log(bold`=== Strategies: ${Object.keys(strategies).length} ===`)
19-
for (let strategyShortId in StrategyShortId) {
20+
for (const strategyShortId of Object.keys(strategies)) {
2021
// @ts-ignore
2122
console.log(hex(strategies[strategyShortId].color).bgHex(strategies[strategyShortId].bgColor).bold`[${strategies[strategyShortId].state}] ${strategyShortId} | ${strategies[strategyShortId].id}`)
2223
}
@@ -65,4 +66,9 @@ for (const defiOrgCode of Object.keys(integrations)) {
6566
// @ts-ignore
6667
console.log(bold`=== DeFi protocols: ${protocolsTotal} ===`)
6768
table.printTable();
69+
console.log('')
6870

71+
// @ts-ignore
72+
console.log(bold`=== Tokenlist ${tokenlist.version.major}.${tokenlist.version.minor}.${tokenlist.version.patch}: ${tokenlist.tokens.length} tokens for ${tokenlist.tokens.map(t => t.chainId).filter((value, index, array) => array.indexOf(value) === index).length} networks ===`)
73+
console.log(`${tokenlist.tokens.map(t => `${t.symbol} [${t.chainId}]`).join(', ')}`)
74+
console.log('')

tools/overview.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {integrations, networks, strategies, deployments} from "../src";
22
import {version} from '../package.json';
3+
import tokenlist from '../src/stability.tokenlist.json'
34

45
console.log(`== Stability Integration Library v${version} ==`)
56
console.log(`Deployments: ${Object.keys(deployments).length}`)
@@ -10,3 +11,4 @@ for (const defiOrgCode of Object.keys(integrations)) {
1011
protocolsTotal += Object.keys(integrations[defiOrgCode].protocols).length
1112
}
1213
console.log(`DeFi protocols: ${protocolsTotal}`)
14+
console.log(`Tokenlist ${tokenlist.version.major}.${tokenlist.version.minor}.${tokenlist.version.patch}: ${tokenlist.tokens.length} tokens for ${tokenlist.tokens.map(t => t.chainId).filter((value, index, array) => array.indexOf(value) === index).length} networks.`)

yarn.lock

+36-2
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ get-stream@^6.0.0:
11671167
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7"
11681168
integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==
11691169

1170-
glob@^7.1.3, glob@^7.1.4:
1170+
glob@^7.0.0, glob@^7.1.3, glob@^7.1.4:
11711171
version "7.2.3"
11721172
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b"
11731173
integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==
@@ -1242,6 +1242,11 @@ inherits@2:
12421242
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
12431243
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
12441244

1245+
interpret@^1.0.0:
1246+
version "1.4.0"
1247+
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e"
1248+
integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==
1249+
12451250
is-arrayish@^0.2.1:
12461251
version "0.2.1"
12471252
resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"
@@ -1796,6 +1801,11 @@ minimatch@^3.0.4, minimatch@^3.1.1:
17961801
dependencies:
17971802
brace-expansion "^1.1.7"
17981803

1804+
minimist@^1.2.3:
1805+
version "1.2.8"
1806+
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
1807+
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
1808+
17991809
ms@2.1.2:
18001810
version "2.1.2"
18011811
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
@@ -1947,6 +1957,13 @@ react-is@^18.0.0:
19471957
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e"
19481958
integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==
19491959

1960+
rechoir@^0.6.2:
1961+
version "0.6.2"
1962+
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
1963+
integrity sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==
1964+
dependencies:
1965+
resolve "^1.1.6"
1966+
19501967
require-directory@^2.1.1:
19511968
version "2.1.1"
19521969
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
@@ -1969,7 +1986,7 @@ resolve.exports@^2.0.0:
19691986
resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.2.tgz#f8c934b8e6a13f539e38b7098e2e36134f01e800"
19701987
integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==
19711988

1972-
resolve@^1.20.0:
1989+
resolve@^1.1.6, resolve@^1.20.0:
19731990
version "1.22.8"
19741991
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d"
19751992
integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==
@@ -2000,6 +2017,23 @@ shebang-regex@^3.0.0:
20002017
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
20012018
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
20022019

2020+
shelljs@^0.8.5:
2021+
version "0.8.5"
2022+
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c"
2023+
integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==
2024+
dependencies:
2025+
glob "^7.0.0"
2026+
interpret "^1.0.0"
2027+
rechoir "^0.6.2"
2028+
2029+
shx@^0.3.4:
2030+
version "0.3.4"
2031+
resolved "https://registry.yarnpkg.com/shx/-/shx-0.3.4.tgz#74289230b4b663979167f94e1935901406e40f02"
2032+
integrity sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g==
2033+
dependencies:
2034+
minimist "^1.2.3"
2035+
shelljs "^0.8.5"
2036+
20032037
signal-exit@^3.0.3, signal-exit@^3.0.7:
20042038
version "3.0.7"
20052039
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"

0 commit comments

Comments
 (0)