-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #243 from dappradar/radar-staking-polygon
RADAR staking polygon
- Loading branch information
Showing
1 changed file
with
29 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,29 @@ | ||
import util from '../../../../util/blockchainUtil'; | ||
import formatter from '../../../../util/formatter'; | ||
import { ITvlParams, ITvlReturn } from '../../../../interfaces/ITvl'; | ||
|
||
const START_BLOCK = 50613367; | ||
const STAKING_CONTRACT = '0x23097285FAb23CB6BA67CC550fcEe4ED6F685eA4'; | ||
const RADAR_TOKEN = '0xdCb72AE4d5dc6Ae274461d57E65dB8D50d0a33AD'; | ||
|
||
async function tvl(params: ITvlParams): Promise<Partial<ITvlReturn>> { | ||
const { block, chain, provider, web3 } = params; | ||
if (block < START_BLOCK) { | ||
return {}; | ||
} | ||
|
||
const tokenBalances = await util.getTokenBalances( | ||
STAKING_CONTRACT, | ||
[RADAR_TOKEN], | ||
block, | ||
chain, | ||
web3, | ||
); | ||
|
||
const balances = {}; | ||
formatter.sumMultiBalanceOf(balances, tokenBalances, chain, provider); | ||
formatter.convertBalancesToFixed(balances); | ||
return { balances }; | ||
} | ||
|
||
export { tvl }; |