diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index dd853c9..695f81b 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -26,6 +26,7 @@ env: PROVIDER_URL_KATANA: ${{ secrets.PROVIDER_URL_KATANA }} PROVIDER_URL_KATANA_1: ${{ secrets.PROVIDER_URL_KATANA_1 }} TELEGRAM_CHAT_ID_MORPHO: ${{ secrets.TELEGRAM_CHAT_ID_MORPHO }} + TELEGRAM_CHAT_ID_CAP: ${{ secrets.TELEGRAM_CHAT_ID_CAP }} TELEGRAM_BOT_TOKEN_DEFAULT: ${{ secrets.TELEGRAM_BOT_TOKEN_DEFAULT }} GRAPH_API_KEY: ${{ secrets.GRAPH_API_KEY }} TALLY_API_KEY: ${{ secrets.TALLY_API_KEY }} @@ -79,6 +80,9 @@ jobs: - name: Run Ethena Monitoring run: uv run ethena/ethena.py + - name: Run Cap Liquidity Monitoring + run: uv run cap/liquidity.py + # Check final hash - name: Check final hash id: final-hash diff --git a/cap/abi/CToken.json b/cap/abi/CToken.json new file mode 100644 index 0000000..2090775 --- /dev/null +++ b/cap/abi/CToken.json @@ -0,0 +1,1725 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AccessDenied", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [], + "name": "ECDSAInvalidSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "ECDSAInvalidSignatureS", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "ERC1967InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "ERC1967NonPayable", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "allowance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "needed", + "type": "uint256" + } + ], + "name": "ERC20InsufficientAllowance", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "needed", + "type": "uint256" + } + ], + "name": "ERC20InsufficientBalance", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "approver", + "type": "address" + } + ], + "name": "ERC20InvalidApprover", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "ERC20InvalidReceiver", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "ERC20InvalidSender", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "ERC20InvalidSpender", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "ERC2612ExpiredSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "ERC2612InvalidSigner", + "type": "error" + }, + { + "inputs": [], + "name": "EnforcedPause", + "type": "error" + }, + { + "inputs": [], + "name": "ExpectedPause", + "type": "error" + }, + { + "inputs": [], + "name": "FailedCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "currentNonce", + "type": "uint256" + } + ], + "name": "InvalidAccountNonce", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidBurnKinkRatio", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidInitialization", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidMinMintFee", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidMintKinkRatio", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidOptimalRatio", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "cap", + "type": "uint256" + } + ], + "name": "SetDepositCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "minMintFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "slope0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "slope1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "mintKinkRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "burnKinkRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "optimalRatio", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct IMinter.FeeData", + "name": "feeData", + "type": "tuple" + } + ], + "name": "SetFeeData", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "redeemFee", + "type": "uint256" + } + ], + "name": "SetRedeemFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "whitelisted", + "type": "bool" + } + ], + "name": "SetWhitelist", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "UPGRADE_INTERFACE_VERSION", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "addAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "assets", + "outputs": [ + { + "internalType": "address[]", + "name": "assetList", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "availableBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "borrow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmountOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_deadline", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [ + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "claimableInterest", + "outputs": [ + { + "internalType": "uint256", + "name": "interest", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "currentUtilizationIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "depositCap", + "outputs": [ + { + "internalType": "uint256", + "name": "cap", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "divestAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "fractionalReserveVault", + "outputs": [ + { + "internalType": "address", + "name": "vaultAddress", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "fractionalReserveVaults", + "outputs": [ + { + "internalType": "address[]", + "name": "vaultAddresses", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + } + ], + "name": "getBurnAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "getFeeData", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "minMintFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "slope0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "slope1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "mintKinkRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "burnKinkRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "optimalRatio", + "type": "uint256" + } + ], + "internalType": "struct IMinter.FeeData", + "name": "feeData", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + } + ], + "name": "getMintAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + } + ], + "name": "getRedeemAmount", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amountsOut", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "fees", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRedeemFee", + "outputs": [ + { + "internalType": "uint256", + "name": "redeemFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "getRemainingMintCapacity", + "outputs": [ + { + "internalType": "uint256", + "name": "remainingMintCapacity", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + }, + { + "internalType": "address", + "name": "_accessControl", + "type": "address" + }, + { + "internalType": "address", + "name": "_feeAuction", + "type": "address" + }, + { + "internalType": "address", + "name": "_oracle", + "type": "address" + }, + { + "internalType": "address[]", + "name": "_assets", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_insuranceFund", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "insuranceFund", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "interestReceiver", + "outputs": [ + { + "internalType": "address", + "name": "_interestReceiver", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "investAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "loaned", + "outputs": [ + { + "internalType": "uint256", + "name": "loanedAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minAmountOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_deadline", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "pauseAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "pauseProtocol", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "isPaused", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "realizeInterest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "_minAmountsOut", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_deadline", + "type": "uint256" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amountsOut", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "removeAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "repay", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "rescueERC20", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "reserve", + "outputs": [ + { + "internalType": "uint256", + "name": "reserveAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_cap", + "type": "uint256" + } + ], + "name": "setDepositCap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "minMintFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "slope0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "slope1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "mintKinkRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "burnKinkRatio", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "optimalRatio", + "type": "uint256" + } + ], + "internalType": "struct IMinter.FeeData", + "name": "_feeData", + "type": "tuple" + } + ], + "name": "setFeeData", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "internalType": "address", + "name": "_vault", + "type": "address" + } + ], + "name": "setFractionalReserveVault", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_insuranceFund", + "type": "address" + } + ], + "name": "setInsuranceFund", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_redeemFee", + "type": "uint256" + } + ], + "name": "setRedeemFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_reserve", + "type": "uint256" + } + ], + "name": "setReserve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "bool", + "name": "_whitelisted", + "type": "bool" + } + ], + "name": "setWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "totalBorrows", + "outputs": [ + { + "internalType": "uint256", + "name": "totalBorrow", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "totalSupplies", + "outputs": [ + { + "internalType": "uint256", + "name": "_totalSupply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "unpauseAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpauseProtocol", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_asset", + "type": "address" + } + ], + "name": "utilization", + "outputs": [ + { + "internalType": "uint256", + "name": "ratio", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + } + ], + "name": "whitelisted", + "outputs": [ + { + "internalType": "bool", + "name": "isWhitelisted", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/cap/abi/YearnV3Vault.json b/cap/abi/YearnV3Vault.json new file mode 100644 index 0000000..9ca8e0c --- /dev/null +++ b/cap/abi/YearnV3Vault.json @@ -0,0 +1,1870 @@ +[ + { + "name": "Deposit", + "inputs": [ + { + "name": "sender", + "type": "address", + "indexed": true + }, + { + "name": "owner", + "type": "address", + "indexed": true + }, + { + "name": "assets", + "type": "uint256", + "indexed": false + }, + { + "name": "shares", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "Withdraw", + "inputs": [ + { + "name": "sender", + "type": "address", + "indexed": true + }, + { + "name": "receiver", + "type": "address", + "indexed": true + }, + { + "name": "owner", + "type": "address", + "indexed": true + }, + { + "name": "assets", + "type": "uint256", + "indexed": false + }, + { + "name": "shares", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "Transfer", + "inputs": [ + { + "name": "sender", + "type": "address", + "indexed": true + }, + { + "name": "receiver", + "type": "address", + "indexed": true + }, + { + "name": "value", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "Approval", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true + }, + { + "name": "spender", + "type": "address", + "indexed": true + }, + { + "name": "value", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyChanged", + "inputs": [ + { + "name": "strategy", + "type": "address", + "indexed": true + }, + { + "name": "change_type", + "type": "uint256", + "indexed": true + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StrategyReported", + "inputs": [ + { + "name": "strategy", + "type": "address", + "indexed": true + }, + { + "name": "gain", + "type": "uint256", + "indexed": false + }, + { + "name": "loss", + "type": "uint256", + "indexed": false + }, + { + "name": "current_debt", + "type": "uint256", + "indexed": false + }, + { + "name": "protocol_fees", + "type": "uint256", + "indexed": false + }, + { + "name": "total_fees", + "type": "uint256", + "indexed": false + }, + { + "name": "total_refunds", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "DebtUpdated", + "inputs": [ + { + "name": "strategy", + "type": "address", + "indexed": true + }, + { + "name": "current_debt", + "type": "uint256", + "indexed": false + }, + { + "name": "new_debt", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RoleSet", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": true + }, + { + "name": "role", + "type": "uint256", + "indexed": true + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateFutureRoleManager", + "inputs": [ + { + "name": "future_role_manager", + "type": "address", + "indexed": true + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateRoleManager", + "inputs": [ + { + "name": "role_manager", + "type": "address", + "indexed": true + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateAccountant", + "inputs": [ + { + "name": "accountant", + "type": "address", + "indexed": true + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateDepositLimitModule", + "inputs": [ + { + "name": "deposit_limit_module", + "type": "address", + "indexed": true + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateWithdrawLimitModule", + "inputs": [ + { + "name": "withdraw_limit_module", + "type": "address", + "indexed": true + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateDefaultQueue", + "inputs": [ + { + "name": "new_default_queue", + "type": "address[]", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateUseDefaultQueue", + "inputs": [ + { + "name": "use_default_queue", + "type": "bool", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateAutoAllocate", + "inputs": [ + { + "name": "auto_allocate", + "type": "bool", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdatedMaxDebtForStrategy", + "inputs": [ + { + "name": "sender", + "type": "address", + "indexed": true + }, + { + "name": "strategy", + "type": "address", + "indexed": true + }, + { + "name": "new_debt", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateDepositLimit", + "inputs": [ + { + "name": "deposit_limit", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateMinimumTotalIdle", + "inputs": [ + { + "name": "minimum_total_idle", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "UpdateProfitMaxUnlockTime", + "inputs": [ + { + "name": "profit_max_unlock_time", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "DebtPurchased", + "inputs": [ + { + "name": "strategy", + "type": "address", + "indexed": true + }, + { + "name": "amount", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "Shutdown", + "inputs": [], + "anonymous": false, + "type": "event" + }, + { + "stateMutability": "nonpayable", + "type": "constructor", + "inputs": [], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "initialize", + "inputs": [ + { + "name": "asset", + "type": "address" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "role_manager", + "type": "address" + }, + { + "name": "profit_max_unlock_time", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "setName", + "inputs": [ + { + "name": "name", + "type": "string" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "setSymbol", + "inputs": [ + { + "name": "symbol", + "type": "string" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_accountant", + "inputs": [ + { + "name": "new_accountant", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_default_queue", + "inputs": [ + { + "name": "new_default_queue", + "type": "address[]" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_use_default_queue", + "inputs": [ + { + "name": "use_default_queue", + "type": "bool" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_auto_allocate", + "inputs": [ + { + "name": "auto_allocate", + "type": "bool" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_deposit_limit", + "inputs": [ + { + "name": "deposit_limit", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_deposit_limit", + "inputs": [ + { + "name": "deposit_limit", + "type": "uint256" + }, + { + "name": "override", + "type": "bool" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_deposit_limit_module", + "inputs": [ + { + "name": "deposit_limit_module", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_deposit_limit_module", + "inputs": [ + { + "name": "deposit_limit_module", + "type": "address" + }, + { + "name": "override", + "type": "bool" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_withdraw_limit_module", + "inputs": [ + { + "name": "withdraw_limit_module", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_minimum_total_idle", + "inputs": [ + { + "name": "minimum_total_idle", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "setProfitMaxUnlockTime", + "inputs": [ + { + "name": "new_profit_max_unlock_time", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_role", + "inputs": [ + { + "name": "account", + "type": "address" + }, + { + "name": "role", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "add_role", + "inputs": [ + { + "name": "account", + "type": "address" + }, + { + "name": "role", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "remove_role", + "inputs": [ + { + "name": "account", + "type": "address" + }, + { + "name": "role", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "transfer_role_manager", + "inputs": [ + { + "name": "role_manager", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "accept_role_manager", + "inputs": [], + "outputs": [] + }, + { + "stateMutability": "view", + "type": "function", + "name": "isShutdown", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "unlockedShares", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "pricePerShare", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_default_queue", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address[]" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "process_report", + "inputs": [ + { + "name": "strategy", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "buy_debt", + "inputs": [ + { + "name": "strategy", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "add_strategy", + "inputs": [ + { + "name": "new_strategy", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "add_strategy", + "inputs": [ + { + "name": "new_strategy", + "type": "address" + }, + { + "name": "add_to_queue", + "type": "bool" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "revoke_strategy", + "inputs": [ + { + "name": "strategy", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "force_revoke_strategy", + "inputs": [ + { + "name": "strategy", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "update_max_debt_for_strategy", + "inputs": [ + { + "name": "strategy", + "type": "address" + }, + { + "name": "new_max_debt", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "update_debt", + "inputs": [ + { + "name": "strategy", + "type": "address" + }, + { + "name": "target_debt", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "update_debt", + "inputs": [ + { + "name": "strategy", + "type": "address" + }, + { + "name": "target_debt", + "type": "uint256" + }, + { + "name": "max_loss", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "shutdown_vault", + "inputs": [], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "deposit", + "inputs": [ + { + "name": "assets", + "type": "uint256" + }, + { + "name": "receiver", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "mint", + "inputs": [ + { + "name": "shares", + "type": "uint256" + }, + { + "name": "receiver", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "withdraw", + "inputs": [ + { + "name": "assets", + "type": "uint256" + }, + { + "name": "receiver", + "type": "address" + }, + { + "name": "owner", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "withdraw", + "inputs": [ + { + "name": "assets", + "type": "uint256" + }, + { + "name": "receiver", + "type": "address" + }, + { + "name": "owner", + "type": "address" + }, + { + "name": "max_loss", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "withdraw", + "inputs": [ + { + "name": "assets", + "type": "uint256" + }, + { + "name": "receiver", + "type": "address" + }, + { + "name": "owner", + "type": "address" + }, + { + "name": "max_loss", + "type": "uint256" + }, + { + "name": "strategies", + "type": "address[]" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "redeem", + "inputs": [ + { + "name": "shares", + "type": "uint256" + }, + { + "name": "receiver", + "type": "address" + }, + { + "name": "owner", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "redeem", + "inputs": [ + { + "name": "shares", + "type": "uint256" + }, + { + "name": "receiver", + "type": "address" + }, + { + "name": "owner", + "type": "address" + }, + { + "name": "max_loss", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "redeem", + "inputs": [ + { + "name": "shares", + "type": "uint256" + }, + { + "name": "receiver", + "type": "address" + }, + { + "name": "owner", + "type": "address" + }, + { + "name": "max_loss", + "type": "uint256" + }, + { + "name": "strategies", + "type": "address[]" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "approve", + "inputs": [ + { + "name": "spender", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "transfer", + "inputs": [ + { + "name": "receiver", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "transferFrom", + "inputs": [ + { + "name": "sender", + "type": "address" + }, + { + "name": "receiver", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "permit", + "inputs": [ + { + "name": "owner", + "type": "address" + }, + { + "name": "spender", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + }, + { + "name": "deadline", + "type": "uint256" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "balanceOf", + "inputs": [ + { + "name": "addr", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "totalSupply", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "totalAssets", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "totalIdle", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "totalDebt", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "convertToShares", + "inputs": [ + { + "name": "assets", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "previewDeposit", + "inputs": [ + { + "name": "assets", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "previewMint", + "inputs": [ + { + "name": "shares", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "convertToAssets", + "inputs": [ + { + "name": "shares", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "maxDeposit", + "inputs": [ + { + "name": "receiver", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "maxMint", + "inputs": [ + { + "name": "receiver", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "maxWithdraw", + "inputs": [ + { + "name": "owner", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "maxWithdraw", + "inputs": [ + { + "name": "owner", + "type": "address" + }, + { + "name": "max_loss", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "maxWithdraw", + "inputs": [ + { + "name": "owner", + "type": "address" + }, + { + "name": "max_loss", + "type": "uint256" + }, + { + "name": "strategies", + "type": "address[]" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "maxRedeem", + "inputs": [ + { + "name": "owner", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "maxRedeem", + "inputs": [ + { + "name": "owner", + "type": "address" + }, + { + "name": "max_loss", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "maxRedeem", + "inputs": [ + { + "name": "owner", + "type": "address" + }, + { + "name": "max_loss", + "type": "uint256" + }, + { + "name": "strategies", + "type": "address[]" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "previewWithdraw", + "inputs": [ + { + "name": "assets", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "previewRedeem", + "inputs": [ + { + "name": "shares", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "FACTORY", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "pure", + "type": "function", + "name": "apiVersion", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "assess_share_of_unrealised_losses", + "inputs": [ + { + "name": "strategy", + "type": "address" + }, + { + "name": "assets_needed", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "profitMaxUnlockTime", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "fullProfitUnlockDate", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "profitUnlockingRate", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "lastProfitUpdate", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "DOMAIN_SEPARATOR", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "asset", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "decimals", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint8" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "strategies", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "components": [ + { + "name": "activation", + "type": "uint256" + }, + { + "name": "last_report", + "type": "uint256" + }, + { + "name": "current_debt", + "type": "uint256" + }, + { + "name": "max_debt", + "type": "uint256" + } + ] + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "default_queue", + "inputs": [ + { + "name": "arg0", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "use_default_queue", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "auto_allocate", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "allowance", + "inputs": [ + { + "name": "arg0", + "type": "address" + }, + { + "name": "arg1", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "minimum_total_idle", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "deposit_limit", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "accountant", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "deposit_limit_module", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "withdraw_limit_module", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "roles", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "role_manager", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_role_manager", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "name", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "symbol", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "nonces", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + } +] \ No newline at end of file diff --git a/cap/liquidity.py b/cap/liquidity.py new file mode 100644 index 0000000..58f4d7b --- /dev/null +++ b/cap/liquidity.py @@ -0,0 +1,58 @@ +from utils.abi import load_abi +from utils.chains import Chain +from utils.telegram import send_telegram_message +from utils.web3_wrapper import ChainManager + +CUSD = "0xcCcc62962d17b8914c62D74FfB843d73B2a3cccC" +PROTOCOL = "cap" +ALERT_THRESHOLD = 100_000_000 # 100M + + +def main(): + client = ChainManager.get_client(Chain.MAINNET) + + ctoken = client.eth.contract(address=CUSD, abi=load_abi("cap/abi/CToken.json")) # aka cusd + + assets = ctoken.functions.assets().call() + + # Batch 1: resolve vault addresses for each asset + with client.batch_requests() as batch: + for asset in assets: + batch.add(ctoken.functions.fractionalReserveVault(asset)) + vault_addresses = batch.execute() + + # Batch 2: for each asset, get vault maxWithdraw for CUSD owner, token balance, decimals, and symbol + with client.batch_requests() as batch: + for asset, vault_addr in zip(assets, vault_addresses): + vault = client.eth.contract(address=vault_addr, abi=load_abi("cap/abi/YearnV3Vault.json")) + token = client.eth.contract(address=asset, abi=load_abi("common-abi/ERC20.json")) + batch.add(vault.functions.maxWithdraw(CUSD)) + batch.add(token.functions.balanceOf(CUSD)) + batch.add(token.functions.decimals()) + batch.add(token.functions.symbol()) + responses = batch.execute() + + # Parse batched results (4 entries per asset) + lines = [] + total_normalized = 0 + for i in range(0, len(responses), 4): + vault_withdrawable = responses[i] or 0 + direct_balance = responses[i + 1] or 0 + decimals = responses[i + 2] if responses[i + 2] is not None else 18 + symbol = responses[i + 3] or "UNKNOWN" + + total_units = int(vault_withdrawable) + int(direct_balance) + + divisor = 10 ** int(decimals) + normalized = total_units / divisor if divisor else 0 + line = f"{symbol}: {normalized:,.6f}" + total_normalized += normalized + lines.append(line) + + if total_normalized < ALERT_THRESHOLD: + message = "💧 CAP Withdrawable Liquidity (Mainnet)\n" + "\n".join(lines) + send_telegram_message(message, PROTOCOL, False) + + +if __name__ == "__main__": + main() diff --git a/compound/test_tally.py b/compound/test_tally.py index 25fef89..eaba39d 100644 --- a/compound/test_tally.py +++ b/compound/test_tally.py @@ -63,7 +63,10 @@ def test_with_different_timeouts(): try: start_time = time.time() response = requests.post( - "https://api.tally.xyz/query", json={"query": query}, headers=headers, timeout=timeout + "https://api.tally.xyz/query", + json={"query": query}, + headers=headers, + timeout=timeout, ) elapsed = time.time() - start_time diff --git a/ethena/ethena.py b/ethena/ethena.py index f665b06..2a2fecf 100644 --- a/ethena/ethena.py +++ b/ethena/ethena.py @@ -127,7 +127,9 @@ def get_llamarisk_data() -> LlamaRiskData | None: hours_ago = 12 if is_stale_timestamp(timestamp_collateral, hours_ago): send_telegram_message( - f"⚠️ Collateral data is older than {hours_ago} hours. Timestamp: {timestamp_collateral}", PROTOCOL, True + f"⚠️ Collateral data is older than {hours_ago} hours. Timestamp: {timestamp_collateral}", + PROTOCOL, + True, ) if is_stale_timestamp(timestamp_chain, hours_ago): @@ -136,7 +138,9 @@ def get_llamarisk_data() -> LlamaRiskData | None: if is_stale_timestamp(timestamp_reserve, hours_ago): send_telegram_message( - f"⚠️ Reserve data is older than {hours_ago} hours. Timestamp: {timestamp_reserve}", PROTOCOL, True + f"⚠️ Reserve data is older than {hours_ago} hours. Timestamp: {timestamp_reserve}", + PROTOCOL, + True, ) # sum all collateral values diff --git a/lrt-pegs/fluid/main.py b/lrt-pegs/fluid/main.py index 4cee751..a6b49e2 100644 --- a/lrt-pegs/fluid/main.py +++ b/lrt-pegs/fluid/main.py @@ -56,14 +56,21 @@ def process_pools(chain: Chain = Chain.MAINNET): raise ValueError(f"Expected {len(POOL_CONFIGS)} responses from batch, got: {len(responses)}") # Process results - for (pool_name, pool_address, idx_lrt, idx_other_token, peg_threshold), pool_reserves in zip( - POOL_CONFIGS, responses - ): + for ( + pool_name, + pool_address, + idx_lrt, + idx_other_token, + peg_threshold, + ), pool_reserves in zip(POOL_CONFIGS, responses): assert pool_address == pool_reserves[0], f"Expected {pool_address} but got {pool_reserves[0]}" lrt_balance = int(pool_reserves[COLLATERAL_RESERVES_INDEX][idx_lrt]) other_token_balance = int(pool_reserves[COLLATERAL_RESERVES_INDEX][idx_other_token]) if lrt_balance < MIN_ASSET_BALANCE or other_token_balance < MIN_ASSET_BALANCE: - send_telegram_message(f"🚨 Fluid Alert! {pool_name} has less than {MIN_ASSET_BALANCE} balance", PROTOCOL) + send_telegram_message( + f"🚨 Fluid Alert! {pool_name} has less than {MIN_ASSET_BALANCE} balance", + PROTOCOL, + ) percentage = (lrt_balance / (lrt_balance + other_token_balance)) * 100 print(f"{pool_name} ratio is {percentage:.2f}%") diff --git a/lrt-pegs/origin_protocol.py b/lrt-pegs/origin_protocol.py index 159fc74..8df6f6b 100644 --- a/lrt-pegs/origin_protocol.py +++ b/lrt-pegs/origin_protocol.py @@ -51,7 +51,9 @@ def process_origin(chain: Chain): responses = client.execute_batch(batch) if len(responses) != 2: send_telegram_message( - f"🚨 Origin Protocol Alert! Expected 2 responses from batch, got: {len(responses)}", PROTOCOL, True + f"🚨 Origin Protocol Alert! Expected 2 responses from batch, got: {len(responses)}", + PROTOCOL, + True, ) redeem_value = responses[0] diff --git a/moonwell/bad_debt.py b/moonwell/bad_debt.py index 0d21115..75ce330 100644 --- a/moonwell/bad_debt.py +++ b/moonwell/bad_debt.py @@ -112,7 +112,9 @@ def main(): check_thresholds(metrics) else: send_telegram_message( - "🚨 Moonwell metrics cannot be fetched from any source", PROTOCOL, disable_notification=True + "🚨 Moonwell metrics cannot be fetched from any source", + PROTOCOL, + disable_notification=True, ) diff --git a/morpho/governance.py b/morpho/governance.py index c0a814f..85ef1f6 100644 --- a/morpho/governance.py +++ b/morpho/governance.py @@ -3,7 +3,10 @@ from web3 import Web3 from utils.abi import load_abi -from utils.cache import get_last_executed_morpho_from_file, write_last_executed_morpho_to_file +from utils.cache import ( + get_last_executed_morpho_from_file, + write_last_executed_morpho_to_file, +) from utils.chains import Chain from utils.telegram import send_telegram_message from utils.web3_wrapper import ChainManager diff --git a/morpho/markets.py b/morpho/markets.py index 52dc06e..8f350e6 100644 --- a/morpho/markets.py +++ b/morpho/markets.py @@ -103,12 +103,18 @@ ], # USDT vaults - using addresses from VAULTS_BY_CHAIN as source of truth "0x2DCa96907fde857dd3D816880A0df407eeB2D2F2": [ # USDT asset address on Katana - ["Yearn OG USDT", "0x8ED68f91AfbE5871dCE31ae007a936ebE8511d47"], # Corrected from VAULTS_BY_CHAIN + [ + "Yearn OG USDT", + "0x8ED68f91AfbE5871dCE31ae007a936ebE8511d47", + ], # Corrected from VAULTS_BY_CHAIN ["Gauntlet USDT", "0x1ecDC3F2B5E90bfB55fF45a7476FF98A8957388E"], ], # WETH vaults - using addresses from VAULTS_BY_CHAIN as source of truth "0xEE7D8BCFb72bC1880D0Cf19822eB0A2e6577aB62": [ # WETH asset address on Katana - ["Gauntlet WETH", "0xC5e7AB07030305fc925175b25B93b285d40dCdFf"], # Corrected from VAULTS_BY_CHAIN + [ + "Gauntlet WETH", + "0xC5e7AB07030305fc925175b25B93b285d40dCdFf", + ], # Corrected from VAULTS_BY_CHAIN ["Yearn OG WETH", "0xFaDe0C546f44e33C134c4036207B314AC643dc2E"], ], # WBTC vaults - using addresses from VAULTS_BY_CHAIN as source of truth @@ -551,7 +557,9 @@ def group_vaults_by_chain(vaults_data: List[Dict[str, Any]]) -> Dict[Chain, List def find_yv_vaults_for_asset( - chain_vaults: List[Dict[str, Any]], asset_address: str, yv_vault_addresses: List[str] + chain_vaults: List[Dict[str, Any]], + asset_address: str, + yv_vault_addresses: List[str], ) -> List[Dict[str, Any]]: """Find all YV collateral vaults for a specific asset.""" asset_yv_vaults = [] @@ -638,11 +646,20 @@ def check_yv_collateral_liquidity_for_chain(chain: Chain, chain_vaults: List[Dic asset_symbol = asset_yv_vaults[0].get("asset", {}).get("symbol", "UNKNOWN") # Calculate combined metrics for this asset - combined_total_assets, combined_liquidity, vault_names = calculate_combined_metrics(asset_yv_vaults) + ( + combined_total_assets, + combined_liquidity, + vault_names, + ) = calculate_combined_metrics(asset_yv_vaults) # Check threshold and alert if needed check_combined_liquidity_threshold( - asset_symbol, chain, combined_total_assets, combined_liquidity, vault_names, len(asset_yv_vaults) + asset_symbol, + chain, + combined_total_assets, + combined_liquidity, + vault_names, + len(asset_yv_vaults), ) @@ -773,13 +790,23 @@ def main() -> None: response = requests.post(API_URL, json=json_data, timeout=30) response.raise_for_status() except requests.RequestException as e: - send_telegram_message(f"🚨 Problem with fetching data for Morpho markets: {str(e)} 🚨", PROTOCOL, True, True) + send_telegram_message( + f"🚨 Problem with fetching data for Morpho markets: {str(e)} 🚨", + PROTOCOL, + True, + True, + ) return data = response.json() if "errors" in data: error_msg = data["errors"][0]["message"] if data["errors"] else "Unknown GraphQL error" - send_telegram_message(f"🚨 GraphQL error when fetching Morpho data: {error_msg} 🚨", PROTOCOL, True, True) + send_telegram_message( + f"🚨 GraphQL error when fetching Morpho data: {error_msg} 🚨", + PROTOCOL, + True, + True, + ) return vaults_data = data.get("data", {}).get("vaults", {}).get("items", []) diff --git a/morpho/markets_graph.py b/morpho/markets_graph.py index bbe053d..b868733 100644 --- a/morpho/markets_graph.py +++ b/morpho/markets_graph.py @@ -333,7 +333,12 @@ def check_graph_data_for_chain(chain: Chain): response = requests.post(api_url, json=json_data, timeout=30) response.raise_for_status() except requests.RequestException as e: - send_telegram_message(f"🚨 Problem with fetching data for Morpho markets: {str(e)} 🚨", PROTOCOL, True, True) + send_telegram_message( + f"🚨 Problem with fetching data for Morpho markets: {str(e)} 🚨", + PROTOCOL, + True, + True, + ) return data = response.json() @@ -342,7 +347,12 @@ def check_graph_data_for_chain(chain: Chain): if "indexing_error" in error_msg: print(f"🚨 GraphQL indexing error when fetching Morpho data: {error_msg} 🚨") else: - send_telegram_message(f"🚨 GraphQL error when fetching Morpho data: {error_msg} 🚨", PROTOCOL, True, True) + send_telegram_message( + f"🚨 GraphQL error when fetching Morpho data: {error_msg} 🚨", + PROTOCOL, + True, + True, + ) return vaults_data = data.get("data", {}).get("metaMorphos", {}) diff --git a/resolv/resolv.py b/resolv/resolv.py index cce3b51..49ade1f 100644 --- a/resolv/resolv.py +++ b/resolv/resolv.py @@ -2,7 +2,11 @@ from datetime import datetime from utils.abi import load_abi -from utils.cache import cache_filename, get_last_value_for_key_from_file, write_last_value_to_file +from utils.cache import ( + cache_filename, + get_last_value_for_key_from_file, + write_last_value_to_file, +) from utils.chains import Chain from utils.telegram import send_telegram_message from utils.web3_wrapper import ChainManager diff --git a/utils/gauntlet.py b/utils/gauntlet.py index e43b687..6f4300a 100644 --- a/utils/gauntlet.py +++ b/utils/gauntlet.py @@ -63,7 +63,10 @@ "SolvBTC", 4, ], # Uses chainlink oracle solvBTC/BTC and BTC/USD https://solv.finance/ - ["USDtb", 4], # onboarded by aave: https://app.aave.com/governance/v3/proposal/?proposalId=305 + [ + "USDtb", + 4, + ], # onboarded by aave: https://app.aave.com/governance/v3/proposal/?proposalId=305 # Risk Tier 5 [ "USD0++", diff --git a/utils/telegram.py b/utils/telegram.py index 6ab185b..4f59557 100644 --- a/utils/telegram.py +++ b/utils/telegram.py @@ -16,7 +16,10 @@ class TelegramError(Exception): def send_telegram_message( - message: str, protocol: str, disable_notification: bool = False, plain_text: bool = False + message: str, + protocol: str, + disable_notification: bool = False, + plain_text: bool = False, ) -> None: """ Send a message to a Telegram chat using a bot.