-
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 #281 from dappradar/OPEN-integration
OPEN integration
- Loading branch information
Showing
2 changed files
with
58 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 = 19483155; | ||
const STAKING_CONTRACT = '0x686e8500B6bE8812EB198aAbbbFA14C95c03fC88'; | ||
const OPN_TOKEN = '0xc28eb2250d1ae32c7e74cfb6d6b86afc9beb6509'; | ||
|
||
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, | ||
[OPN_TOKEN], | ||
block, | ||
chain, | ||
web3, | ||
); | ||
|
||
const balances = {}; | ||
formatter.sumMultiBalanceOf(balances, tokenBalances, chain, provider); | ||
formatter.convertBalancesToFixed(balances); | ||
return { balances }; | ||
} | ||
|
||
export { tvl }; |
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 = 54913762; | ||
const STAKING_CONTRACT = '0x686e8500B6bE8812EB198aAbbbFA14C95c03fC88'; | ||
const OPN_TOKEN = '0x7844F79FC841E4F92d974C417031c76F8578c2D5'; | ||
|
||
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, | ||
[OPN_TOKEN], | ||
block, | ||
chain, | ||
web3, | ||
); | ||
|
||
const balances = {}; | ||
formatter.sumMultiBalanceOf(balances, tokenBalances, chain, provider); | ||
formatter.convertBalancesToFixed(balances); | ||
return { balances }; | ||
} | ||
|
||
export { tvl }; |