diff --git a/projects/untangled/index.js b/projects/untangled/index.js new file mode 100644 index 000000000000..e4c3b7bf0593 --- /dev/null +++ b/projects/untangled/index.js @@ -0,0 +1,22 @@ +const Contracts = { + SecuritizationManager: "0x4DCC7a839CE7e952Cd90d03d65C70B9CCD6BA4C2", + USDC: "0xcebA9300f2b948710d2653dD7B07f33A8B32118C", +}; + +async function tvl(api) { + const pools = await api.fetchList({ lengthAbi: 'getPoolsLength', itemAbi: 'pools', target: Contracts.SecuritizationManager}) + const reserves = await api.multiCall({ abi: 'function getReserves() external view returns (uint256, uint256)', calls: pools }) + api.add(Contracts.USDC, reserves.map(i => i[1])) +} + +async function borrowed(api) { + const pools = await api.fetchList({ lengthAbi: 'getPoolsLength', itemAbi: 'pools', target: Contracts.SecuritizationManager}) + const reserves = await api.multiCall({ abi: 'function getReserves() external view returns (uint256, uint256)', calls: pools }) + api.add(Contracts.USDC, reserves.map(i => i[0])) +} + +module.exports = { + celo: { + tvl, borrowed, + }, +};