mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-01-12 22:43:12 +08:00
Obol: add staking part (#16953)
This commit is contained in:
@@ -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×tamp=${encodeURIComponent(dateString)}`;
|
||||
@@ -38,6 +41,13 @@ const tvl = async (api) => {
|
||||
})
|
||||
}
|
||||
|
||||
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 }
|
||||
ethereum : { tvl, staking }
|
||||
}
|
||||
Reference in New Issue
Block a user