Obol: add staking part (#16953)

This commit is contained in:
0xpeluche
2025-11-05 12:59:36 +01:00
committed by GitHub
parent b9df5fc892
commit beb2355927

View File

@@ -1,6 +1,9 @@
const axios = require('axios')
const rstOBOL = '0x1932e815254c53B3Ecd81CECf252A5AC7f0e8BeA'
const ENDPOINT_BASE = 'https://api.obol.tech/tvs/mainnet';
const stakeForSharesABI = "function stakeForShares(uint256 _shares) view returns (uint256)"
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
const buildUrl = ({ limit, page, dateString }) => `${ENDPOINT_BASE}?limit=${limit}&page=${page}&details=true&timestamp=${encodeURIComponent(dateString)}`;
@@ -38,6 +41,13 @@ const tvl = async (api) => {
})
}
module.exports = {
ethereum : { tvl }
const staking = async (api) => {
const underlying = await api.call({ target: rstOBOL, abi: 'address:STAKE_TOKEN' })
const supply = await api.call({ target: rstOBOL, abi: 'uint256:totalShares' })
const stakeForShares = await api.call({ target: rstOBOL, abi: stakeForSharesABI, params:[supply] })
api.add(underlying, stakeForShares)
}
module.exports = {
ethereum : { tvl, staking }
}