forked from DefiLlama/DefiLlama-Adapters
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update zkLend staked amount (DefiLlama#11364)
* feat: update zkLend staked amount * minor fix --------- Co-authored-by: g1nt0ki <[email protected]>
- Loading branch information
1 parent
d88aafc
commit 19c94e6
Showing
2 changed files
with
54 additions
and
28 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
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 |
---|---|---|
@@ -1,46 +1,42 @@ | ||
const ADDRESSES = require('../helper/coreAssets.json') | ||
const { multiCall, sumTokens } = require('../helper/chain/starknet') | ||
const { marketAbi } = require('./abi'); | ||
const { multiCall, sumTokens, call } = require('../helper/chain/starknet') | ||
const { marketAbi, stakingAbi, } = require('./abi'); | ||
|
||
const market = '0x4c0a5193d58f74fbace4b74dcf65481e734ed1714121bdc571da345540efa05' | ||
const stakingContract = '0x0212c219a68c8fe38f37951123d1ec877570dfa891de270aa4f8634c5e60bc23' | ||
|
||
const assets = [ | ||
ADDRESSES.starknet.WBTC, | ||
ADDRESSES.starknet.ETH, | ||
ADDRESSES.starknet.USDC, | ||
ADDRESSES.starknet.DAI, | ||
ADDRESSES.starknet.DAI_1, | ||
ADDRESSES.starknet.USDT, | ||
ADDRESSES.starknet.WSTETH, | ||
ADDRESSES.starknet.STRK | ||
ADDRESSES.starknet.WBTC, | ||
ADDRESSES.starknet.ETH, | ||
ADDRESSES.starknet.USDC, | ||
ADDRESSES.starknet.DAI, | ||
ADDRESSES.starknet.DAI_1, | ||
ADDRESSES.starknet.USDT, | ||
ADDRESSES.starknet.WSTETH, | ||
ADDRESSES.starknet.STRK | ||
] | ||
|
||
async function tvl(api) { | ||
return sumTokens({ api, owner: market, tokens: assets }) | ||
return sumTokens({ api, owner: market, tokens: assets }) | ||
} | ||
|
||
async function staking(api) { | ||
return sumTokens({ | ||
api, | ||
owner: stakingContract, | ||
tokens: [ | ||
ADDRESSES.starknet.ZEND | ||
] | ||
}) | ||
const amountStakedAtStakingContract = await call({ target: stakingContract, abi: stakingAbi.get_total_staked_amount }) | ||
api.add(ADDRESSES.starknet.ZEND, amountStakedAtStakingContract) | ||
return sumTokens({ api, owner: market, tokens: [ADDRESSES.starknet.ZEND] }) | ||
} | ||
|
||
async function borrowed(api) { | ||
let data = await multiCall({ calls: assets, target: market, abi: marketAbi.get_total_debt_for_token }); | ||
data = data.map(i => +i) | ||
api.addTokens(assets, data) | ||
let data = await multiCall({ calls: assets, target: market, abi: marketAbi.get_total_debt_for_token }); | ||
data = data.map(i => +i) | ||
api.addTokens(assets, data) | ||
} | ||
|
||
module.exports = { | ||
methodology: 'Value of user supplied asset on zkLend is considered as TVL', | ||
starknet: { | ||
tvl, | ||
borrowed, | ||
staking, | ||
}, | ||
methodology: 'Value of user supplied asset on zkLend is considered as TVL', | ||
starknet: { | ||
tvl, | ||
borrowed, | ||
staking, | ||
}, | ||
} |