Skip to content

Commit

Permalink
add getStrategyShortId
Browse files Browse the repository at this point in the history
  • Loading branch information
a17 committed Jun 11, 2024
1 parent 49fd3d1 commit 88eb913
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ console.log('Platform address on Polygon', deployments["137"].platform)

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

#### Methods

* `getMerklStrategies()`
* `getStrategyShortId(id: string): StrategyShortId|undefined`

### Networks

Blockchains known to the platform and their integration statuses.
Expand All @@ -34,6 +39,10 @@ Blockchains known to the platform and their integration statuses.

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

#### Methods

* `getIntegrationStatus(p: DeFiProtocol): IntegrationStatus`

## Develop

```shell
Expand Down
9 changes: 9 additions & 0 deletions src/strategies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,12 @@ export const getMerklStrategies = (): string[] => {
return strategy.id
})
}

export const getStrategyShortId = (strategyId: string): StrategyShortId|undefined => {
for (const strategyShortId of Object.keys(strategies)) {
if (strategies[strategyShortId as StrategyShortId].id === strategyId) {
return strategyShortId as StrategyShortId;
}
}
return undefined
}
7 changes: 6 additions & 1 deletion tests/strategies.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import {getMerklStrategies} from "../src/strategies";
import {getMerklStrategies, getStrategyShortId} from "../src/strategies";
import {StrategyShortId} from "../src";

describe('testing strategies', () => {
test('get merkl strategies', () => {
expect(getStrategyShortId('QuickSwap Static Merkl Farm')).toBe(StrategyShortId.QSMF)
expect(getStrategyShortId('unknown')).toBe(undefined)
})
test('get merkl strategies', () => {
const merklStrategies = getMerklStrategies();
expect(merklStrategies.includes('Gamma UniswapV3 Merkl Farm')).toBe(true);
Expand Down

0 comments on commit 88eb913

Please sign in to comment.