Skip to content

Commit be02572

Browse files
aviggianog1nt0ki
andauthored
Add SizeCredit (mainnet) (DefiLlama#13024)
Co-authored-by: g1nt0ki <[email protected]>
1 parent cd34958 commit be02572

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

projects/size-credit/index.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
const SIZE_FACTORY = '0x330Dc31dB45672c1F565cf3EC91F9a01f8f3DF0b'
1+
const config = {
2+
base: '0x330Dc31dB45672c1F565cf3EC91F9a01f8f3DF0b',
3+
ethereum: '0x3A9C05c3Da48E6E26f39928653258D7D4Eb594C1'
4+
}
25

36
const abis = {
47
SizeFactory: {
@@ -13,7 +16,7 @@ const abis = {
1316
}
1417

1518
async function tvl(api) {
16-
const markets = await api.call({ abi: abis.SizeFactory.getMarkets, target: SIZE_FACTORY })
19+
const markets = await api.call({ abi: abis.SizeFactory.getMarkets, target: config[api.chain] })
1720
const datas = await api.multiCall({ abi: abis.Size.data, calls: markets })
1821

1922
const borrowATokens = datas.map(data => data.borrowAToken)
@@ -32,7 +35,7 @@ async function tvl(api) {
3235
}
3336

3437
async function borrowed(api) {
35-
const markets = await api.call({ abi: abis.SizeFactory.getMarkets, target: SIZE_FACTORY })
38+
const markets = await api.call({ abi: abis.SizeFactory.getMarkets, target: config[api.chain] })
3639
const datas = await api.multiCall({ abi: abis.Size.data, calls: markets })
3740

3841
const debtTokens = datas.map(data => data.debtToken)
@@ -43,9 +46,8 @@ async function borrowed(api) {
4346
return api.add(underlyingBorrowTokens, totalDebts)
4447
}
4548

46-
module.exports = {
47-
base: {
48-
tvl,
49-
borrowed
49+
Object.keys(config).forEach(chain => {
50+
module.exports[chain] = {
51+
tvl, borrowed,
5052
}
51-
}
53+
})

0 commit comments

Comments
 (0)