Skip to content

Commit e8213f7

Browse files
g1nt0kihackmeonebillionCofferNetwork
authored
Add Coffer Network (DefiLlama#13256)
Co-authored-by: hackmeonebillion <[email protected]> Co-authored-by: CofferNetwork <[email protected]>
1 parent 3725a2c commit e8213f7

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

projects/coffer-network/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const { sumTokens } = require("../helper/sumTokens.js");
2+
const bitcoinAddressBook = require('../helper/bitcoin-book/index.js');
3+
4+
async function tvl(api) {
5+
const owners = await bitcoinAddressBook.coffernetwork();
6+
return sumTokens({ owners, api })
7+
}
8+
9+
module.exports = {
10+
methodology: "TVL is fetched from Coffer Network Bitcoin Staking Protocol from native Bitcoin",
11+
start: "2025-01-20",
12+
isHeavyProtocol: true,
13+
bitcoin: {
14+
tvl,
15+
},
16+
}

projects/helper/bitcoin-book/fetchers.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,26 @@ module.exports = {
9191
return txHash
9292
}
9393
},
94+
coffernetwork: async () => {
95+
96+
return getConfig('coffer-network', undefined, {
97+
fetcher: async () => {
98+
throw new Error('Coffer Network fetcher is not implemented')
99+
}
100+
})
101+
102+
function reserveBytes(txHashTemp) {
103+
let txHash = ''
104+
if (txHashTemp.length % 2 === 1) {
105+
txHashTemp = '0' + txHashTemp
106+
}
107+
txHashTemp = txHashTemp.split('').reverse().join('')
108+
for (let i = 0; i < txHashTemp.length - 1; i += 2) {
109+
txHash += txHashTemp[i + 1] + txHashTemp[i]
110+
}
111+
return txHash
112+
}
113+
},
94114

95115
lombard: async () => {
96116
const API_URL = 'https://mainnet.prod.lombard.finance/api/v1/addresses'

0 commit comments

Comments
 (0)