mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-01-12 16:53:02 +08:00
Angles (#13298)
Co-authored-by: 0xpeluche <110820448+0xpeluche@users.noreply.github.com>
This commit is contained in:
21
projects/angles/index.js
Normal file
21
projects/angles/index.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const ADDRESSES = require('../helper/coreAssets.json')
|
||||
|
||||
const SONIC_SFC_CONTRACT = '0xFC00FACE00000000000000000000000000000000'
|
||||
const vault = '0xe5203Be1643465b3c0De28fd2154843497Ef4269'
|
||||
const S = ADDRESSES.null
|
||||
|
||||
const abis = {
|
||||
validatorsIndexed: "function validatorsIndexed(uint256) view returns (uint256 validatorId, uint8 weight, uint256 limit, uint256 SInTransit)",
|
||||
numberOfValidators: "function numberOfValidators() view returns (uint256)",
|
||||
getStake: "function getStake(address delegator, uint256 validatorID) view returns (uint256 stake)"
|
||||
}
|
||||
|
||||
const tvl = async (api) => {
|
||||
const validators = await api.fetchList({ target: vault, lengthAbi: abis.numberOfValidators, itemAbi: abis.validatorsIndexed })
|
||||
const validatorsBalances = await api.multiCall({ calls: validators.map(({ validatorId }) => ({ target: SONIC_SFC_CONTRACT, params: [vault, validatorId] })), abi: abis.getStake })
|
||||
api.add(S, validatorsBalances)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
sonic: { tvl }
|
||||
}
|
||||
Reference in New Issue
Block a user