Skip to content

Commit

Permalink
track untangled (#10204)
Browse files Browse the repository at this point in the history
* Add adapter for Untangled Finance

* code refactor

---------

Co-authored-by: cedric-untangled <[email protected]>
  • Loading branch information
g1nt0ki and cedric-untangled authored May 13, 2024
1 parent 0dc3e8f commit 8b35d4f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions projects/untangled/index.js
Original file line number Diff line number Diff line change
@@ -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,
},
};

0 comments on commit 8b35d4f

Please sign in to comment.