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.
Update Desyn strategy Pools (DefiLlama#12136)
Co-authored-by: g1nt0ki <[email protected]>
- Loading branch information
1 parent
eb9ddef
commit 8816a0d
Showing
6 changed files
with
92 additions
and
124 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,12 @@ | ||
const { getTvlFunction, chains } = require("../desyn-farm/helper"); | ||
|
||
module.exports = { | ||
doublecounted: true, | ||
methodology: 'Combines on-chain airdrops with stable returns from basis trading on Binance.', | ||
} | ||
|
||
chains.forEach(chain => { | ||
module.exports[chain] = { | ||
tvl: getTvlFunction('StrategyType3', true) | ||
} | ||
}) |
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,59 @@ | ||
const { getConfig } = require('../helper/cache') | ||
|
||
const chains = ["ethereum", "arbitrum", "btr", "mode", "zklink", "core", "ailayer", "linea", "merlin", "scroll"]; | ||
|
||
const abi = { | ||
getBalance: "function getBalance(address) view returns (uint256)" | ||
} | ||
|
||
async function getInfoListPool(strategy_type, chain) { | ||
const data = await getConfig('desyn/' + strategy_type, `https://api.desyn.io/etf/defillama/get_pool_list?strategy_type=${strategy_type}`) | ||
return data.data.config[chain]?.safePools | ||
} | ||
|
||
// This is aSTETH, | ||
// before the design of the semi-closed soETH, | ||
// the contract in order to limit the closure of the time, | ||
// the user can still deposit, | ||
// so he was given a maximum value of the balance, | ||
// which will become negative after adding any number, blocking the user to put in | ||
const leverageStaking = '0x1982b2F5814301d4e9a8b0201555376e62F82428' | ||
|
||
|
||
function getTvlFunction(strategy_type, isDoubleCounted) { | ||
return async (api) => { | ||
const pools = await getInfoListPool(strategy_type, api.chain) | ||
if (!pools?.length) return; | ||
const tokens = await api.multiCall({ abi: 'address[]:getCurrentTokens', calls: pools }) | ||
const calls = [] | ||
const tokensAndOwners = [] | ||
const allTokens = [] | ||
let i = 0 | ||
|
||
for (const pool of pools) { | ||
for (const token of tokens[i]) { | ||
if (!isDoubleCounted) { | ||
tokensAndOwners.push([token, pool]) | ||
} else { | ||
calls.push({ target: pool, params: token }) | ||
allTokens.push(token) | ||
} | ||
} | ||
i++ | ||
} | ||
|
||
if (!isDoubleCounted) return api.sumTokens({ tokensAndOwners }) | ||
|
||
const allBals = await api.multiCall({ abi: abi.getBalance, calls }) | ||
api.add(allTokens, allBals) | ||
|
||
if (strategy_type === 'StrategyType2') | ||
api.removeTokenBalance(leverageStaking) | ||
} | ||
} | ||
|
||
|
||
module.exports = { | ||
getTvlFunction, | ||
chains | ||
} |
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,44 +1,16 @@ | ||
const { getLogs } = require('../helper/cache/getLogs') | ||
const { getTvlFunction, chains } = require("./helper"); | ||
|
||
module.exports = { | ||
doublecounted: true, | ||
methodology: 'On-chain restaking', | ||
hallmarks: [ | ||
[1719734400, "Launched on Merlin Chain"], | ||
[1718092800, "DeSyn KelpDAO Restaking Fund Launched"], | ||
[1713340800, "Restaking Fund Series Launched"] | ||
], | ||
methodology: 'Focused on airdrops from DeSyn and new chains.', | ||
} | ||
|
||
const config = { | ||
merlin: { factory: '0x790b4ee7998A93702f29e56f8b615eF35BE5af43', fromBlock: 11260440}, | ||
} | ||
|
||
const abi = { | ||
getBalance: "function getBalance(address) view returns (uint256)" | ||
} | ||
|
||
Object.keys(config).forEach(chain => { | ||
const {factory, fromBlock, } = config[chain] | ||
chains.forEach(chain => { | ||
module.exports[chain] = { | ||
tvl: async (api) => { | ||
const logs = await getLogs({ | ||
api, | ||
target: factory, | ||
eventAbi: 'event LOG_NEW_POOL (address indexed caller, address indexed pool)', | ||
onlyArgs: true, | ||
fromBlock, | ||
}) | ||
|
||
const pools = logs.map(i=>i.pool) | ||
const tokens = await api.multiCall({ abi: 'address[]:getCurrentTokens', calls: pools}) | ||
const calls = [] | ||
const allTokens = [] | ||
let i = 0 | ||
for (const pool of pools) { | ||
for (const token of tokens[i]) { | ||
calls.push({ target: pool, params: token }) | ||
allTokens.push(token) | ||
} | ||
i++ | ||
} | ||
const allBals = await api.multiCall({ abi: abi.getBalance, calls }) | ||
api.add(allTokens, allBals) | ||
} | ||
tvl: getTvlFunction('StrategyType1', false) | ||
} | ||
}) |
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
const { getTvlFunction, chains } = require("../desyn-farm/helper"); | ||
|
||
module.exports = { | ||
doublecounted: true, | ||
methodology: 'Engages with DeFi protocols like Lending, DEX, and Restaking, offering both airdrops and structured yield options.', | ||
} | ||
|
||
chains.forEach(chain => { | ||
module.exports[chain] = { | ||
tvl: getTvlFunction('StrategyType2', true) | ||
} | ||
}) |
This file was deleted.
Oops, something went wrong.