UNPKG

@admin-jigsaw/jigsaw-sdk

Version:

Returns predefined data for Jigsaw platform and exposes functionality to retrieve the necessary data

99 lines (98 loc) 4.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PROTOCOL_STRATEGY_MAP_SONIC = exports.PROTOCOLS_ASSETS_SONIC = exports.generateProtocolStrategyMap = exports.AAVE_STRATEGIES_SONIC = void 0; const viem_1 = require("viem"); const strategiesSharedConstants_1 = require("../../strategiesSharedConstants"); const coinsConstants_1 = require("./coinsConstants"); // One strategy per collateral exports.AAVE_STRATEGIES_SONIC = { [coinsConstants_1.COLLATERALS_SONIC.USDC.symbol]: { stratAddress: "0x6593942CDC8d3a1D75f2EdA63d7549A45bd162fF", }, [coinsConstants_1.COLLATERALS_SONIC.wS.symbol]: { stratAddress: "0x1C9BE4B3423d61190282aA1F08948B3085340EA0", }, [coinsConstants_1.COLLATERALS_SONIC.WETH.symbol]: { stratAddress: "0x66bCc8815819ACc51D905b396279FC7143c195D3", }, }; // Array-based strategies with expiry dates for dynamic maturity detection // export const PENDLE_STRATEGIES_SONIC: PendleStrategies = { // [COLLATERALS_SONIC.stS.symbol]: [ // { // stratAddress: '0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc', // expiryDate: '2025-05-29', // 29 May 2025, // marketAddress: '0x3aeF1d372d0a7a7E482F465Bc14A42D78f920392', // stS market address // }, // // Example of how to add a second pool (e.g., matured one): // // { // // stratAddress: '0x...', // // expiryDate: '2024-12-31', // // }, // ], // [COLLATERALS_SONIC.wstkscUSD.symbol]: [ // { // stratAddress: '0x1429859428C0aBc9C2C47C8Ee9FBaf82cFA0F20f', // expiryDate: '2025-12-18', // 18 December 2025 // marketAddress: '0x004f76045b42ef3e89814b12b37E69da19C8a212', // wstkscUSD market address // }, // ], // [COLLATERALS_SONIC.wstkscETH.symbol]: [ // { // stratAddress: '0xB0D4afd8879eD9F52b28595d31B441D079B2Ca07', // expiryDate: '2025-12-18', // 18 December 2025 // marketAddress: '0x7e2bcdB749D90Aa1E9E7262872AC8B1e062B2C4D', // wstkscETH market address // }, // ], // [COLLATERALS_SONIC.wOS.symbol]: [ // { // stratAddress: '0x162A433068F51e18b7d13932F27e66a3f99E6890', // expiryDate: '2025-12-18', // 18 December 2025 // marketAddress: '0xC1fd739f2Bf1Aad96F04d6AE35ED04DA4D68366b', // wOS market address // }, // ], // }; // export const ACTIVE_PENDLE_STRATEGIES_SONIC: PendleStrategies = Object.fromEntries( // Object.entries(PENDLE_STRATEGIES_SONIC) // .map(([asset, strategies]) => [ // asset, // strategies.filter((strategy) => !(new Date() > new Date(strategy.expiryDate))), // ]) // .filter(([_, activeStrategies]) => activeStrategies.length > 0) // ); const generateProtocolStrategyMap = () => { const protocolStrategyMap = {}; protocolStrategyMap[strategiesSharedConstants_1.PROTOCOLS_DATA.AAVE.name] = Object.values(exports.AAVE_STRATEGIES_SONIC).map((strategy) => strategy.stratAddress || viem_1.zeroAddress); // protocolStrategyMap[PROTOCOLS_DATA.PENDLE.name] = Object.values(PENDLE_STRATEGIES_SONIC) // .flatMap((strategies) => strategies.map((strategy) => strategy.stratAddress)) // .filter(Boolean) as string[]; return protocolStrategyMap; }; exports.generateProtocolStrategyMap = generateProtocolStrategyMap; const generateProtocolAssets = () => { const protocolAssets = []; const protocolSources = { [strategiesSharedConstants_1.PROTOCOLS_DATA.AAVE.name]: exports.AAVE_STRATEGIES_SONIC, // [PROTOCOLS_DATA.PENDLE.name]: ACTIVE_PENDLE_STRATEGIES_SONIC, }; Object.entries(protocolSources).forEach(([protocol, strategies]) => { const assets = new Set(); Object.keys(strategies).forEach((asset) => { assets.add(asset); }); protocolAssets.push({ name: protocol, icon: strategiesSharedConstants_1.PROTOCOLS_DATA[protocol]?.icon || "", assets: Array.from(assets), }); }); return protocolAssets; }; // Assets for each protocol, keep in sync with strategies dictionaries exports.PROTOCOLS_ASSETS_SONIC = generateProtocolAssets(); // Strategies for each protocol in a flat array, keep in sync with PROTOCOLS_ASSETS exports.PROTOCOL_STRATEGY_MAP_SONIC = (0, exports.generateProtocolStrategyMap)(); // Dynamically generated Pendle markets based on strategies // export const PENDLE_MARKETS_SONIC: Address[] = Object.values(PENDLE_STRATEGIES_SONIC).flatMap((strategies) => // strategies.map((strategy) => strategy.marketAddress || zeroAddress) // );