Skip to content

Commit e830b05

Browse files
Add T-RIZE adapter (DefiLlama#14023)
1 parent 4fb3a88 commit e830b05

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

projects/T-RIZE/abi.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"getOracle": "function getOracle(address token) external view returns (address)",
3+
"latestAnswer": "function latestAnswer() external view override returns (int256)"
4+
}

projects/T-RIZE/index.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const abi = {
2+
"getOracle": "function getOracle(address token) external view returns (address)",
3+
"latestAnswer": "function latestAnswer() external view override returns (int256)"
4+
}
5+
6+
// TODO: instead of hardcoding the contract addresses, pull the list from the events
7+
// of the factory contract that deploys them. Like this we won't need a new PR for each
8+
// new project tokenized
9+
const tokens = [
10+
"0x35b5129e86EBE5Fd00b7DbE99aa202BE5CF5FA04", // Champfleury Contract ( vision87.com )
11+
].map(i => i.toLowerCase())
12+
13+
14+
// `api` is an injected `sdk.ChainApi` object with which you can interact with
15+
// a given chain through `call/multiCall/batchCall` method based on your need,
16+
// also stores tvl balances
17+
async function tvl(api) {
18+
19+
const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokens })
20+
21+
supplies.forEach((supply, i) => {
22+
api.add(tokens[i], supply)
23+
});
24+
25+
return api.getBalances()
26+
}
27+
28+
const chains = ["base"]
29+
30+
chains.forEach(chain => {
31+
module.exports[chain] = {
32+
tvl
33+
}
34+
})
35+

0 commit comments

Comments
 (0)