Skip to content

Commit

Permalink
Merge pull request #215 from stabilitydao/dev
Browse files Browse the repository at this point in the history
📦 0.30.0 collector
  • Loading branch information
a17 authored Feb 16, 2025
2 parents 1e2a160 + 695899e commit 036706e
Show file tree
Hide file tree
Showing 12 changed files with 478 additions and 7 deletions.
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,17 @@ Asset addresses, description, website, color.
#### Types

- `Asset`
- `TokenData`

#### Constants

- `assets: Asset[]`
- `sonicWhitelistedAssets: { [addrLc: 0x${string}]: number; }`

#### Methods

- `getAsset(chainId: string, tokenAddress: 0x${string}): Asset|undefined`
- `getTokenData(address: 0x${string}): TokenData|undefined`

</details>

Expand Down Expand Up @@ -252,13 +255,30 @@ import { tokenlist } from "@stabilitydao/stability";

#### Constants

- `assetOracles: {[chainId: string]: { [assetAddress: `0x${string}`]: AssetOracle }; }`
- `vaultOracles: {[chainId: string]: { [vaultAddress: `0x${string}`]: `0x${string}` }; }`
- `assetOracles: {[chainId: string]: { [assetAddress: 0x${string}]: AssetOracle }; }`
- `vaultOracles: {[chainId: string]: { [vaultAddress: 0x${string}]: 0x${string} }; }`

</details>

### 🚦 Risk

<details>
<summary>what is included</summary>

#### Types

- `IlDetails`

#### Methods

- `getIL = (strategyShortId: StrategyShortId, specific: string, assets: 0x${string}[]): IlDetails | undefined`

</details>

## 👷 Develop

### How to

```shell
yarn overview
yarn overview-full
Expand All @@ -271,8 +291,23 @@ yarn prettier . --check
yarn prettier . --write
```

### Branch structure

| Branch | Description |
| ------------- | -------------------------------------- |
| main | Production. Accepts only PRs from dev. |
| dev | Accumulator of changes for the release |
| developer-dev | Developer's changes |

### Commit/PR prefix

| Changes | Prefix |
| ------------------ | ------ |
| Collector | 📦 |
| Assets, tokenlist | 🪙 |
| Sync state, etc | ♻️️ |
| Content generators | 🎇 |
| Bridge | 🌉 |
| Risk | 🚦 |
| Prettier | #️⃣ |
| Docs | 📙 |
Binary file modified chains.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified integrations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stabilitydao/stability",
"version": "0.29.3",
"version": "0.30.0",
"description": "Stability Integration Library",
"main": "out/index.js",
"types": "out/index.d.ts",
Expand Down
69 changes: 69 additions & 0 deletions src/assets.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { tokenlist } from "./index";

