From ae1332decd08e311be0d7afbd5bdf9bde133db6d Mon Sep 17 00:00:00 2001 From: ariworks-online Date: Tue, 15 Jul 2025 19:02:47 +0530 Subject: [PATCH] Add YREC adapter for Plume network (on-chain TVL, DeFiLlama compliant) --- projects/yrec/index.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 projects/yrec/index.js diff --git a/projects/yrec/index.js b/projects/yrec/index.js new file mode 100644 index 0000000000..1204141ffa --- /dev/null +++ b/projects/yrec/index.js @@ -0,0 +1,39 @@ +const { getLogs } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') + +// YREC Token Contract Address on Plume Network +const YREC_CONTRACT = '0x9b88F393928c7B5C6434bDDc7f6649a1a0e02FaE' + +// YREC Token ABI - only the functions we need for TVL calculation +const YREC_ABI = [ + 'function getTotalIPValue() external view returns (uint256)', + 'function getIPValuePerToken() external view returns (uint256)', + 'function totalSupply() external view returns (uint256)', + 'function name() external view returns (string)', + 'function symbol() external view returns (string)', + 'function decimals() external view returns (uint8)' +] + +module.exports = { + methodology: 'TVL is calculated by reading the total IP value backing all YREC tokens directly from the smart contract. Each YREC token represents exactly $1 USD of intellectual property value.', + misrepresentedTokens: false, + plume: { + tvl: async (_, _b, _c, { api }) => { + // Read total IP value directly from the YREC contract + const totalIPValue = await api.call({ + target: YREC_CONTRACT, + abi: 'function getTotalIPValue() external view returns (uint256)', + }) + + // Convert from wei to USD (18 decimals) + const tvl = totalIPValue / 1e18 + + return { + 'usd': tvl + } + } + }, + hallmarks: [ + [Math.floor(new Date('2025-07-15')/1000), 'YREC Token Launch'], + ], +} \ No newline at end of file