Skip to content

Commit 3cedbc8

Browse files
authored
Merge pull request #7 from stabilitydao/dev
0.6.2
2 parents 473ba77 + 5d128e9 commit 3cedbc8

10 files changed

+117
-39
lines changed

README.md

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# Stability Integration Library
22

3-
[![GitHub version](https://badge.fury.io/gh/stabilitydao%2Fstability.svg)](https://badge.fury.io/gh/stabilitydao%2Fstability)
4-
[![npm version](https://badge.fury.io/js/@stabilitydao%2Fstability.svg)](https://badge.fury.io/js/@stabilitydao%2Fstability)
3+
![GitHub package.json version](https://img.shields.io/github/package-json/v/stabilitydao/stability)
4+
![NPM Version](https://img.shields.io/npm/v/%40stabilitydao%2Fstability?label=NPM%20version)
5+
![GitHub Tag](https://img.shields.io/github/v/tag/stabilitydao/stability)
6+
7+
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/stabilitydao/stability?label=code%20size)
8+
![npm bundle size](https://img.shields.io/bundlephobia/min/%40stabilitydao%2Fstability?label=NPM%20bundle%20size)
9+
![NPM Unpacked Size](https://img.shields.io/npm/unpacked-size/%40stabilitydao%2Fstability?label=NPM%20unpacked%20size)
10+
511
[![codecov](https://codecov.io/github/stabilitydao/stability/graph/badge.svg?token=V0JV1WOGMM)](https://codecov.io/github/stabilitydao/stability)
612

7-
This is library for integrating the platform into Node.js applications.
13+
This is library for integrating Stability Platform into Node.js applications.
814

915
## Usage
1016

@@ -46,7 +52,9 @@ DeFi organizations, protocols, their integration statuses, usage and other infor
4652

4753
### Tokenlist
4854

49-
`stability.tokenlist.json`
55+
```typescript
56+
import {tokenlist} from '@stabilitydao/stability'
57+
```
5058

5159
### API types
5260

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stabilitydao/stability",
3-
"version": "0.6.1",
3+
"version": "0.6.2",
44
"description": "Stability Integration Library",
55
"main": "out/index.js",
66
"types": "out/index.d.ts",

src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {deployments, CoreContracts} from "./deployments";
2-
import {networks, NetworkId, Network} from "./networks";
2+
import {networks, NetworkId, Network, getSupportedNetworkIds} from "./networks";
33
import {
44
strategies,
55
StrategyShortId,
@@ -42,4 +42,5 @@ export {
4242
getMerklStrategies,
4343
getStrategyShortId,
4444
getIntegrationStatus,
45+
getSupportedNetworkIds,
4546
}

src/integrations.ts

+48-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {strategies, StrategyShortId, StrategyState} from "./strategies";
2-
import {NetworkId, networks} from "./networks";
3-
import {deployments} from "./deployments";
2+
import {getSupportedNetworkIds, NetworkId} from "./networks";
43

54
export type DeFiOrganization = {
65
name: string
@@ -170,7 +169,7 @@ export const integrations: { [org: string]: DeFiOrganization } = {
170169
NetworkId.BLAST,
171170
],
172171
adapters: ['UniswapV3Adapter'],
173-
strategies: [StrategyShortId.CUMF,StrategyShortId.GUMF,]
172+
strategies: [StrategyShortId.CUMF, StrategyShortId.GUMF,]
174173
},
175174
},
176175
defiLlama: 'uniswap',
@@ -281,6 +280,20 @@ export const integrations: { [org: string]: DeFiOrganization } = {
281280
},
282281
defiLlama: 'baseswap',
283282
},
283+
agni: {
284+
name: 'Agni',
285+
website: 'https://agni.finance/',
286+
protocols: {
287+
agni: {
288+
name: 'Agni',
289+
category: DefiCategory.AMM,
290+
networks: [NetworkId.MANTLE,],
291+
adapters: ['UniswapV3Adapter',],
292+
},
293+
},
294+
defiLlama: 'agni-finance',
295+
github: 'agni-protocol',
296+
},
284297
// ALM
285298
gamma: {
286299
name: 'Gamma',
@@ -443,6 +456,32 @@ export const integrations: { [org: string]: DeFiOrganization } = {
443456
defiLlama: 'a51-finance',
444457
github: 'a51finance',
445458
},
459+
skatefi: {
460+
name: 'SkateFi',
461+
website: 'https://www.rangeprotocol.com',
462+
protocols: {
463+
range: {
464+
name: 'Range',
465+
category: DefiCategory.ALM,
466+
networks: [
467+
NetworkId.ETHEREUM,
468+
NetworkId.BSC,
469+
NetworkId.ARBITRUM,
470+
NetworkId.POLYGON,
471+
NetworkId.MANTLE,
472+
NetworkId.BASE,
473+
NetworkId.MANTA,
474+
NetworkId.SCROLL,
475+
NetworkId.BLAST,
476+
NetworkId.ZETA,
477+
NetworkId.ZKFAIR,
478+
NetworkId.MERLIN,
479+
],
480+
},
481+
},
482+
defiLlama: 'skate-fi',
483+
github: 'Range-Protocol',
484+
},
446485
// Lending
447486
compound: {
448487
name: 'Compound',
@@ -609,11 +648,13 @@ export const integrations: { [org: string]: DeFiOrganization } = {
609648
};
610649

611650
export const getIntegrationStatus = (p: DeFiProtocol): IntegrationStatus => {
651+
const supportedNetWorkIds = getSupportedNetworkIds()
652+
const isSupportedNetwork = p.networks.some(r => supportedNetWorkIds.includes(r))
612653
if (p.coreContracts && p.coreContracts.length > 0) {
613-
return IntegrationStatus.LIVE
654+
return isSupportedNetwork ? IntegrationStatus.LIVE : IntegrationStatus.PROPOSED
614655
}
615656
if (p.adapters && p.adapters.length > 0) {
616-
return IntegrationStatus.LIVE
657+
return isSupportedNetwork ? IntegrationStatus.LIVE : IntegrationStatus.PROPOSED
617658
}
618659
if (p.strategies) {
619660
for (const strategy of p.strategies) {
@@ -647,11 +688,6 @@ export const getIntegrationStatus = (p: DeFiProtocol): IntegrationStatus => {
647688
}
648689
}
649690
}
650-
const supportedNetWorkIds = Object.keys(deployments).map(chainIdString => networks[chainIdString].id)
651-
for (const protocolNetworkId of p.networks) {
652-
if (supportedNetWorkIds.includes(protocolNetworkId as NetworkId)) {
653-
return IntegrationStatus.POSSIBLE
654-
}
655-
}
656-
return IntegrationStatus.PROPOSED
691+
692+
return isSupportedNetwork ? IntegrationStatus.POSSIBLE : IntegrationStatus.PROPOSED
657693
}

src/networks.ts

+28-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import {IntegrationStatus} from "./integrations";
2+
import {deployments} from "./deployments";
23

34
export type Network = {
45
id: NetworkId,
5-
chainId: number|string,
6+
chainId: number | string,
67
status: IntegrationStatus,
78
}
89

@@ -24,6 +25,7 @@ export const enum NetworkId {
2425
POLYGON_ZKEVM = 'Polygon zkEVM',
2526
IMMUTABLE_ZKEVM = 'Immutable zkEVM',
2627
ASTAR_ZKEVM = 'Astar zkEVM',
28+
ZKFAIR = 'ZKFair',
2729
SCROLL = 'Scroll',
2830
ZKSYNC = 'zkSync',
2931
BLAST = 'Blast',
@@ -40,9 +42,11 @@ export const enum NetworkId {
4042
ROLLUX = 'Rollux',
4143
EVMOS = 'Evmos',
4244
TELOS = 'Telos EVM',
45+
ZETA = 'ZetaChain',
46+
MERLIN = 'Merlin',
4347
}
4448

45-
export const networks: {[chainId: string]: Network} = {
49+
export const networks: { [chainId: string]: Network } = {
4650
"1": {
4751
id: NetworkId.ETHEREUM,
4852
chainId: 1,
@@ -113,11 +117,6 @@ export const networks: {[chainId: string]: Network} = {
113117
chainId: 570,
114118
status: IntegrationStatus.PROPOSED,
115119
},
116-
"3776": {
117-
id: NetworkId.ASTAR_ZKEVM,
118-
chainId: 3776,
119-
status: IntegrationStatus.PROPOSED,
120-
},
121120
"1088": {
122121
id: NetworkId.METIS,
123122
chainId: 1088,
@@ -148,11 +147,26 @@ export const networks: {[chainId: string]: Network} = {
148147
chainId: 2222,
149148
status: IntegrationStatus.PROPOSED,
150149
},
150+
"3776": {
151+
id: NetworkId.ASTAR_ZKEVM,
152+
chainId: 3776,
153+
status: IntegrationStatus.PROPOSED,
154+
},
155+
"4200": {
156+
id: NetworkId.MERLIN,
157+
chainId: 4200,
158+
status: IntegrationStatus.PROPOSED,
159+
},
151160
"5000": {
152161
id: NetworkId.MANTLE,
153162
chainId: 5000,
154163
status: IntegrationStatus.PROPOSED,
155164
},
165+
"7000": {
166+
id: NetworkId.ZETA,
167+
chainId: 7000,
168+
status: IntegrationStatus.PROPOSED,
169+
},
156170
"8217": {
157171
id: NetworkId.KLAYTN,
158172
chainId: 8217,
@@ -188,6 +202,11 @@ export const networks: {[chainId: string]: Network} = {
188202
chainId: 42220,
189203
status: IntegrationStatus.PROPOSED,
190204
},
205+
"42766": {
206+
id: NetworkId.ZKFAIR,
207+
chainId: 42766,
208+
status: IntegrationStatus.PROPOSED,
209+
},
191210
"43114": {
192211
id: NetworkId.AVALANCHE,
193212
chainId: 43114,
@@ -209,3 +228,5 @@ export const networks: {[chainId: string]: Network} = {
209228
status: IntegrationStatus.PROPOSED,
210229
},
211230
}
231+
232+
export const getSupportedNetworkIds = () => Object.keys(deployments).map(chainId => networks[chainId].id)

src/strategies.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export const strategies: {[shortId in StrategyShortId]:Strategy} = {
162162
[StrategyShortId.GUMF]: {
163163
id: 'Gamma UniswapV3 Merkl Farm',
164164
shortId: StrategyShortId.GUMF,
165-
state: StrategyState.PROPOSED,
165+
state: StrategyState.LIVE,
166166
contractGithubId: 145,
167167
color: "#ff0000",
168168
bgColor: "#000000",

tests/integrations.test.ts

+7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@ describe('testing integrations', () => {
1616
protocol.coreContracts = undefined
1717
protocol.adapters = ['TestAdapter',]
1818
expect(getIntegrationStatus(protocol)).toBe(IntegrationStatus.LIVE)
19+
20+
protocol.networks = [NetworkId.EVMOS,]
21+
expect(getIntegrationStatus(protocol)).toBe(IntegrationStatus.PROPOSED)
1922
protocol.adapters = undefined
23+
protocol.coreContracts = ['PriceReader',]
24+
expect(getIntegrationStatus(protocol)).toBe(IntegrationStatus.PROPOSED)
25+
protocol.coreContracts = undefined
26+
2027
protocol.strategies = [StrategyShortId.IQMF,]
2128
expect(getIntegrationStatus(protocol)).toBe(IntegrationStatus.LIVE)
2229
strategies[StrategyShortId.IQMF].state = StrategyState.AWAITING_DEPLOYMENT

tests/networks.test.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {getSupportedNetworkIds} from "../src";
2+
3+
describe('testing networks', () => {
4+
test('get supported network IDs', () => {
5+
expect(getSupportedNetworkIds().length).toBeGreaterThan(1)
6+
})
7+
})

tools/overview-full.ts

+8-10
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ console.log(bold`=== Networks: ${Object.keys(networks).length} ===`)
1616
console.log(`${Object.keys(networks).map(n => `${networks[n].id} [${n}]`).join(', ')}`)
1717
console.log('')
1818
// @ts-ignore
19+
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 ===`)
20+
console.log(`${tokenlist.tokens.map(t => `[${t.chainId}] ${t.symbol}`).join(', ')}`)
21+
console.log('')
22+
// @ts-ignore
23+
console.log(bold`=== Subgraph endpoints: ${Object.keys(subgraphs).length} ===`)
24+
console.log(`${Object.keys(subgraphs).map(chainId => `[${chainId}] ${subgraphs[chainId]}`).join("\n")}`)
25+
console.log('')
26+
// @ts-ignore
1927
console.log(bold`=== Strategies: ${Object.keys(strategies).length} ===`)
2028
for (const strategyShortId of Object.keys(strategies)) {
2129
// @ts-ignore
@@ -67,13 +75,3 @@ for (const defiOrgCode of Object.keys(integrations)) {
6775
console.log(bold`=== DeFi protocols: ${protocolsTotal} ===`)
6876
table.printTable();
6977
console.log('')
70-
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.chainId}] ${t.symbol}`).join(', ')}`)
74-
console.log('')
75-
76-
// @ts-ignore
77-
console.log(bold`=== Subgraph endpoints: ${Object.keys(subgraphs).length} ===`)
78-
console.log(`${Object.keys(subgraphs).map(chainId => `[${chainId}] ${subgraphs[chainId]}`).join("\n")}`)
79-
console.log('')

tools/overview.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import tokenlist from '../src/stability.tokenlist.json'
44

55
console.log(`== Stability Integration Library v${version} ==`)
66
console.log(`Deployments: ${Object.keys(deployments).length}`)
7-
console.log(`Strategies: ${Object.keys(strategies).length}`)
87
console.log(`Networks: ${Object.keys(networks).length}`)
8+
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.`)
9+
console.log(`Subgraph endpoints: ${Object.keys(subgraphs).length}`)
10+
console.log(`Strategies: ${Object.keys(strategies).length}`)
911
let protocolsTotal = 0
1012
for (const defiOrgCode of Object.keys(integrations)) {
1113
protocolsTotal += Object.keys(integrations[defiOrgCode].protocols).length
1214
}
1315
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.`)
15-
console.log(`Subgraph endpoints: ${Object.keys(subgraphs).length}`)

0 commit comments

Comments
 (0)