export type Asset = {
addresses: { [chainId: string]: `0x${string}` | `0x${string}`[] };
symbol: string;
Expand All @@ -6,6 +8,16 @@ export type Asset = {
color: string;
};

export type TokenData = {
address: `0x${string}`;
name: string;
symbol: string;
chainId: number;
decimals: number;
logoURI: string;
tags?: string[];
};

export const assets: Asset[] = [
{
addresses: {
Expand Down Expand Up @@ -573,6 +585,25 @@ export const assets: Asset[] = [
},
];

export const sonicWhitelistedAssets: {
[addrLc: `0x${string}`]: number;
} = {
// scUSD, stkscUSD: 6x (Boosted)
["0xd3DCe716f3eF535C5Ff8d041c1A41C3bd89b97aE".toLowerCase()]: 6,
// USDC.e: 5x (Boosted)
["0x29219dd400f2Bf60E5a23d13Be72B486D4038894".toLowerCase()]: 5,
// scETH, stkscETH: 4x (Boosted)
["0x3bcE5CB273F0F148010BbEa2470e7b5df84C7812".toLowerCase()]: 4,
// s, wS, stS, OS, wOS: 4x (Boosted)
["0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38".toLowerCase()]: 4,
["0xE5DA20F15420aD15DE0fa650600aFc998bbE3955".toLowerCase()]: 4,
["0xb1e25689D55734FD3ffFc939c4C3Eb52DFf8A794".toLowerCase()]: 4,
["0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38".toLowerCase()]: 4,
// ONE, WETH: 2x (Boosted)
["0x50c42dEAcD8Fc9773493ED674b675bE577f2634b".toLowerCase()]: 2,
// SolvBTC and SolvBTC.BBN: 2x (Boosted)
};

export const getAsset = (
chainId: string,
tokenAddress: `0x${string}`,
Expand All @@ -595,3 +626,41 @@ export const getAsset = (
}
return undefined;
};

/**
* Function to get token data from token list
*
* @example
*
* ```
* getTokenData("0x2791bca1f2de4661ed88a30c99a7a9449aa84174")
* ```
*
* @param address - Token address
*
* @returns {Object} Token Information
* @property {`0x${string}`} address - Token contract address
* @property {number} chainId - ID of the blockchain network (e.g., 137 for Polygon)
* @property {number} decimals - Number of decimals the token uses
* @property {string} name - Full name of the token (e.g., "Dai Stablecoin").
* @property {string} symbol - Token ticker symbol (e.g., "DAI").
* @property {string} logoURI - URL of the token's logo image.
* @property {string[]} tags - Array of tags related to the token (e.g., ["stablecoin", "DeFi"]).
*
**/
export const getTokenData = (address: `0x${string}`): TokenData | undefined => {
for (const token of tokenlist.tokens) {
if (token.address.toLowerCase() === address.toLowerCase()) {
return {
address: token.address.toLowerCase() as `0x${string}`,
chainId: token.chainId,
decimals: token.decimals,
name: token.name,
symbol: token.symbol,
logoURI: token.logoURI,
tags: token?.tags,
};
}
}
return undefined;
};
40 changes: 40 additions & 0 deletions src/bridges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const enum BridgeName {
BITTORRENT = "BitTorrent Bridge",
KROMA = "Kroma Bridge",
ROLLUX = "Rollux Bridge",
RHINO = "Rhino",
//todo
// WEMIX = "Block Producer Network(BPN)", | Native bridge suspended/maintenance? wemix classic/multichain bridge?
// HEDERA = "??", | No native bridge
Expand All @@ -38,6 +39,7 @@ export const enum BridgeName {
MODE = "Mode App",
MANTLE = "Mantle Bridge",
REAL = "Re.al Bridge",
SONIC = "Sonic Gateway",
}

export const bridges: Bridge[] = [
Expand Down Expand Up @@ -203,6 +205,38 @@ export const bridges: Bridge[] = [
// alienxchain
],
},
{
name: BridgeName.RHINO,
dapp: "https://app.rhino.fi/",
img: "assets/rhino.webp",
chains: [
ChainName.ETHEREUM,
ChainName.SONIC,
ChainName.BASE,
ChainName.ARBITRUM,
ChainName.BSC,
ChainName.POLYGON,
ChainName.AVALANCHE,
// berachain
ChainName.LINEA,
ChainName.MANTA,
ChainName.MANTLE,
ChainName.MODE,
ChainName.OPTIMISM,
ChainName.SCROLL,
// soneium
// story
ChainName.TAIKO,
ChainName.POLYGON_ZKEVM,
ChainName.ZKSYNC,
// abstract
ChainName.BLAST,
// ink
ChainName.OPBNB,
// plume
// unichain
],
},

// official, native multi
{
Expand Down Expand Up @@ -427,6 +461,12 @@ export const bridges: Bridge[] = [
ChainName.POLYGON,
],
},
{
name: BridgeName.SONIC,
dapp: "https://gateway.soniclabs.com/",
img: `chains/${chains["146"].img}`,
chains: [ChainName.SONIC, ChainName.ETHEREUM],
},
];

export const getChainBridges = (chainName: ChainName): Bridge[] => {
Expand Down
15 changes: 14 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ import {
} from "./api.types";
import tokenlist from "./stability.tokenlist.json";
import { almFactories } from "./addresses";
import { assets, Asset, getAsset } from "./assets";
import {
assets,
Asset,
TokenData,
getAsset,
getTokenData,
sonicWhitelistedAssets,
} from "./assets";
import { seeds } from "./seeds";
import { bridges, Bridge, BridgeName, getChainBridges } from "./bridges";
import {
Expand All @@ -54,6 +61,7 @@ import {
getContestReward,
} from "./contests";
import { AssetOracle, assetOracles, vaultOracles } from "./oracles";
import { IlDetails, getIL } from "./risk";

export {
deployments,
Expand Down Expand Up @@ -110,4 +118,9 @@ export {
getALMStrategies,
getContestReward,
getContestGemsReward,
getTokenData,
TokenData,
sonicWhitelistedAssets,
getIL,
IlDetails,
};
2 changes: 1 addition & 1 deletion src/integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ export const integrations: { [org: string]: DeFiOrganization } = {
name: "Silo V2",
category: DefiCategory.LENDING,
chains: [ChainName.ARBITRUM, ChainName.SONIC],
strategies: [StrategyShortId.SiF],
strategies: [StrategyShortId.SiF, StrategyShortId.SiL],
},
},
defiLlama: "silo-finance",
Expand Down
Loading

0 comments on commit 036706e

Please sign in to comment.