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.
Merge branch 'main' of github.com:buchaoqun/DefiLlama-Adapters
* 'main' of github.com:buchaoqun/DefiLlama-Adapters: Add SolanaHub Staked SOL (hubSOL) (DefiLlama#12221) Add newly supported Rumpel assets (Primarly YTs) (DefiLlama#12223) AeraFinance - added new arbitrum Aera Vault Factory (DefiLlama#12224) track royco add commonwealth tvl (DefiLlama#12219) feat: add new base vault (w/morpho) on bakerfi (DefiLlama#12220) add ezETH and uniBTC vaults Add SKALE IMA Bridge (Native) to SKALE TVL (DefiLlama#12214) Add additional reserve managers and tokens (DefiLlama#12215) Magma v3 (DefiLlama#12216) Fix pumpbtc adapter(addresses of other chains not read properly) (DefiLlama#12217) Add STAB Protocol adapter (DefiLlama#12218) 🥕 added Carrot tvl adapter (DefiLlama#12205) Fix: Velvet v3 (DefiLlama#12213) add wallet add wallets [WIP] -Fix: Maker (DefiLlama#12211) Update Desyn strategy Pools (DefiLlama#12136) feat: udpate pumpbtc adapter logic (DefiLlama#12147)
- Loading branch information
Showing
27 changed files
with
549 additions
and
512 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
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,50 @@ | ||
const { PublicKey } = require('@solana/web3.js'); | ||
const { Program } = require("@project-serum/anchor"); | ||
const { getConnection, getProvider, getTokenSupplies } = require('../helper/solana') | ||
|
||
async function tvl(api) { | ||
|
||
const connection = getConnection() | ||
const programId = 'CarrotwivhMpDnm27EHmRLeQ683Z1PufuqEmBZvD282s' | ||
const testVaultExclusion = '2AV35oWyAuSN5wmuy26VD5JirjVpXkfkv5ZMCQ2LtpuV' // our test vault should not be included in TVL | ||
|
||
// Use this method to track TVL via the token... | ||
// const CRT_MINT = 'CRTx1JouZhzSU6XytsE42UQraoGqiHgxabocVfARTy2s'; | ||
// await getTokenSupplies(CRT_MINT, {api}) | ||
|
||
// Use this method to track TVL via onchain state of each Vault by adding the balance at each strategy. | ||
const programAccounts = await connection.getProgramAccounts(new PublicKey(programId), { | ||
filters: [{ | ||
memcmp: { | ||
offset: 8, | ||
bytes: 'CarrotLYPhQzYL4fEsTUvEzw5QDaMGSZUENHSkh7qzQa' // carrot keeper | ||
}, | ||
},] | ||
}); | ||
|
||
const provider = getProvider(); | ||
const idl = await Program.fetchIdl(programId, provider) | ||
const program = new Program(idl, programId, provider) | ||
|
||
programAccounts.forEach(({ account, pubkey }, i) => { | ||
if(pubkey.toBase58() !== testVaultExclusion) { | ||
const { assets, strategies } = program.coder.accounts.decode( | ||
"Vault", | ||
account.data | ||
); | ||
const assetMap = {} | ||
assets.forEach(({assetId, mint }) => assetMap[assetId] = mint.toString()) | ||
|
||
strategies.forEach(i => { | ||
api.add(assetMap[i.assetId], i.balance.toString()) | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
module.exports = { | ||
doublecounted: true, | ||
timetravel: false, | ||
methodology: 'TVL calculated by calling the onchain state of the CRT Vault accounts, and tallying the balance of each strategy.', | ||
solana: { 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,26 @@ | ||
const { staking } = require('../helper/staking'); | ||
|
||
const TREASURY = [ | ||
'0xdE70B8BC5215BdF03f839BB8cD0F639D4E3E2881', | ||
'0xA205fD6A798A9Ba8b107A00b8A6a5Af742d6aCb5', | ||
'0x990eCdf73704f9114Ee28710D171132b5Cfdc6f0', | ||
'0xa653879692D4D0e6b6E0847ceDd58eAD2F1CC136' | ||
] | ||
|
||
|
||
const CONTRACTS = [ | ||
'0xf4aa59f5192856f41ae19caab4929ccd3a265e70', // staked | ||
'0x7519461fbd96abb539c770d57f38c2e91f8262aa', | ||
'0xd7e31990883250e53314b15ee555345f04d011e8', | ||
'0x87412c03979cc19c60071f5f98313a7cbe9f6d65', // rewards | ||
|
||
]; | ||
|
||
const WLTH = '0x99b2B1A2aDB02B38222ADcD057783D7e5D1FCC7D'; | ||
|
||
module.exports = { | ||
base: { | ||
tvl: () => ({}), | ||
staking: staking(CONTRACTS, WLTH) | ||
} | ||
}; |
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.
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
Oops, something went wrong.