-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9be118
commit 9bcd1fc
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
}, | ||
} | ||
|
||
|