Skip to content

Commit beb2355

Browse files
authored
Obol: add staking part (#16953)
1 parent b9df5fc commit beb2355

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

projects/obol/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
const axios = require('axios')
22

3+
const rstOBOL = '0x1932e815254c53B3Ecd81CECf252A5AC7f0e8BeA'
34
const ENDPOINT_BASE = 'https://api.obol.tech/tvs/mainnet';
5+
const stakeForSharesABI = "function stakeForShares(uint256 _shares) view returns (uint256)"
6+
47
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
58

69
const buildUrl = ({ limit, page, dateString }) => `${ENDPOINT_BASE}?limit=${limit}&page=${page}&details=true&timestamp=${encodeURIComponent(dateString)}`;
@@ -38,6 +41,13 @@ const tvl = async (api) => {
3841
})
3942
}
4043

44+
const staking = async (api) => {
45+
const underlying = await api.call({ target: rstOBOL, abi: 'address:STAKE_TOKEN' })
46+
const supply = await api.call({ target: rstOBOL, abi: 'uint256:totalShares' })
47+
const stakeForShares = await api.call({ target: rstOBOL, abi: stakeForSharesABI, params:[supply] })
48+
api.add(underlying, stakeForShares)
49+
}
50+
4151
module.exports = {
42-
ethereum : { tvl }
52+
ethereum : { tvl, staking }
4353
}

0 commit comments

Comments
 (0)