From dd0a6c239908faf768a4822635847d53e2176a26 Mon Sep 17 00:00:00 2001 From: thanhpn Date: Thu, 9 Jan 2025 16:04:07 +0700 Subject: [PATCH 1/6] Add config for nitron native apr --- .github/markets/pr_template.md | 8 +++++++ README.md | 1 + config.schema.json | 26 +++++++++++++++++++++ configs/mainnet.json | 41 +++++++++++++++++++++++++++++++++- 4 files changed, 75 insertions(+), 1 deletion(-) diff --git a/.github/markets/pr_template.md b/.github/markets/pr_template.md index 8db1a39..7312f35 100644 --- a/.github/markets/pr_template.md +++ b/.github/markets/pr_template.md @@ -30,6 +30,7 @@ Each json file under the [configs](../../configs) folder correspond to their res |`quick_select_tokens` |`QuickSelectToken[]` |true |List of quick select tokens for deposit and withdrawal forms. | |`disabled_transfer_banner_config` |`DisabledTransferBannerConfig` |false |Config parameters for displaying banner to inform users that transfers for the relevant tokens are disabled | |`trading_leagues` |`TradingLeague[]` |false |Map of trading league config with their path. | +|`nitron_native_aprs` |`NitronNativeAPR[]` |true |List of Nitron native APR APIs. | ## Maintenance Data Structure |Field |Type |Required |Description |Notes | @@ -147,3 +148,10 @@ Each json file under the [configs](../../configs) folder correspond to their res |`trading_league` |`string` |true |The trading league name | |`trading_league_title` |`string` |true |The trading league title | +## NitronNativeAPR Data Structure +|Field |Type |Required |Description |Notes | +|---|---|---|---|---| +|`protocol` |`string` |true |The protocol name | +|`api_url` |`string` |true |The API URL for fetch APR info | +|`reward_denom` |`object` |true |The key value object for mapping symbol and denom | + diff --git a/README.md b/README.md index 5913721..fcf15ba 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Currently, each JSON file contain the following data on its corresponding networ - map of IBC channels for external IBC chains (such as Osmosis, Noble, etc.) - information about IBC tokens that are not added on chain or require packet forwarding - default quick select tokens in deposit/withdrawal forms +- Nitron Native APR API config for get APR show on Nitron markets Additionally, the JSON file for mainnet contains the following data to support ongoing campaigns/promotions: - demex points config diff --git a/config.schema.json b/config.schema.json index 2b6c97d..711d29a 100644 --- a/config.schema.json +++ b/config.schema.json @@ -632,6 +632,32 @@ "items": { "$ref": "#/$defs/trading_league" } + }, + "nitron_native_apr": { + "type": "object", + "description": "API for query native APR on Nitron", + "required": ["label_denom", "target_denom"], + "properties": { + "protocol": { + "type": "string", + "description": "Protocol name" + }, + "api_url": { + "type": "string", + "description": "API URL" + }, + "reward_denom": { + "type": "string", + "description": "Reward denom map" + } + } + }, + "nitron_native_aprs": { + "type": "array", + "description": "List of APIs for native APR on Nitron", + "items": { + "$ref": "#/$defs/nitron_native_apr" + } } } } \ No newline at end of file diff --git a/configs/mainnet.json b/configs/mainnet.json index e4def39..d7841e4 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -504,5 +504,44 @@ "trading_league": "Base", "trading_league_title": "Base Trading League" } - } + }, + "nitron_native_aprs": [ + { + "protocol": "Drop", + "api_url": "https://app.drop.money/api/apy", + "reward_denom": { + "dATOM": "ibc/EF37C83E78BD1F9B2401B3B3E5C00E0DBA71A648E2A8C3018861786F7A5F0105" + } + }, + { + "protocol": "Stride", + "api_url": "https://edge.stride.zone/api/stake-stats", + "reward_denom": { + "ATOM": "ibc/A4DB47A9D3CF9A068D454513891B526702455D3EF08FB9EB558C561F9DC2B701", + "OSMO": "ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518", + "STARS": "ibc/C688EBE80ECC20865331A18D8D19654754F6B189977715FED00FBA2BE41F144F", + "LUNA": "ibc/2B58B8C147E8718EECCB3713271DF46DEE8A3A00A27242628604E31C2F370EF5", + "EVMOS": "ibc/35E771B8682D828173F4B795F6C307780F96DC64D6F914FAE4CC9B4666F66364", + "INJ": "ibc/CAF0C63018C2E96F320D448C1F0A1951D77C4F385D802B700CDF7DD2D5B66FD0", + "DYDX": "ibc/9DC57FF60E125F9B976EB0DF4F2122C580AD1DB8E27BA71E6D2C1AA56A5FD312", + "TIA": "ibc/2F6C349F0EB135C5FA99301758F35B87DB88403D690E5E314AB080401FEE4066E5", + "DYM": "ibc/2F50345B6B85884DC41E831047EEE01805B289171DBF105AB3EA42BCC72B3926CC", + "SAGA": "ibc/2F50345B6B85884DC41E831047EEE01805B289171DBF105AB3EA42BCC72B3926CC" + } + }, + { + "protocol": "Lido", + "api_url": "https://eth-api.lido.fi/v1/protocol/steth/apr/sma", + "reward_denom": { + "wstETH": "brdg/6901fa9eb45ef8351c0ab9e29fa45da3bb0538bfbc5a84ad1009e3544346d2c8" + } + }, + { + "protocol": "MilkyWay", + "api_url": "https://apis.milkyway.zone/v2/protocols/osmosis.milkTIA", + "reward_denom": { + "milkTIA": "ibc/16065EE5282C5217685C8F084FC44864C25C706AC37356B0D62811D50B96920F" + } + } + ] } From a2fb8a7e7a894444de3bdf2569439ef12575ed20 Mon Sep 17 00:00:00 2001 From: thanhpn Date: Tue, 21 Jan 2025 10:41:20 +0700 Subject: [PATCH 2/6] Address reviewer comments --- .github/markets/pr_template.md | 8 ++++---- README.md | 2 +- config.schema.json | 10 +++++----- configs/mainnet.json | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/markets/pr_template.md b/.github/markets/pr_template.md index 7312f35..cba3fc0 100644 --- a/.github/markets/pr_template.md +++ b/.github/markets/pr_template.md @@ -30,7 +30,7 @@ Each json file under the [configs](../../configs) folder correspond to their res |`quick_select_tokens` |`QuickSelectToken[]` |true |List of quick select tokens for deposit and withdrawal forms. | |`disabled_transfer_banner_config` |`DisabledTransferBannerConfig` |false |Config parameters for displaying banner to inform users that transfers for the relevant tokens are disabled | |`trading_leagues` |`TradingLeague[]` |false |Map of trading league config with their path. | -|`nitron_native_aprs` |`NitronNativeAPR[]` |true |List of Nitron native APR APIs. | +|`lst_native_aprs` |`LSTNativeAPR[]` |true |List of LST native APR APIs. | ## Maintenance Data Structure |Field |Type |Required |Description |Notes | @@ -148,10 +148,10 @@ Each json file under the [configs](../../configs) folder correspond to their res |`trading_league` |`string` |true |The trading league name | |`trading_league_title` |`string` |true |The trading league title | -## NitronNativeAPR Data Structure +## LSTNativeAPR Data Structure |Field |Type |Required |Description |Notes | |---|---|---|---|---| |`protocol` |`string` |true |The protocol name | -|`api_url` |`string` |true |The API URL for fetch APR info | -|`reward_denom` |`object` |true |The key value object for mapping symbol and denom | +|`api_url` |`string` |true |The API to fetch LST Native APR | +|`lst_denoms` |`object` |true |The key value object for mapping denom of protocol api and carbon lst denom | diff --git a/README.md b/README.md index fcf15ba..43b3073 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Currently, each JSON file contain the following data on its corresponding networ - map of IBC channels for external IBC chains (such as Osmosis, Noble, etc.) - information about IBC tokens that are not added on chain or require packet forwarding - default quick select tokens in deposit/withdrawal forms -- Nitron Native APR API config for get APR show on Nitron markets +- LSTs native apr config to show on Nitron markets Additionally, the JSON file for mainnet contains the following data to support ongoing campaigns/promotions: - demex points config diff --git a/config.schema.json b/config.schema.json index 711d29a..267e9b4 100644 --- a/config.schema.json +++ b/config.schema.json @@ -633,9 +633,9 @@ "$ref": "#/$defs/trading_league" } }, - "nitron_native_apr": { + "lst_native_apr": { "type": "object", - "description": "API for query native APR on Nitron", + "description": "API for query LST native APR show on Nitron", "required": ["label_denom", "target_denom"], "properties": { "protocol": { @@ -652,11 +652,11 @@ } } }, - "nitron_native_aprs": { + "lst_native_aprs": { "type": "array", - "description": "List of APIs for native APR on Nitron", + "description": "List of APIs for fetch LST Native APR show on Nitron", "items": { - "$ref": "#/$defs/nitron_native_apr" + "$ref": "#/$defs/lst_native_apr" } } } diff --git a/configs/mainnet.json b/configs/mainnet.json index d7841e4..3391c2a 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -505,18 +505,18 @@ "trading_league_title": "Base Trading League" } }, - "nitron_native_aprs": [ + "lst_native_aprs": [ { "protocol": "Drop", "api_url": "https://app.drop.money/api/apy", - "reward_denom": { + "lst_denoms": { "dATOM": "ibc/EF37C83E78BD1F9B2401B3B3E5C00E0DBA71A648E2A8C3018861786F7A5F0105" } }, { "protocol": "Stride", "api_url": "https://edge.stride.zone/api/stake-stats", - "reward_denom": { + "lst_denoms": { "ATOM": "ibc/A4DB47A9D3CF9A068D454513891B526702455D3EF08FB9EB558C561F9DC2B701", "OSMO": "ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518", "STARS": "ibc/C688EBE80ECC20865331A18D8D19654754F6B189977715FED00FBA2BE41F144F", @@ -532,14 +532,14 @@ { "protocol": "Lido", "api_url": "https://eth-api.lido.fi/v1/protocol/steth/apr/sma", - "reward_denom": { + "lst_denoms": { "wstETH": "brdg/6901fa9eb45ef8351c0ab9e29fa45da3bb0538bfbc5a84ad1009e3544346d2c8" } }, { "protocol": "MilkyWay", "api_url": "https://apis.milkyway.zone/v2/protocols/osmosis.milkTIA", - "reward_denom": { + "lst_denoms": { "milkTIA": "ibc/16065EE5282C5217685C8F084FC44864C25C706AC37356B0D62811D50B96920F" } } From fdc334314b533e9686943171f2f18adb1f538529 Mon Sep 17 00:00:00 2001 From: thanhpn Date: Tue, 21 Jan 2025 10:53:53 +0700 Subject: [PATCH 3/6] fix stride denoms --- config.schema.json | 4 ++-- configs/mainnet.json | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/config.schema.json b/config.schema.json index 267e9b4..977d50b 100644 --- a/config.schema.json +++ b/config.schema.json @@ -636,7 +636,7 @@ "lst_native_apr": { "type": "object", "description": "API for query LST native APR show on Nitron", - "required": ["label_denom", "target_denom"], + "required": ["protocol", "api_url", "lst_denoms"], "properties": { "protocol": { "type": "string", @@ -646,7 +646,7 @@ "type": "string", "description": "API URL" }, - "reward_denom": { + "lst_denoms": { "type": "string", "description": "Reward denom map" } diff --git a/configs/mainnet.json b/configs/mainnet.json index 3391c2a..6c8e3c4 100644 --- a/configs/mainnet.json +++ b/configs/mainnet.json @@ -517,16 +517,16 @@ "protocol": "Stride", "api_url": "https://edge.stride.zone/api/stake-stats", "lst_denoms": { - "ATOM": "ibc/A4DB47A9D3CF9A068D454513891B526702455D3EF08FB9EB558C561F9DC2B701", - "OSMO": "ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518", - "STARS": "ibc/C688EBE80ECC20865331A18D8D19654754F6B189977715FED00FBA2BE41F144F", - "LUNA": "ibc/2B58B8C147E8718EECCB3713271DF46DEE8A3A00A27242628604E31C2F370EF5", - "EVMOS": "ibc/35E771B8682D828173F4B795F6C307780F96DC64D6F914FAE4CC9B4666F66364", - "INJ": "ibc/CAF0C63018C2E96F320D448C1F0A1951D77C4F385D802B700CDF7DD2D5B66FD0", - "DYDX": "ibc/9DC57FF60E125F9B976EB0DF4F2122C580AD1DB8E27BA71E6D2C1AA56A5FD312", - "TIA": "ibc/2F6C349F0EB135C5FA99301758F35B87DB88403D690E5E314AB080401FEE4066E5", - "DYM": "ibc/2F50345B6B85884DC41E831047EEE01805B289171DBF105AB3EA42BCC72B3926CC", - "SAGA": "ibc/2F50345B6B85884DC41E831047EEE01805B289171DBF105AB3EA42BCC72B3926CC" + "ATOM": "ibc/B7864B03E1B9FD4F049243E92ABD691586F682137037A9F3FCA5222815620B3C", + "OSMO": "ibc/75249A18DEFBEFE55F83B1C70CAD234DF164F174C6BC51682EE92C2C81C18C93", + "STARS": "ibc/8D749C5FB0213DF002E8FDCCB5B01E35DA241397EF825048C530C7EAE43BCE80", + "LUNA": "ibc/FBEE20115530F474F8BBE1460DA85437C3FBBFAF4A5DEBD71CA6B9C40559A161", + "EVMOS": "ibc/0BA1FA7A554B4347A87BD37AFF331683298730F9F8FCECB4896D58BED4B31F00", + "INJ": "ibc/2B9D089E73AC096934CD6BBBC71A1CD5DD2A4F8E94CC37CE7F861AC674044002", + "DYDX": "ibc/BAA1D21893B1D36865C6CA44D18F4ACF08BAD70CB6863C4722E0A61703808F77", + "TIA": "ibc/6569E05DEE32B339D9286A52BE33DFCEFC97267F23EF9CFDE0C055140967A9A5", + "DYM": "ibc/63BCB7805C5875C43F9CA101B2766E0AF1BA49DF928E9BC2A000D211614D3338", + "SAGA": "ibc/4EAAAE537853E9C0DDF458F0710C37BB3DE7C6A675AB75DB5731ACE93D6CC57B" } }, { From 120d498da1eec2880712705afd7b8ffb22fa7889 Mon Sep 17 00:00:00 2001 From: thanhpn Date: Thu, 23 Jan 2025 09:49:52 +0700 Subject: [PATCH 4/6] Address reviewer comments --- scripts/check_configs.ts | 36 ++++++++++++++++++++++++++++++++++++ yarn.lock | 6 +++--- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/scripts/check_configs.ts b/scripts/check_configs.ts index 506de0c..fb90206 100644 --- a/scripts/check_configs.ts +++ b/scripts/check_configs.ts @@ -1,6 +1,7 @@ import { CarbonSDK } from "carbon-js-sdk"; import { PageRequest } from "carbon-js-sdk/lib/codec/cosmos/base/query/v1beta1/pagination"; import { BridgeMap } from "carbon-js-sdk/lib/util/blockchain"; +import { SimpleMap } from "carbon-js-sdk/lib/util/type"; import * as fs from "fs"; import Long from "long"; @@ -36,6 +37,7 @@ interface ConfigJSON { disabled_transfer_banner_config?: DisabledTransferBannerConfig; announcement_banner: AnnouncementBanner; quick_select_deposit_options?: QuickSelectToken[]; + lst_native_aprs?: LstNativeAPR[]; } interface InvalidEntry { @@ -154,6 +156,12 @@ interface QuickSelectToken { target_denom: string; } +interface LstNativeAPR { + protocol: string; + api_url: string; + lst_denoms: SimpleMap; +} + type OutcomeMap = { [key in CarbonSDK.Network]: boolean }; // true = success, false = failure const outcomeMap: OutcomeMap = { @@ -499,6 +507,29 @@ function isValidQuickSelectTokens(quickSelectTokens: QuickSelectToken[], network return true; } +function isValidLSTNativeDenom(lstNativeAPRs: LstNativeAPR[], network: CarbonSDK.Network, denoms: string[]): boolean { + const lstDenoms = lstNativeAPRs.reduce((acc: string[], lst) => { + return acc.concat(Object.values(lst.lst_denoms)) + }, []) + + const duplicateLstDenoms = checkDuplicateEntries(lstDenoms); + if (duplicateLstDenoms.status && duplicateLstDenoms.entry) { + let listOfDuplicates: string = duplicateLstDenoms.entry.join(", "); + console.error(`ERROR: ${network}.json has the following duplicated lst native prs denoms: ${listOfDuplicates}. Please make sure to input each token denom only once in ${network}`); + return false; + } + + const invalidLstDenoms = checkValidEntries(lstDenoms, denoms); + if (invalidLstDenoms.status && invalidLstDenoms.entry) { + let listOfInvalidDenoms: string = invalidLstDenoms.entry.join(", "); + console.error(`ERROR: ${network}.json has the following invalid lst native prs denoms: ${listOfInvalidDenoms}. Please make sure to only input valid token denoms in ${network}`); + return false; + } + + + return true; +} + async function main() { for (const net of myArgs) { let network: CarbonSDK.Network; @@ -889,6 +920,11 @@ async function main() { if (jsonData.quick_select_deposit_options && !isValidQuickSelectTokens(jsonData.quick_select_deposit_options, network, tokens)) { outcomeMap[network] = false; } + + // check for LST native denom duplicate, existed + if (jsonData.lst_native_aprs && !isValidLSTNativeDenom(jsonData.lst_native_aprs, network, tokens)) { + outcomeMap[network] = false; + } } } const outcomeArr = Object.values(outcomeMap); diff --git a/yarn.lock b/yarn.lock index 83a7bfa..ad60086 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2252,9 +2252,9 @@ callsite@1.0.0: integrity sha512-0vdNRFXn5q+dtOqjfFtmtlI9N2eVZ7LMyEV2iKC5mEEFvSg/69Ml6b/WU2qF8W1nLRa0wiSrDT3Y5jOHZCwKPQ== carbon-js-sdk@^0.11.39: - version "0.11.39" - resolved "https://registry.yarnpkg.com/carbon-js-sdk/-/carbon-js-sdk-0.11.39.tgz#d0496ac6a06350dc933efbd122b9eafdea6fbc9c" - integrity sha512-rlzPyzXkuy3mhn3C9ZLI5deC+/bcBt7nYtWp3iB0w8anc/6dQ0vYT1mXP1wMTleFlKCuUXhiW99JRXqLeCVl+Q== + version "0.11.42" + resolved "https://registry.yarnpkg.com/carbon-js-sdk/-/carbon-js-sdk-0.11.42.tgz#a326adf8c4c8458d66b0d723e2fb47bacfd78f84" + integrity sha512-0Ij2dFIqoY4OJZxNjtMLq6qysXZPvFWEpV4ce4OhI9FHGuqgbnOBapbbvKxTGLJD27K2hOzv+YrQoSFiW33GSg== dependencies: "@cityofzion/neon-api" "^4.9.0" "@cityofzion/neon-core" "^4.9.0" From c9a47af9ef84eb561d105eb47084599e24c03e76 Mon Sep 17 00:00:00 2001 From: thanhpn Date: Thu, 23 Jan 2025 10:44:46 +0700 Subject: [PATCH 5/6] revert yarn.lock --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index ad60086..83a7bfa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2252,9 +2252,9 @@ callsite@1.0.0: integrity sha512-0vdNRFXn5q+dtOqjfFtmtlI9N2eVZ7LMyEV2iKC5mEEFvSg/69Ml6b/WU2qF8W1nLRa0wiSrDT3Y5jOHZCwKPQ== carbon-js-sdk@^0.11.39: - version "0.11.42" - resolved "https://registry.yarnpkg.com/carbon-js-sdk/-/carbon-js-sdk-0.11.42.tgz#a326adf8c4c8458d66b0d723e2fb47bacfd78f84" - integrity sha512-0Ij2dFIqoY4OJZxNjtMLq6qysXZPvFWEpV4ce4OhI9FHGuqgbnOBapbbvKxTGLJD27K2hOzv+YrQoSFiW33GSg== + version "0.11.39" + resolved "https://registry.yarnpkg.com/carbon-js-sdk/-/carbon-js-sdk-0.11.39.tgz#d0496ac6a06350dc933efbd122b9eafdea6fbc9c" + integrity sha512-rlzPyzXkuy3mhn3C9ZLI5deC+/bcBt7nYtWp3iB0w8anc/6dQ0vYT1mXP1wMTleFlKCuUXhiW99JRXqLeCVl+Q== dependencies: "@cityofzion/neon-api" "^4.9.0" "@cityofzion/neon-core" "^4.9.0" From 25cf15ce2c773e983bf7c2e88f00005d3214943c Mon Sep 17 00:00:00 2001 From: thanhpn Date: Thu, 23 Jan 2025 14:24:01 +0700 Subject: [PATCH 6/6] Address reviewer comments --- .github/markets/pr_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/markets/pr_template.md b/.github/markets/pr_template.md index cba3fc0..c042f84 100644 --- a/.github/markets/pr_template.md +++ b/.github/markets/pr_template.md @@ -30,7 +30,7 @@ Each json file under the [configs](../../configs) folder correspond to their res |`quick_select_tokens` |`QuickSelectToken[]` |true |List of quick select tokens for deposit and withdrawal forms. | |`disabled_transfer_banner_config` |`DisabledTransferBannerConfig` |false |Config parameters for displaying banner to inform users that transfers for the relevant tokens are disabled | |`trading_leagues` |`TradingLeague[]` |false |Map of trading league config with their path. | -|`lst_native_aprs` |`LSTNativeAPR[]` |true |List of LST native APR APIs. | +|`lst_native_aprs` |`LSTNativeAPR[]` |false |List of LST native APR APIs. | ## Maintenance Data Structure |Field |Type |Required |Description |Notes |