mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-01-12 08:34:23 +08:00
remove deUSD leverage minted by team (#16892)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
const ADDRESSES = require("../helper/coreAssets.json");
|
||||
const { sumTokensExport } = require("../helper/unwrapLPs");
|
||||
const { getLogs2 } = require('../helper/cache/getLogs');
|
||||
|
||||
const MANAGER_ABI = {
|
||||
getPoolToken: "function getPoolToken(uint256 id, address token) view returns (address _address, uint256 amount, uint256, bool)",
|
||||
getPoolToken_2: "function pools(uint256 id) view returns (address router, uint8 poolType, address token, uint256 orderlyDepositFee, uint256 orderlyWithdrawalFee, uint256 activeAmount, uint256 hardcap)"
|
||||
@@ -21,6 +23,19 @@ const LP_TOKENS = [
|
||||
const VERTEX_MANAGER = '0x052Ab3fd33cADF9D9f227254252da3f996431f75'
|
||||
const ORDERLY_MANAGER = '0x79865208f5dc18a476f49e6dbfd7d79785cb8cd8'
|
||||
|
||||
// these addresses invoke in leverage borrowing to increase deUSD supply, TVL
|
||||
// they use initial USDC, USDT to mint deUSD, stake deUSD to sdeUSD
|
||||
// deposit sdeUSD to lending markets, borrow more USDC, USDT
|
||||
// after that, they transfer tokens to Stream Finance team wallet and manipulate TVL on Stream Finance too
|
||||
const BLACKLIST_MINTERS = [
|
||||
String('0x25E028A45a6012763A76145d7CEEa3587015e990').toLowerCase(),
|
||||
String('0x1bB3c7F27A9170194Dcc6B143c0FBC4ad162F123').toLowerCase(),
|
||||
]
|
||||
const DeUSDMinting = '0x69088d25a635D22dcbe7c4A5C7707B9cc64bD114';
|
||||
const DeUSDMintingFromBlock = 20319826;
|
||||
const MintEvent = 'event Mint(address minter, address benefactor, address beneficiary, address indexed collateral_asset, uint256 indexed collateral_amount,uint256 indexed deUSD_amount)';
|
||||
const RedeemEvent = 'event Redeem(address redeemer, address benefactor, address beneficiary, address indexed collateral_asset, uint256 indexed collateral_amount,uint256 indexed deUSD_amount)';
|
||||
|
||||
const orderlyIntegration = async (api, manager, poolIds) => {
|
||||
const pools = await api.multiCall({ abi: MANAGER_ABI.getPoolToken_2, calls: poolIds, target: manager });
|
||||
pools.forEach(i => api.add(i.token, i.activeAmount));
|
||||
@@ -37,9 +52,27 @@ const integration = async (api, manager, poolIds, tokens) => {
|
||||
module.exports = {
|
||||
ethereum: {
|
||||
tvl: async (api) => {
|
||||
const deusdSupply = await api.call({ target: deUSD, abi: "erc20:totalSupply" })
|
||||
api.add(deUSD, deusdSupply);
|
||||
const deusdSupply = Number(await api.call({ target: deUSD, abi: "erc20:totalSupply" }))
|
||||
|
||||
await api.sumTokens({ owners: [COMMITS_CONTRACT, COMMITS_VAULT, COMMITS_VAULT_2], tokens: [ADDRESSES.ethereum.STETH, ADDRESSES.null] })
|
||||
|
||||
let teamMintedBalance = 0;
|
||||
const mintEvents = await getLogs2({ api, target: DeUSDMinting, fromBlock: DeUSDMintingFromBlock, eventAbi: MintEvent, extraKey: `deusd-mint-${api.chain}` });
|
||||
const redeemEvents = await getLogs2({ api, target: DeUSDMinting, fromBlock: DeUSDMintingFromBlock, eventAbi: RedeemEvent, extraKey: `deusd-redeem-${api.chain}` });
|
||||
for (const event of mintEvents) {
|
||||
if (BLACKLIST_MINTERS.includes(String(event.beneficiary).toLowerCase())) {
|
||||
teamMintedBalance += Number(event.deUSD_amount)
|
||||
}
|
||||
}
|
||||
for (const event of redeemEvents) {
|
||||
if (BLACKLIST_MINTERS.includes(String(event.beneficiary).toLowerCase())) {
|
||||
teamMintedBalance -= Number(event.deUSD_amount)
|
||||
}
|
||||
}
|
||||
|
||||
teamMintedBalance = teamMintedBalance > 0 ? teamMintedBalance : 0;
|
||||
|
||||
api.add(deUSD, Number(deusdSupply) - teamMintedBalance);
|
||||
},
|
||||
pool2: sumTokensExport({ owner: DEUSD_LP_STAKING, tokens: LP_TOKENS })
|
||||
},
|
||||
@@ -59,6 +92,6 @@ module.exports = {
|
||||
sei: {
|
||||
tvl: sumTokensExport({ tokensAndOwners: [
|
||||
['0xBE574b6219C6D985d08712e90C21A88fd55f1ae8', '0x3490a00b308C5A1f0bBF67BA71361F543deBd08F']
|
||||
]})
|
||||
], permitFailure: true })
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user