|
| 1 | +const { getLogs2 } = require('../helper/cache/getLogs') |
| 2 | +const ADDRESSES = require('../helper/coreAssets.json') |
| 3 | + |
| 4 | +// Rain.one RAIN token address on Arbitrum |
| 5 | +const RAIN_TOKEN = "0x25118290e6a5f4139381d072181157035864099d" |
| 6 | +const RAIN_PROTOCOL_FACTORY = "0xccCB3C03D9355B01883779EF15C1Be09cf3623F1" |
| 7 | + |
| 8 | +// Non-circulating & treasury wallets |
| 9 | +const NON_CIRCULATING_ADDRESSES = [ |
| 10 | + // "0x467D5Bf8Cfa1a5f99328fBdCb9C751c78934b725", // Sablier Vesting -- already counted as part of sablier tvl |
| 11 | + "0xc41A5462362f6AB4A878AE0Aac91b7259f7176A5", // Claim Presale Contract |
| 12 | +] |
| 13 | + |
| 14 | +// ---- Treasury TVL ---- |
| 15 | +async function vesting(api) { |
| 16 | + return api.sumTokens({ owners: NON_CIRCULATING_ADDRESSES, tokens: [RAIN_TOKEN] }) |
| 17 | +} |
| 18 | + |
| 19 | +async function rainProtocolTvl(api) { |
| 20 | + |
| 21 | + const logs = await getLogs2({ |
| 22 | + api, |
| 23 | + target: RAIN_PROTOCOL_FACTORY, |
| 24 | + eventAbi: 'event PoolCreated(address indexed poolAddress, address indexed poolCreator, string uri)', |
| 25 | + fromBlock: 307025521, |
| 26 | + }) |
| 27 | + |
| 28 | + const poolAddresses = logs.map(log => log.poolAddress) |
| 29 | + if (poolAddresses.length === 0) return {} |
| 30 | + |
| 31 | + // Sum USDT balances in all pools |
| 32 | + return api.sumTokens({ owners: logs.map(log => log.poolAddress), tokens: [ADDRESSES.arbitrum.USDT] }) |
| 33 | +} |
| 34 | + |
| 35 | +module.exports = { |
| 36 | + methodology: |
| 37 | + "TVL includes RAIN tokens held in Rain.one’s vesting/presale contracts and pools created on rain.one platform.", |
| 38 | + arbitrum: { |
| 39 | + tvl: rainProtocolTvl, |
| 40 | + vesting, |
| 41 | + }, |
| 42 | +} |
0 commit comments