Skip to content

Commit

Permalink
Add b14g adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenquangthang1997 committed Oct 18, 2024
1 parent b9be118 commit 9bcd1fc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions projects/b14g/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const EARN_RATE_BASE = 1000000
const Staking = '0x788CC33E9365d8b4F8dEcEF9AeDf5F5fdcDb664B';
const Earn = '0xf5fA1728bABc3f8D2a617397faC2696c958C3409';
const apiStat = 'https://api.b14g.xyz/restake/stats'


module.exports = {
core: {
tvl: async function tvl(api) {
let rate = await api.call({abi: "uint256:getCurrentExchangeRate", target: Earn,})
let amount = await api.call({abi: "uint256:totalDelegatedStCore", target: Staking,})
const response = await fetch(apiStat);
const data = await response.json();
let amountBTC = Number(data.totalBtc)
api.addGasToken(amount * Number(rate) / EARN_RATE_BASE)
api.addCGToken('bitcoin', amountBTC)
}
},
}


0 comments on commit 9bcd1fc

Please sign in to comment.