Skip to content

Commit

Permalink
Add SatLayer Adapter (#12962)
Browse files Browse the repository at this point in the history
Co-authored-by: g1nt0ki <[email protected]>
  • Loading branch information
fuxingloh and g1nt0ki authored Jan 6, 2025
1 parent 5984321 commit 8d61b5e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions projects/satlayer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@


const { getLogs2 } = require('../helper/cache/getLogs')
const { getUniqueAddresses } = require('../helper/tokenMapping')
const factory = '0x42a856dbEBB97AbC1269EAB32f3bb40C15102819'

module.exports = {
methodology: 'Total amount of BTC staked and restaked on SatLayer.'
}

const config = {
ethereum: { factory, fromBlock: 20564864 },
bsc: { factory, fromBlock: 42094094 },
btr: { factory: "0x2E3c78576735802eD94e52B7e71830e9E44a9a1C", fromBlock: 4532898 },
}

Object.keys(config).forEach(chain => {
const { factory, fromBlock } = config[chain]
module.exports[chain] = {
tvl: async (api) => {
const logs = await getLogs2({ api, factory, eventAbi: "event CapChanged(address token, uint256 cap)", fromBlock, })
const tokens = getUniqueAddresses(logs.map(log => log.token))
return api.sumTokens({ owner: factory, tokens })
}
}
})

0 comments on commit 8d61b5e

Please sign in to comment.