Skip to content

Commit f275e70

Browse files
committed
update spiko
1 parent 4a546fd commit f275e70

File tree

2 files changed

+48
-16
lines changed

2 files changed

+48
-16
lines changed

projects/helper/tokenMapping.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ const fixBalancesTokens = {
122122
'0x1B100DE3F13E3f8Bb2f66FE58c1949c32E71248B': { coingeckoId: 'ethereum', decimals: 18 },
123123
'0x9CE808657ba90C65a2700b1cA5D943eC72834B52': { coingeckoId: 'wrapped-bitcoin', decimals: 8 },
124124
},
125+
starknet: {
126+
'0x20ff2f6021ada9edbceaf31b96f9f67b746662a6e6b2bc9d30c0d3e290a71f6': { coingeckoId: 'spiko-us-t-bills-money-market-fund', decimals: 5 },
127+
'0x4f5e0de717daa6aa8de63b1bf2e8d7823ec5b21a88461b1519d9dbc956fb7f2': { coingeckoId: 'eutbl', decimals: 5 },
128+
}
125129
}
126130

127131
ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) })

projects/spiko/index.js

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,49 @@
1-
const assets = {
2-
polygon: [
3-
'0xe4880249745eAc5F1eD9d8F7DF844792D560e750',
4-
'0xa0769f7A8fC65e47dE93797b4e21C073c117Fc80'
5-
],
6-
ethereum: [
7-
'0xe4880249745eAc5F1eD9d8F7DF844792D560e750',
8-
'0xa0769f7A8fC65e47dE93797b4e21C073c117Fc80'
9-
]
1+
const { multiCall } = require('../helper/chain/starknet')
2+
const { sumTokens2 } = require('../helper/unwrapLPs')
3+
4+
const config = {
5+
polygon: [
6+
'0xe4880249745eAc5F1eD9d8F7DF844792D560e750',
7+
'0xa0769f7A8fC65e47dE93797b4e21C073c117Fc80'
8+
],
9+
ethereum: [
10+
'0xe4880249745eAc5F1eD9d8F7DF844792D560e750',
11+
'0xa0769f7A8fC65e47dE93797b4e21C073c117Fc80'
12+
],
13+
arbitrum: [
14+
'0x021289588cd81dC1AC87ea91e91607eEF68303F5',
15+
'0xcbeb19549054cc0a6257a77736fc78c367216ce7'
16+
],
17+
starknet: [
18+
'0x20ff2f6021ada9edbceaf31b96f9f67b746662a6e6b2bc9d30c0d3e290a71f6',
19+
'0x4f5e0de717daa6aa8de63b1bf2e8d7823ec5b21a88461b1519d9dbc956fb7f2'
20+
]
1021
}
1122

12-
module.exports = {}
23+
const totalSupplyAbi = {
24+
"name": "totalSupply",
25+
"type": "function",
26+
"inputs": [],
27+
"outputs": [
28+
{
29+
"name": "totalSupply",
30+
"type": "uint256"
31+
}
32+
],
33+
"stateMutability": "view",
34+
}
1335

14-
Object.keys(assets).forEach(chain => {
15-
module.exports[chain] = {
16-
tvl: (api) => api.multiCall({
17-
abi: 'erc20:totalSupply',
18-
calls: assets[api.chain].map(target => ({ target }))
19-
}).then(supplies => api.add(assets[api.chain], supplies))
36+
Object.keys(config).forEach(chain => {
37+
const assets = config[chain]
38+
module.exports[chain] = {
39+
tvl: async (api) => {
40+
let supplies
41+
if (chain === 'starknet')
42+
supplies = await multiCall({ abi: totalSupplyAbi, calls: assets })
43+
else
44+
supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: assets })
45+
api.add(assets, supplies)
46+
return sumTokens2({ api })
2047
}
48+
}
2149
})

0 commit comments

Comments
 (0)