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.
Track openworld leverage farming DefiLlama#11375
- Loading branch information
1 parent
e7ad3c0
commit e02b69e
Showing
1 changed file
with
34 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,34 @@ | ||
const { get } = require('../helper/http') | ||
const { getConfig } = require('../helper/cache') | ||
|
||
const positionManager = '0x0b95Ea9Eb46716d20991163AE60eD2e16645Ef38'; | ||
const getValueFarmAbi = 'function getFarmValue(address) view returns (address token0, uint256 amount0, address token1, uint256 amount1)'; | ||
const OPEN = '0x58cb98a966f62aa6f2190eb3aa03132a0c3de3d5' | ||
|
||
async function tvl(api) { | ||
const vaults = await getConfig('open-world/lev-farming-vaults/'+api.chain, undefined, { | ||
fetcher: async () => { | ||
const data = await get('https://analytic.ow.finance/lending-synthetic') | ||
return data.data.map(v => v.vaultAddress) | ||
} | ||
}) | ||
const farms = await getConfig('open-world/lev-farming-farms/'+api.chain, undefined, { | ||
fetcher: async () => { | ||
const data = await get('https://product-exploration.ow.finance/pools') | ||
return data.data.map(v => v.workerAddress) | ||
} | ||
}) | ||
const tokens = await api.multiCall({ abi: 'address:token', calls: vaults }) | ||
await api.sumTokens({ tokensAndOwners2: [tokens, vaults], }) | ||
const farmData = await api.multiCall({ abi: getValueFarmAbi, calls: farms, target: positionManager }) | ||
for (const i of farmData) { | ||
api.add(i.token0, i.amount0) | ||
api.add(i.token1, i.amount1) | ||
} | ||
|
||
api.removeTokenBalance(OPEN) | ||
} | ||
|
||
module.exports = { | ||
arbitrum: { tvl }, | ||
} |