From 396826ed1449a49bbbdd08ad7835d4e8129c058b Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 13 Oct 2025 17:28:19 +0900 Subject: [PATCH 1/3] add: vault url information --- src/adaptors/affluent/index.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/adaptors/affluent/index.js b/src/adaptors/affluent/index.js index 4e63dad460..0c5a339f97 100644 --- a/src/adaptors/affluent/index.js +++ b/src/adaptors/affluent/index.js @@ -3,6 +3,7 @@ const utils = require("../utils"); const AFFLUENT_MULTIPLY_VAULT_API_URL = "https://api.affluent.org/v2/api/strategyvaults"; const AFFLUENT_LENDING_VAULT_API_URL = "https://api.affluent.org/v2/api/sharevaults"; const AFFLUENT_ASSETS_API_URL = "https://api.affluent.org/v2/api/assets"; +const AFFLUENT_METADATA_API_URL = "https://api.factorial.finance/info/metadata" const nowSec = () => Math.floor(Date.now() / 1000); @@ -151,8 +152,9 @@ function mapToOutput({ address, symbol, tvl, netApy }) { const pool = `${address}-TON`; const project = "affluent"; const apyBase = netApy; + const vaultUrl = `https://app.affluent.org/earn/${address}`; - return { + const output = { pool, chain: "TON", project, @@ -160,4 +162,14 @@ function mapToOutput({ address, symbol, tvl, netApy }) { tvlUsd: toNumberOr0(tvl), ...(apyBase !== undefined ? { apyBase } : {}), }; -} \ No newline at end of file + + if (!hiddenVaultUrlWhitelist.includes(address)) { + output.url = vaultUrl; + } + + return output; +} + +const hiddenVaultUrlWhitelist = [ + "EQD3F7Ex_uxBjxEub8FgeDoYYUSIbAUVyehCb_JSiCVL369T", +]; From c635132776ee65b9a017a7cb3858bb53401be01f Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 13 Oct 2025 17:41:06 +0900 Subject: [PATCH 2/3] update: register vault name as symbol --- src/adaptors/affluent/index.js | 48 +++++----------------------------- 1 file changed, 6 insertions(+), 42 deletions(-) diff --git a/src/adaptors/affluent/index.js b/src/adaptors/affluent/index.js index 0c5a339f97..4bdbb4fb0e 100644 --- a/src/adaptors/affluent/index.js +++ b/src/adaptors/affluent/index.js @@ -3,17 +3,14 @@ const utils = require("../utils"); const AFFLUENT_MULTIPLY_VAULT_API_URL = "https://api.affluent.org/v2/api/strategyvaults"; const AFFLUENT_LENDING_VAULT_API_URL = "https://api.affluent.org/v2/api/sharevaults"; const AFFLUENT_ASSETS_API_URL = "https://api.affluent.org/v2/api/assets"; -const AFFLUENT_METADATA_API_URL = "https://api.factorial.finance/info/metadata" const nowSec = () => Math.floor(Date.now() / 1000); const getAPY = async () => { try { - const assetMap = await getAssetMap(); - const [strategy, share] = await Promise.all([ - getStrategyVaultsMapped(assetMap), - getShareVaultsMapped(assetMap), + getStrategyVaultsMapped(), + getShareVaultsMapped(), ]); const merged = [...strategy, ...share]; @@ -24,7 +21,7 @@ const getAPY = async () => { } }; -async function getStrategyVaultsMapped(assetMap) { +async function getStrategyVaultsMapped() { const res = await fetch(AFFLUENT_MULTIPLY_VAULT_API_URL); if (!res.ok) { throw new Error(`Strategy API error: HTTP ${res.status} ${res.statusText}`); @@ -36,15 +33,9 @@ async function getStrategyVaultsMapped(assetMap) { } return data.map((v) => { - const assetKeys = Object.keys(v.assets || {}); - const assetSymbols = assetKeys - .map((addr) => assetMap[addr] || addr) - .sort((a, b) => a.localeCompare(b)); - const assetSymbolString = assetSymbols.join("-"); - return mapToOutput({ address: v.address, - symbol: assetSymbolString, + symbol: v.name, tvl: v.tvl, netApy: v.netApy, }); @@ -75,7 +66,7 @@ async function getShareVaultPoint(address, ts = nowSec()) { return Array.isArray(arr) && arr[0] ? arr[0] : null; } -async function getShareVaultsMapped(assetMap) { +async function getShareVaultsMapped() { const list = await getShareVaultList(); const ts = nowSec(); @@ -85,11 +76,9 @@ async function getShareVaultsMapped(assetMap) { const netApy = typeof p?.apy === "number" ? p.apy : undefined; const tvl = p?.tvl; - const underlyingSymbol = v?.underlying ? (assetMap[v.underlying] || v.underlying) : undefined; - return mapToOutput({ address: v.address, - symbol: underlyingSymbol, + symbol: v.name, tvl, netApy, }); @@ -108,31 +97,6 @@ async function getShareVaultsMapped(assetMap) { }); } -async function getAssetMap() { - const res = await fetch(AFFLUENT_ASSETS_API_URL); - if (!res.ok) { - throw new Error(`Asset API error: HTTP ${res.status} ${res.statusText}`); - } - - const data = await res.json(); - if (!Array.isArray(data)) { - throw new Error("Asset: Unexpected response shape (not an array)"); - } - - const map = {}; - for (const item of data) { - let symbol = item.symbol; - - if (symbol === "FactorialTON") { - symbol = "TON"; - } - - map[item.address] = symbol; - } - - return map; -} - module.exports = { apy: getAPY, timetravel: false, From 8beb2e4cf33eb46bb274ab95187a5aa219373921 Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 15 Oct 2025 16:45:55 +0900 Subject: [PATCH 3/3] fix: set the vault name as poolMeta, and tokens as the tokens as symbol --- src/adaptors/affluent/index.js | 58 ++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/src/adaptors/affluent/index.js b/src/adaptors/affluent/index.js index 4bdbb4fb0e..67a5267ac6 100644 --- a/src/adaptors/affluent/index.js +++ b/src/adaptors/affluent/index.js @@ -8,9 +8,11 @@ const nowSec = () => Math.floor(Date.now() / 1000); const getAPY = async () => { try { + const assetMap = await getAssetMap(); + const [strategy, share] = await Promise.all([ - getStrategyVaultsMapped(), - getShareVaultsMapped(), + getStrategyVaultsMapped(assetMap), + getShareVaultsMapped(assetMap), ]); const merged = [...strategy, ...share]; @@ -21,7 +23,7 @@ const getAPY = async () => { } }; -async function getStrategyVaultsMapped() { +async function getStrategyVaultsMapped(assetMap) { const res = await fetch(AFFLUENT_MULTIPLY_VAULT_API_URL); if (!res.ok) { throw new Error(`Strategy API error: HTTP ${res.status} ${res.statusText}`); @@ -32,12 +34,20 @@ async function getStrategyVaultsMapped() { throw new Error("Strategy: Unexpected response shape (not an array)"); } + return data.map((v) => { + const assetKeys = Object.keys(v.assets || {}); + const assetSymbols = assetKeys + .map((addr) => assetMap[addr] || addr) + .sort((a, b) => a.localeCompare(b)); + const assetSymbolString = assetSymbols.join("-"); + return mapToOutput({ address: v.address, - symbol: v.name, + symbol: assetSymbolString, tvl: v.tvl, netApy: v.netApy, + poolMeta: v.name, }); }); } @@ -66,7 +76,7 @@ async function getShareVaultPoint(address, ts = nowSec()) { return Array.isArray(arr) && arr[0] ? arr[0] : null; } -async function getShareVaultsMapped() { +async function getShareVaultsMapped(assetMap) { const list = await getShareVaultList(); const ts = nowSec(); @@ -76,11 +86,14 @@ async function getShareVaultsMapped() { const netApy = typeof p?.apy === "number" ? p.apy : undefined; const tvl = p?.tvl; + const underlyingSymbol = v?.underlying ? (assetMap[v.underlying] || v.underlying) : undefined; + return mapToOutput({ address: v.address, - symbol: v.name, + symbol: underlyingSymbol, tvl, netApy, + poolMeta: v.name, }); }) ); @@ -90,13 +103,39 @@ async function getShareVaultsMapped() { const sv = list[i]; return mapToOutput({ address: sv.address, - symbol: sv?.symbol, + symbol: sv.symbol, tvl: 0, netApy: undefined, + poolMeta: sv.poolMeta, }); }); } +async function getAssetMap() { + const res = await fetch(AFFLUENT_ASSETS_API_URL); + if (!res.ok) { + throw new Error(`Asset API error: HTTP ${res.status} ${res.statusText}`); + } + + const data = await res.json(); + if (!Array.isArray(data)) { + throw new Error("Asset: Unexpected response shape (not an array)"); + } + + const map = {}; + for (const item of data) { + let symbol = item.symbol; + + if (symbol === "FactorialTON") { + symbol = "TON"; + } + + map[item.address] = symbol; + } + + return map; +} + module.exports = { apy: getAPY, timetravel: false, @@ -112,7 +151,7 @@ function toNumberOr0(v) { return 0; } -function mapToOutput({ address, symbol, tvl, netApy }) { +function mapToOutput({ address, symbol, tvl, netApy, poolMeta }) { const pool = `${address}-TON`; const project = "affluent"; const apyBase = netApy; @@ -122,7 +161,8 @@ function mapToOutput({ address, symbol, tvl, netApy }) { pool, chain: "TON", project, - symbol: String(symbol ?? ""), + symbol: symbol, + poolMeta: poolMeta, tvlUsd: toNumberOr0(tvl), ...(apyBase !== undefined ? { apyBase } : {}), };