diff --git a/.gitignore b/.gitignore index 70fe6ecd..48fb369b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ /.idea .env -.yarn.lock \ No newline at end of file +.yarn.lock +.DS_Store \ No newline at end of file diff --git a/abi/meta-morpho.json b/abi/meta-morpho.json new file mode 100644 index 00000000..cd2bc443 --- /dev/null +++ b/abi/meta-morpho.json @@ -0,0 +1,1065 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "morpho", "type": "address" }, + { "internalType": "uint256", "name": "initialTimelock", "type": "uint256" }, + { "internalType": "address", "name": "_asset", "type": "address" }, + { "internalType": "string", "name": "_name", "type": "string" }, + { "internalType": "string", "name": "_symbol", "type": "string" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { "inputs": [], "name": "AboveMaxTimelock", "type": "error" }, + { + "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "AddressInsufficientBalance", + "type": "error" + }, + { "inputs": [], "name": "AllCapsReached", "type": "error" }, + { "inputs": [], "name": "AlreadyPending", "type": "error" }, + { "inputs": [], "name": "AlreadySet", "type": "error" }, + { "inputs": [], "name": "BelowMinTimelock", "type": "error" }, + { "inputs": [{ "internalType": "Id", "name": "id", "type": "bytes32" }], "name": "DuplicateMarket", "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": "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": [ + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "uint256", "name": "max", "type": "uint256" } + ], + "name": "ERC4626ExceededMaxDeposit", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "uint256", "name": "shares", "type": "uint256" }, + { "internalType": "uint256", "name": "max", "type": "uint256" } + ], + "name": "ERC4626ExceededMaxMint", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "uint256", "name": "shares", "type": "uint256" }, + { "internalType": "uint256", "name": "max", "type": "uint256" } + ], + "name": "ERC4626ExceededMaxRedeem", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "uint256", "name": "max", "type": "uint256" } + ], + "name": "ERC4626ExceededMaxWithdraw", + "type": "error" + }, + { "inputs": [], "name": "FailedInnerCall", "type": "error" }, + { + "inputs": [{ "internalType": "Id", "name": "id", "type": "bytes32" }], + "name": "InconsistentAsset", + "type": "error" + }, + { "inputs": [], "name": "InconsistentReallocation", "type": "error" }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "uint256", "name": "currentNonce", "type": "uint256" } + ], + "name": "InvalidAccountNonce", + "type": "error" + }, + { + "inputs": [{ "internalType": "Id", "name": "id", "type": "bytes32" }], + "name": "InvalidMarketRemovalNonZeroCap", + "type": "error" + }, + { + "inputs": [{ "internalType": "Id", "name": "id", "type": "bytes32" }], + "name": "InvalidMarketRemovalNonZeroSupply", + "type": "error" + }, + { + "inputs": [{ "internalType": "Id", "name": "id", "type": "bytes32" }], + "name": "InvalidMarketRemovalTimelockNotElapsed", + "type": "error" + }, + { "inputs": [], "name": "InvalidShortString", "type": "error" }, + { "inputs": [], "name": "MarketNotCreated", "type": "error" }, + { + "inputs": [{ "internalType": "Id", "name": "id", "type": "bytes32" }], + "name": "MarketNotEnabled", + "type": "error" + }, + { "inputs": [], "name": "MathOverflowedMulDiv", "type": "error" }, + { "inputs": [], "name": "MaxFeeExceeded", "type": "error" }, + { "inputs": [], "name": "MaxQueueLengthExceeded", "type": "error" }, + { "inputs": [], "name": "NoPendingValue", "type": "error" }, + { "inputs": [], "name": "NonZeroCap", "type": "error" }, + { "inputs": [], "name": "NotAllocatorRole", "type": "error" }, + { "inputs": [], "name": "NotCuratorNorGuardianRole", "type": "error" }, + { "inputs": [], "name": "NotCuratorRole", "type": "error" }, + { "inputs": [], "name": "NotEnoughLiquidity", "type": "error" }, + { "inputs": [], "name": "NotGuardianRole", "type": "error" }, + { + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { "inputs": [{ "internalType": "Id", "name": "id", "type": "bytes32" }], "name": "PendingCap", "type": "error" }, + { "inputs": [], "name": "PendingRemoval", "type": "error" }, + { + "inputs": [ + { "internalType": "uint8", "name": "bits", "type": "uint8" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "SafeCastOverflowedUintDowncast", + "type": "error" + }, + { + "inputs": [{ "internalType": "address", "name": "token", "type": "address" }], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "inputs": [{ "internalType": "string", "name": "str", "type": "string" }], + "name": "StringTooLong", + "type": "error" + }, + { + "inputs": [{ "internalType": "Id", "name": "id", "type": "bytes32" }], + "name": "SupplyCapExceeded", + "type": "error" + }, + { "inputs": [], "name": "TimelockNotElapsed", "type": "error" }, + { + "inputs": [{ "internalType": "Id", "name": "id", "type": "bytes32" }], + "name": "UnauthorizedMarket", + "type": "error" + }, + { "inputs": [], "name": "ZeroAddress", "type": "error" }, + { "inputs": [], "name": "ZeroFeeRecipient", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "newTotalAssets", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "feeShares", "type": "uint256" } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "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": [ + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "shares", "type": "uint256" } + ], + "name": "Deposit", + "type": "event" + }, + { "anonymous": false, "inputs": [], "name": "EIP712DomainChanged", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" }, + { "indexed": false, "internalType": "uint256", "name": "suppliedAssets", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "suppliedShares", "type": "uint256" } + ], + "name": "ReallocateSupply", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" }, + { "indexed": false, "internalType": "uint256", "name": "withdrawnAssets", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "withdrawnShares", "type": "uint256" } + ], + "name": "ReallocateWithdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" } + ], + "name": "RevokePendingCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "caller", "type": "address" }], + "name": "RevokePendingGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" } + ], + "name": "RevokePendingMarketRemoval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "caller", "type": "address" }], + "name": "RevokePendingTimelock", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" }, + { "indexed": false, "internalType": "uint256", "name": "cap", "type": "uint256" } + ], + "name": "SetCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "newCurator", "type": "address" }], + "name": "SetCurator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "newFee", "type": "uint256" } + ], + "name": "SetFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "newFeeRecipient", "type": "address" }], + "name": "SetFeeRecipient", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "guardian", "type": "address" } + ], + "name": "SetGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "allocator", "type": "address" }, + { "indexed": false, "internalType": "bool", "name": "isAllocator", "type": "bool" } + ], + "name": "SetIsAllocator", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "newSkimRecipient", "type": "address" }], + "name": "SetSkimRecipient", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": false, "internalType": "Id[]", "name": "newSupplyQueue", "type": "bytes32[]" } + ], + "name": "SetSupplyQueue", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "newTimelock", "type": "uint256" } + ], + "name": "SetTimelock", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": false, "internalType": "Id[]", "name": "newWithdrawQueue", "type": "bytes32[]" } + ], + "name": "SetWithdrawQueue", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "token", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Skim", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" }, + { "indexed": false, "internalType": "uint256", "name": "cap", "type": "uint256" } + ], + "name": "SubmitCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "newGuardian", "type": "address" }], + "name": "SubmitGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" } + ], + "name": "SubmitMarketRemoval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "newTimelock", "type": "uint256" }], + "name": "SubmitTimelock", + "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": "uint256", "name": "updatedTotalAssets", "type": "uint256" }], + "name": "UpdateLastTotalAssets", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "receiver", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "shares", "type": "uint256" } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DECIMALS_OFFSET", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MORPHO", + "outputs": [{ "internalType": "contract IMorpho", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "internalType": "struct MarketParams", + "name": "marketParams", + "type": "tuple" + } + ], + "name": "acceptCap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "acceptGuardian", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { "inputs": [], "name": "acceptOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { "inputs": [], "name": "acceptTimelock", "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": "asset", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "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": "Id", "name": "", "type": "bytes32" }], + "name": "config", + "outputs": [ + { "internalType": "uint184", "name": "cap", "type": "uint184" }, + { "internalType": "bool", "name": "enabled", "type": "bool" }, + { "internalType": "uint64", "name": "removableAt", "type": "uint64" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], + "name": "convertToAssets", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "assets", "type": "uint256" }], + "name": "convertToShares", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "curator", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "address", "name": "receiver", "type": "address" } + ], + "name": "deposit", + "outputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], + "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": [], + "name": "fee", + "outputs": [{ "internalType": "uint96", "name": "", "type": "uint96" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeRecipient", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "guardian", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "isAllocator", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastTotalAssets", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "maxDeposit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "maxMint", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "maxRedeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "maxWithdraw", + "outputs": [{ "internalType": "uint256", "name": "assets", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "shares", "type": "uint256" }, + { "internalType": "address", "name": "receiver", "type": "address" } + ], + "name": "mint", + "outputs": [{ "internalType": "uint256", "name": "assets", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes[]", "name": "data", "type": "bytes[]" }], + "name": "multicall", + "outputs": [{ "internalType": "bytes[]", "name": "results", "type": "bytes[]" }], + "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": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "Id", "name": "", "type": "bytes32" }], + "name": "pendingCap", + "outputs": [ + { "internalType": "uint192", "name": "value", "type": "uint192" }, + { "internalType": "uint64", "name": "validAt", "type": "uint64" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingGuardian", + "outputs": [ + { "internalType": "address", "name": "value", "type": "address" }, + { "internalType": "uint64", "name": "validAt", "type": "uint64" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingTimelock", + "outputs": [ + { "internalType": "uint192", "name": "value", "type": "uint192" }, + { "internalType": "uint64", "name": "validAt", "type": "uint64" } + ], + "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": [{ "internalType": "uint256", "name": "assets", "type": "uint256" }], + "name": "previewDeposit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], + "name": "previewMint", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], + "name": "previewRedeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "assets", "type": "uint256" }], + "name": "previewWithdraw", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "internalType": "struct MarketParams", + "name": "marketParams", + "type": "tuple" + }, + { "internalType": "uint256", "name": "assets", "type": "uint256" } + ], + "internalType": "struct MarketAllocation[]", + "name": "allocations", + "type": "tuple[]" + } + ], + "name": "reallocate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "shares", "type": "uint256" }, + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "redeem", + "outputs": [{ "internalType": "uint256", "name": "assets", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "Id", "name": "id", "type": "bytes32" }], + "name": "revokePendingCap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "revokePendingGuardian", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "Id", "name": "id", "type": "bytes32" }], + "name": "revokePendingMarketRemoval", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "revokePendingTimelock", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "newCurator", "type": "address" }], + "name": "setCurator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "newFee", "type": "uint256" }], + "name": "setFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newFeeRecipient", "type": "address" }], + "name": "setFeeRecipient", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "newAllocator", "type": "address" }, + { "internalType": "bool", "name": "newIsAllocator", "type": "bool" } + ], + "name": "setIsAllocator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newSkimRecipient", "type": "address" }], + "name": "setSkimRecipient", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "Id[]", "name": "newSupplyQueue", "type": "bytes32[]" }], + "name": "setSupplyQueue", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "token", "type": "address" }], + "name": "skim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "skimRecipient", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "internalType": "struct MarketParams", + "name": "marketParams", + "type": "tuple" + }, + { "internalType": "uint256", "name": "newSupplyCap", "type": "uint256" } + ], + "name": "submitCap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newGuardian", "type": "address" }], + "name": "submitGuardian", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "internalType": "struct MarketParams", + "name": "marketParams", + "type": "tuple" + } + ], + "name": "submitMarketRemoval", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "newTimelock", "type": "uint256" }], + "name": "submitTimelock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "supplyQueue", + "outputs": [{ "internalType": "Id", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "supplyQueueLength", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "timelock", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssets", + "outputs": [{ "internalType": "uint256", "name": "assets", "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": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256[]", "name": "indexes", "type": "uint256[]" }], + "name": "updateWithdrawQueue", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "address", "name": "receiver", "type": "address" }, + { "internalType": "address", "name": "owner", "type": "address" } + ], + "name": "withdraw", + "outputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "withdrawQueue", + "outputs": [{ "internalType": "Id", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawQueueLength", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/abi/morpho.json b/abi/morpho.json new file mode 100644 index 00000000..727ef9c1 --- /dev/null +++ b/abi/morpho.json @@ -0,0 +1,612 @@ +[ + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" }, + { "indexed": false, "internalType": "uint256", "name": "prevBorrowRate", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "interest", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "feeShares", "type": "uint256" } + ], + "name": "AccrueInterest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" }, + { "indexed": false, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "onBehalf", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "receiver", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "shares", "type": "uint256" } + ], + "name": "Borrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" }, + { + "components": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "indexed": false, + "internalType": "struct MarketParams", + "name": "marketParams", + "type": "tuple" + } + ], + "name": "CreateMarket", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "irm", "type": "address" }], + "name": "EnableIrm", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "lltv", "type": "uint256" }], + "name": "EnableLltv", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "token", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "assets", "type": "uint256" } + ], + "name": "FlashLoan", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "authorizer", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "usedNonce", "type": "uint256" } + ], + "name": "IncrementNonce", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "borrower", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "repaidAssets", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "repaidShares", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "seizedAssets", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "badDebtAssets", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "badDebtShares", "type": "uint256" } + ], + "name": "Liquidate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "onBehalf", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "shares", "type": "uint256" } + ], + "name": "Repay", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "authorizer", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "authorized", "type": "address" }, + { "indexed": false, "internalType": "bool", "name": "newIsAuthorized", "type": "bool" } + ], + "name": "SetAuthorization", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" }, + { "indexed": false, "internalType": "uint256", "name": "newFee", "type": "uint256" } + ], + "name": "SetFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "newFeeRecipient", "type": "address" }], + "name": "SetFeeRecipient", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "SetOwner", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "onBehalf", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "shares", "type": "uint256" } + ], + "name": "Supply", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" }, + { "indexed": true, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "onBehalf", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "assets", "type": "uint256" } + ], + "name": "SupplyCollateral", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" }, + { "indexed": false, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "onBehalf", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "receiver", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "shares", "type": "uint256" } + ], + "name": "Withdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "Id", "name": "id", "type": "bytes32" }, + { "indexed": false, "internalType": "address", "name": "caller", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "onBehalf", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "receiver", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "assets", "type": "uint256" } + ], + "name": "WithdrawCollateral", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "internalType": "struct MarketParams", + "name": "marketParams", + "type": "tuple" + } + ], + "name": "accrueInterest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "internalType": "struct MarketParams", + "name": "marketParams", + "type": "tuple" + }, + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "uint256", "name": "shares", "type": "uint256" }, + { "internalType": "address", "name": "onBehalf", "type": "address" }, + { "internalType": "address", "name": "receiver", "type": "address" } + ], + "name": "borrow", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "internalType": "struct MarketParams", + "name": "marketParams", + "type": "tuple" + } + ], + "name": "createMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "irm", "type": "address" }], + "name": "enableIrm", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "lltv", "type": "uint256" }], + "name": "enableLltv", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "bytes32[]", "name": "slots", "type": "bytes32[]" }], + "name": "extSloads", + "outputs": [{ "internalType": "bytes32[]", "name": "res", "type": "bytes32[]" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeRecipient", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "token", "type": "address" }, + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "flashLoan", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "Id", "name": "", "type": "bytes32" }], + "name": "idToMarketParams", + "outputs": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "isAuthorized", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "isIrmEnabled", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "isLltvEnabled", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "internalType": "struct MarketParams", + "name": "marketParams", + "type": "tuple" + }, + { "internalType": "address", "name": "borrower", "type": "address" }, + { "internalType": "uint256", "name": "seizedAssets", "type": "uint256" }, + { "internalType": "uint256", "name": "repaidShares", "type": "uint256" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "liquidate", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "Id", "name": "", "type": "bytes32" }], + "name": "market", + "outputs": [ + { "internalType": "uint128", "name": "totalSupplyAssets", "type": "uint128" }, + { "internalType": "uint128", "name": "totalSupplyShares", "type": "uint128" }, + { "internalType": "uint128", "name": "totalBorrowAssets", "type": "uint128" }, + { "internalType": "uint128", "name": "totalBorrowShares", "type": "uint128" }, + { "internalType": "uint128", "name": "lastUpdate", "type": "uint128" }, + { "internalType": "uint128", "name": "fee", "type": "uint128" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "nonce", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "Id", "name": "", "type": "bytes32" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "position", + "outputs": [ + { "internalType": "uint256", "name": "supplyShares", "type": "uint256" }, + { "internalType": "uint128", "name": "borrowShares", "type": "uint128" }, + { "internalType": "uint128", "name": "collateral", "type": "uint128" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "internalType": "struct MarketParams", + "name": "marketParams", + "type": "tuple" + }, + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "uint256", "name": "shares", "type": "uint256" }, + { "internalType": "address", "name": "onBehalf", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "repay", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "authorized", "type": "address" }, + { "internalType": "bool", "name": "newIsAuthorized", "type": "bool" } + ], + "name": "setAuthorization", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "authorizer", "type": "address" }, + { "internalType": "address", "name": "authorized", "type": "address" }, + { "internalType": "bool", "name": "isAuthorized", "type": "bool" }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "internalType": "struct Authorization", + "name": "authorization", + "type": "tuple" + }, + { + "components": [ + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "internalType": "struct Signature", + "name": "signature", + "type": "tuple" + } + ], + "name": "setAuthorizationWithSig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "internalType": "struct MarketParams", + "name": "marketParams", + "type": "tuple" + }, + { "internalType": "uint256", "name": "newFee", "type": "uint256" } + ], + "name": "setFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newFeeRecipient", "type": "address" }], + "name": "setFeeRecipient", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "internalType": "struct MarketParams", + "name": "marketParams", + "type": "tuple" + }, + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "uint256", "name": "shares", "type": "uint256" }, + { "internalType": "address", "name": "onBehalf", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "supply", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "internalType": "struct MarketParams", + "name": "marketParams", + "type": "tuple" + }, + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "address", "name": "onBehalf", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "supplyCollateral", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "internalType": "struct MarketParams", + "name": "marketParams", + "type": "tuple" + }, + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "uint256", "name": "shares", "type": "uint256" }, + { "internalType": "address", "name": "onBehalf", "type": "address" }, + { "internalType": "address", "name": "receiver", "type": "address" } + ], + "name": "withdraw", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { "internalType": "address", "name": "loanToken", "type": "address" }, + { "internalType": "address", "name": "collateralToken", "type": "address" }, + { "internalType": "address", "name": "oracle", "type": "address" }, + { "internalType": "address", "name": "irm", "type": "address" }, + { "internalType": "uint256", "name": "lltv", "type": "uint256" } + ], + "internalType": "struct MarketParams", + "name": "marketParams", + "type": "tuple" + }, + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "address", "name": "onBehalf", "type": "address" }, + { "internalType": "address", "name": "receiver", "type": "address" } + ], + "name": "withdrawCollateral", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/db/migrations/1726199667014-Data.js b/db/migrations/1726857088697-Data.js similarity index 96% rename from db/migrations/1726199667014-Data.js rename to db/migrations/1726857088697-Data.js index 2ca63afa..9dacfad0 100644 --- a/db/migrations/1726199667014-Data.js +++ b/db/migrations/1726857088697-Data.js @@ -1,5 +1,5 @@ -module.exports = class Data1726199667014 { - name = 'Data1726199667014' +module.exports = class Data1726857088697 { + name = 'Data1726857088697' async up(db) { await db.query(`CREATE TABLE "aero_cl_gauge_claim_fees" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "block_number" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "address" text NOT NULL, "from" text NOT NULL, "claimed0" numeric NOT NULL, "claimed1" numeric NOT NULL, CONSTRAINT "PK_324db7f817fe71a6a8dfc04701a" PRIMARY KEY ("id"))`) @@ -663,33 +663,6 @@ module.exports = class Data1726199667014 { await db.query(`CREATE TABLE "ousd_vault" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_343f5538c71a1cd78f1659ef9d3" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_6860186ea2f56e2c7d54c22107" ON "ousd_vault" ("timestamp") `) await db.query(`CREATE INDEX "IDX_0d0a7113a505cf7f7adea9ca81" ON "ousd_vault" ("block_number") `) - await db.query(`CREATE TABLE "ousd_morpho_aave" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_60676cde905a822ba73ff3a5c85" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_78e0701c2e9a28242db37bd8f8" ON "ousd_morpho_aave" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_46ccf673b376d654052fbd53e6" ON "ousd_morpho_aave" ("block_number") `) - await db.query(`CREATE TABLE "ousd_morpho_compound" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_5f715d53ef8fc0fad595cacf4fa" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_9e7bd0d8ae23b877d5979ef80c" ON "ousd_morpho_compound" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_0bb3a0ad84071f1d80f6d4e90f" ON "ousd_morpho_compound" ("block_number") `) - await db.query(`CREATE TABLE "maker_dsr_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, CONSTRAINT "PK_196da2d6910009ae04e3542fe22" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_a35308a3c5dbaab2d321eb1525" ON "maker_dsr_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_844b219d8faf9b1d24ab2dba9a" ON "maker_dsr_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_flux_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_ac977221429e50e4de1ce253a8b" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5b165b5d30b13e363d33a66e14" ON "ousd_flux_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_80f3392968fde7b99cccb805ac" ON "ousd_flux_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_compound_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_9030e82bf3479d03c04e0d1919c" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_6920b1db5dc577295ac4d1379d" ON "ousd_compound_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_89c6d7d3104bd36dc88a37add4" ON "ousd_compound_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_convex_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_2b8f6e749e15e49d8816f1ac949" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_2deac473cd0b2dd7082e7da148" ON "ousd_convex_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_157bf74171817dc5c60ee37036" ON "ousd_convex_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_aave_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_b4b7ac6e395aa722df500f93623" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_ca34b5a0a33bc9abdd8213c2fa" ON "ousd_aave_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_dacd7c98223d7bc8be074d71e4" ON "ousd_aave_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_meta_strategy" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_d99170af73d86fe74460bbfacc4" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_7e998dcf775263bc5df76ef987" ON "ousd_meta_strategy" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_55ce185680512d6a5b9fb0af89" ON "ousd_meta_strategy" ("block_number") `) - await db.query(`CREATE TABLE "ousd_convex_lusd_plus3_crv" ("id" character varying NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "dai" numeric NOT NULL, "usdt" numeric NOT NULL, "usdc" numeric NOT NULL, CONSTRAINT "PK_47290aa5dfa3cc5595f468e2f39" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_0783af95efb35fb3f13cde1656" ON "ousd_convex_lusd_plus3_crv" ("timestamp") `) - await db.query(`CREATE INDEX "IDX_74ae01fb596a4f2733087ba454" ON "ousd_convex_lusd_plus3_crv" ("block_number") `) await db.query(`CREATE TABLE "ousd_strategy_holding_daily_stat" ("id" character varying NOT NULL, "symbol" text NOT NULL, "amount" numeric NOT NULL, "value" numeric NOT NULL, "strategy_daily_stat_id_id" character varying, CONSTRAINT "PK_ef2f51867e1d465c554262efd1b" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_e1a93bab3d12271dc114234d3a" ON "ousd_strategy_holding_daily_stat" ("strategy_daily_stat_id_id") `) await db.query(`CREATE TABLE "ousd_strategy_daily_stat" ("id" character varying NOT NULL, "name" text NOT NULL, "total" numeric NOT NULL, "tvl" numeric NOT NULL, "daily_stat_id_id" character varying, CONSTRAINT "PK_ac65d3f28f290211ddeb950e157" PRIMARY KEY ("id"))`) @@ -699,6 +672,7 @@ module.exports = class Data1726199667014 { await db.query(`CREATE TABLE "ousd_daily_stat" ("id" character varying NOT NULL, "block_number" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "total_supply" numeric NOT NULL, "total_supply_usd" numeric NOT NULL, "rebasing_supply" numeric NOT NULL, "non_rebasing_supply" numeric NOT NULL, "amo_supply" numeric NOT NULL, "dripper_weth" numeric NOT NULL, "wrapped_supply" numeric NOT NULL, "trading_volume_usd" numeric NOT NULL, "yield_eth" numeric NOT NULL, "yield_eth7_day" numeric NOT NULL, "yield_eth_all_time" numeric NOT NULL, "yield_usd" numeric NOT NULL, "yield_usd7_day" numeric NOT NULL, "yield_usd_all_time" numeric NOT NULL, "fees_eth" numeric NOT NULL, "fees_eth7_day" numeric NOT NULL, "fees_eth_all_time" numeric NOT NULL, "fees_usd" numeric NOT NULL, "fees_usd7_day" numeric NOT NULL, "fees_usd_all_time" numeric NOT NULL, "peg_price" numeric NOT NULL, "market_cap_usd" numeric NOT NULL, "holders_over_threshold" integer NOT NULL, CONSTRAINT "PK_f8adaf321a99f2b4b877c262880" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_f9020d89932aad2d0de8923490" ON "ousd_daily_stat" ("block_number") `) await db.query(`CREATE INDEX "IDX_0bb5f72bf5fa59ce8c232caa4c" ON "ousd_daily_stat" ("timestamp") `) + await db.query(`CREATE TABLE "morpho_market_state" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "market_id" text NOT NULL, "total_supply_assets" numeric NOT NULL, "total_supply_shares" numeric NOT NULL, "total_borrow_assets" numeric NOT NULL, "total_borrow_shares" numeric NOT NULL, "last_update" numeric NOT NULL, "fee" numeric NOT NULL, CONSTRAINT "PK_69eee8c1777f06d9de8b4cab68d" PRIMARY KEY ("id"))`) await db.query(`CREATE TABLE "event_woeth_price_updated" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "old_value" numeric NOT NULL, "new_value" numeric NOT NULL, CONSTRAINT "PK_1c828c028380b7600d024778689" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_cfeca5e039fb3f137b5922a60a" ON "event_woeth_price_updated" ("chain_id") `) await db.query(`CREATE INDEX "IDX_e05f1c97627f04cb666bfbfd2e" ON "event_woeth_price_updated" ("timestamp") `) @@ -1390,33 +1364,6 @@ module.exports = class Data1726199667014 { await db.query(`DROP TABLE "ousd_vault"`) await db.query(`DROP INDEX "public"."IDX_6860186ea2f56e2c7d54c22107"`) await db.query(`DROP INDEX "public"."IDX_0d0a7113a505cf7f7adea9ca81"`) - await db.query(`DROP TABLE "ousd_morpho_aave"`) - await db.query(`DROP INDEX "public"."IDX_78e0701c2e9a28242db37bd8f8"`) - await db.query(`DROP INDEX "public"."IDX_46ccf673b376d654052fbd53e6"`) - await db.query(`DROP TABLE "ousd_morpho_compound"`) - await db.query(`DROP INDEX "public"."IDX_9e7bd0d8ae23b877d5979ef80c"`) - await db.query(`DROP INDEX "public"."IDX_0bb3a0ad84071f1d80f6d4e90f"`) - await db.query(`DROP TABLE "maker_dsr_strategy"`) - await db.query(`DROP INDEX "public"."IDX_a35308a3c5dbaab2d321eb1525"`) - await db.query(`DROP INDEX "public"."IDX_844b219d8faf9b1d24ab2dba9a"`) - await db.query(`DROP TABLE "ousd_flux_strategy"`) - await db.query(`DROP INDEX "public"."IDX_5b165b5d30b13e363d33a66e14"`) - await db.query(`DROP INDEX "public"."IDX_80f3392968fde7b99cccb805ac"`) - await db.query(`DROP TABLE "ousd_compound_strategy"`) - await db.query(`DROP INDEX "public"."IDX_6920b1db5dc577295ac4d1379d"`) - await db.query(`DROP INDEX "public"."IDX_89c6d7d3104bd36dc88a37add4"`) - await db.query(`DROP TABLE "ousd_convex_strategy"`) - await db.query(`DROP INDEX "public"."IDX_2deac473cd0b2dd7082e7da148"`) - await db.query(`DROP INDEX "public"."IDX_157bf74171817dc5c60ee37036"`) - await db.query(`DROP TABLE "ousd_aave_strategy"`) - await db.query(`DROP INDEX "public"."IDX_ca34b5a0a33bc9abdd8213c2fa"`) - await db.query(`DROP INDEX "public"."IDX_dacd7c98223d7bc8be074d71e4"`) - await db.query(`DROP TABLE "ousd_meta_strategy"`) - await db.query(`DROP INDEX "public"."IDX_7e998dcf775263bc5df76ef987"`) - await db.query(`DROP INDEX "public"."IDX_55ce185680512d6a5b9fb0af89"`) - await db.query(`DROP TABLE "ousd_convex_lusd_plus3_crv"`) - await db.query(`DROP INDEX "public"."IDX_0783af95efb35fb3f13cde1656"`) - await db.query(`DROP INDEX "public"."IDX_74ae01fb596a4f2733087ba454"`) await db.query(`DROP TABLE "ousd_strategy_holding_daily_stat"`) await db.query(`DROP INDEX "public"."IDX_e1a93bab3d12271dc114234d3a"`) await db.query(`DROP TABLE "ousd_strategy_daily_stat"`) @@ -1426,6 +1373,7 @@ module.exports = class Data1726199667014 { await db.query(`DROP TABLE "ousd_daily_stat"`) await db.query(`DROP INDEX "public"."IDX_f9020d89932aad2d0de8923490"`) await db.query(`DROP INDEX "public"."IDX_0bb5f72bf5fa59ce8c232caa4c"`) + await db.query(`DROP TABLE "morpho_market_state"`) await db.query(`DROP TABLE "event_woeth_price_updated"`) await db.query(`DROP INDEX "public"."IDX_cfeca5e039fb3f137b5922a60a"`) await db.query(`DROP INDEX "public"."IDX_e05f1c97627f04cb666bfbfd2e"`) diff --git a/schema.graphql b/schema.graphql index 9ea1ad18..351931bc 100644 --- a/schema.graphql +++ b/schema.graphql @@ -1867,8 +1867,7 @@ type OUSDStrategyDailyStat @entity { name: String! total: BigInt! tvl: BigInt! - holdings: [OUSDStrategyHoldingDailyStat] - @derivedFrom(field: "strategyDailyStatId") + holdings: [OUSDStrategyHoldingDailyStat] @derivedFrom(field: "strategyDailyStatId") } type OUSDStrategyHoldingDailyStat @entity { @@ -1887,6 +1886,20 @@ type OUSDCollateralDailyStat @entity { price: BigInt! value: BigInt! } + +type MorphoMarketState @entity { + id: ID! + chainId: Int! + timestamp: DateTime! + blockNumber: Int! + marketId: String! + totalSupplyAssets: BigInt! + totalSupplyShares: BigInt! + totalBorrowAssets: BigInt! + totalBorrowShares: BigInt! + lastUpdate: BigInt! + fee: BigInt! +} type EventWOETHPriceUpdated @entity { id: ID! chainId: Int! @index diff --git a/schema/ousd.graphql b/schema/ousd.graphql index ad791b2f..37567b1f 100644 --- a/schema/ousd.graphql +++ b/schema/ousd.graphql @@ -58,8 +58,7 @@ type OUSDStrategyDailyStat @entity { name: String! total: BigInt! tvl: BigInt! - holdings: [OUSDStrategyHoldingDailyStat] - @derivedFrom(field: "strategyDailyStatId") + holdings: [OUSDStrategyHoldingDailyStat] @derivedFrom(field: "strategyDailyStatId") } type OUSDStrategyHoldingDailyStat @entity { @@ -78,3 +77,17 @@ type OUSDCollateralDailyStat @entity { price: BigInt! value: BigInt! } + +type MorphoMarketState @entity { + id: ID! + chainId: Int! + timestamp: DateTime! + blockNumber: Int! + marketId: String! + totalSupplyAssets: BigInt! + totalSupplyShares: BigInt! + totalBorrowAssets: BigInt! + totalBorrowShares: BigInt! + lastUpdate: BigInt! + fee: BigInt! +} diff --git a/squid.yaml b/squid.yaml index 65bb656a..d4772402 100644 --- a/squid.yaml +++ b/squid.yaml @@ -1,6 +1,6 @@ manifestVersion: subsquid.io/v0.1 name: origin-squid -version: 49 +version: 999 description: 'Origin Protocol 🦑' build: deploy: @@ -15,30 +15,30 @@ deploy: - RPC_ENV processor: - name: mainnet-processor - cmd: [ "sqd", "process:mainnet:prod" ] + cmd: ['sqd', 'process:mainnet:prod'] env: TS_NODE_BASEURL: './lib' - name: arbitrum-processor - cmd: [ "sqd", "process:arbitrum:prod" ] + cmd: ['sqd', 'process:arbitrum:prod'] env: RPC_ARBITRUM_ENV: RPC_ARBITRUM_ONE_HTTP TS_NODE_BASEURL: './lib' - name: base-processor - cmd: [ "sqd", "process:base:prod" ] + cmd: ['sqd', 'process:base:prod'] env: RPC_BASE_ENV: RPC_BASE_HTTP TS_NODE_BASEURL: './lib' - name: oeth-processor - cmd: [ "sqd", "process:oeth:prod" ] + cmd: ['sqd', 'process:oeth:prod'] env: TS_NODE_BASEURL: './lib' - name: ogv-processor - cmd: [ "sqd", "process:ogv:prod" ] + cmd: ['sqd', 'process:ogv:prod'] env: RPC_ENV: RPC_ENDPOINT TS_NODE_BASEURL: './lib' - name: ousd-processor - cmd: [ "sqd", "process:ousd:prod" ] + cmd: ['sqd', 'process:ousd:prod'] env: RPC_ENV: RPC_ENDPOINT TS_NODE_BASEURL: './lib' diff --git a/src/abi/meta-morpho.ts b/src/abi/meta-morpho.ts new file mode 100644 index 00000000..93d59e98 --- /dev/null +++ b/src/abi/meta-morpho.ts @@ -0,0 +1,532 @@ +import * as p from '@subsquid/evm-codec' +import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' +import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' + +export const events = { + AccrueInterest: event("0xf66f28b40975dbb933913542c7e6a0f50a1d0f20aa74ea6e0efe65ab616323ec", "AccrueInterest(uint256,uint256)", {"newTotalAssets": p.uint256, "feeShares": p.uint256}), + Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), + Deposit: event("0xdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7", "Deposit(address,address,uint256,uint256)", {"sender": indexed(p.address), "owner": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), + EIP712DomainChanged: event("0x0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31", "EIP712DomainChanged()", {}), + OwnershipTransferStarted: event("0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700", "OwnershipTransferStarted(address,address)", {"previousOwner": indexed(p.address), "newOwner": indexed(p.address)}), + OwnershipTransferred: event("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "OwnershipTransferred(address,address)", {"previousOwner": indexed(p.address), "newOwner": indexed(p.address)}), + ReallocateSupply: event("0x89bf199df65bf65155e3e0a8abc4ad4a1be606220c8295840dba2ab5656c1f6d", "ReallocateSupply(address,bytes32,uint256,uint256)", {"caller": indexed(p.address), "id": indexed(p.bytes32), "suppliedAssets": p.uint256, "suppliedShares": p.uint256}), + ReallocateWithdraw: event("0xdd8bf5226dff861316e0fa7863fdb7dc7b87c614eb29a135f524eb79d5a1189a", "ReallocateWithdraw(address,bytes32,uint256,uint256)", {"caller": indexed(p.address), "id": indexed(p.bytes32), "withdrawnAssets": p.uint256, "withdrawnShares": p.uint256}), + RevokePendingCap: event("0x1026ceca5ed3747eb5edec555732d4a6f901ce1a875ecf981064628cadde1120", "RevokePendingCap(address,bytes32)", {"caller": indexed(p.address), "id": indexed(p.bytes32)}), + RevokePendingGuardian: event("0xc40a085ccfa20f5fd518ade5c3a77a7ecbdfbb4c75efcdca6146a8e3c841d663", "RevokePendingGuardian(address)", {"caller": indexed(p.address)}), + RevokePendingMarketRemoval: event("0xcbeb8ecdaa5a3c133e62219b63bfc35bce3fda13065d2bed32e3b7dde60a59f4", "RevokePendingMarketRemoval(address,bytes32)", {"caller": indexed(p.address), "id": indexed(p.bytes32)}), + RevokePendingTimelock: event("0x921828337692c347c634c5d2aacbc7b756014674bd236f3cc2058d8e284a951b", "RevokePendingTimelock(address)", {"caller": indexed(p.address)}), + SetCap: event("0xe86b6d3313d3098f4c5f689c935de8fde876a597c185def2cedab85efedac686", "SetCap(address,bytes32,uint256)", {"caller": indexed(p.address), "id": indexed(p.bytes32), "cap": p.uint256}), + SetCurator: event("0xbd0a63c12948fbc9194a5839019f99c9d71db924e5c70018265bc778b8f1a506", "SetCurator(address)", {"newCurator": indexed(p.address)}), + SetFee: event("0x01fe2943baee27f47add82886c2200f910c749c461c9b63c5fe83901a53bdb49", "SetFee(address,uint256)", {"caller": indexed(p.address), "newFee": p.uint256}), + SetFeeRecipient: event("0x2e979f80fe4d43055c584cf4a8467c55875ea36728fc37176c05acd784eb7a73", "SetFeeRecipient(address)", {"newFeeRecipient": indexed(p.address)}), + SetGuardian: event("0xcb11cc8aade2f5a556749d1b2380d108a16fac3431e6a5d5ce12ef9de0bd76e3", "SetGuardian(address,address)", {"caller": indexed(p.address), "guardian": indexed(p.address)}), + SetIsAllocator: event("0x74dc60cbc81a9472d04ad1d20e151d369c41104d655ed3f2f3091166a502cd8d", "SetIsAllocator(address,bool)", {"allocator": indexed(p.address), "isAllocator": p.bool}), + SetSkimRecipient: event("0x2e7908865670e21b9779422cadf5f1cba271a62bb95c71eaaf615c0a1c48ebee", "SetSkimRecipient(address)", {"newSkimRecipient": indexed(p.address)}), + SetSupplyQueue: event("0x6ce31538fc7fba95714ddc8a275a09252b4b1fb8f33d2550aa58a5f62ad934de", "SetSupplyQueue(address,bytes32[])", {"caller": indexed(p.address), "newSupplyQueue": p.array(p.bytes32)}), + SetTimelock: event("0xd28e9b90ee9b37c5936ff84392d71f29ff18117d7e76bcee60615262a90a3f75", "SetTimelock(address,uint256)", {"caller": indexed(p.address), "newTimelock": p.uint256}), + SetWithdrawQueue: event("0xe0c2db6b54586be6d7d49943139fccf0dd315ba63e55364a76c73cd8fdba724d", "SetWithdrawQueue(address,bytes32[])", {"caller": indexed(p.address), "newWithdrawQueue": p.array(p.bytes32)}), + Skim: event("0x2ae72b44f59d038340fca5739135a1d51fc5ab720bb02d983e4c5ff4119ca7b8", "Skim(address,address,uint256)", {"caller": indexed(p.address), "token": indexed(p.address), "amount": p.uint256}), + SubmitCap: event("0xe851bb5856808a50efd748be463b8f35bcfb5ec74c5bfde776fe0a4d2a26db27", "SubmitCap(address,bytes32,uint256)", {"caller": indexed(p.address), "id": indexed(p.bytes32), "cap": p.uint256}), + SubmitGuardian: event("0x7633313af54753bce8a149927263b1a55eba857ba4ef1d13c6aee25d384d3c4b", "SubmitGuardian(address)", {"newGuardian": indexed(p.address)}), + SubmitMarketRemoval: event("0x3240fc70754c5a2b4dab10bf7081a00024bfc8491581ee3d355360ec0dd91f16", "SubmitMarketRemoval(address,bytes32)", {"caller": indexed(p.address), "id": indexed(p.bytes32)}), + SubmitTimelock: event("0xb3aa0ade2442acf51d06713c2d1a5a3ec0373cce969d42b53f4689f97bccf380", "SubmitTimelock(uint256)", {"newTimelock": p.uint256}), + Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "value": p.uint256}), + UpdateLastTotalAssets: event("0x15c027cc4fd826d986cad358803439f7326d3aa4ed969ff90dbee4bc150f68e9", "UpdateLastTotalAssets(uint256)", {"updatedTotalAssets": p.uint256}), + Withdraw: event("0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db", "Withdraw(address,address,address,uint256,uint256)", {"sender": indexed(p.address), "receiver": indexed(p.address), "owner": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), +} + +export const functions = { + DECIMALS_OFFSET: viewFun("0xaea70acc", "DECIMALS_OFFSET()", {}, p.uint8), + DOMAIN_SEPARATOR: viewFun("0x3644e515", "DOMAIN_SEPARATOR()", {}, p.bytes32), + MORPHO: viewFun("0x3acb5624", "MORPHO()", {}, p.address), + acceptCap: fun("0x6fda3868", "acceptCap((address,address,address,address,uint256))", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256})}, ), + acceptGuardian: fun("0xa5f31d61", "acceptGuardian()", {}, ), + acceptOwnership: fun("0x79ba5097", "acceptOwnership()", {}, ), + acceptTimelock: fun("0x8a2c7b39", "acceptTimelock()", {}, ), + allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"owner": p.address, "spender": p.address}, p.uint256), + approve: fun("0x095ea7b3", "approve(address,uint256)", {"spender": p.address, "value": p.uint256}, p.bool), + asset: viewFun("0x38d52e0f", "asset()", {}, p.address), + balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"account": p.address}, p.uint256), + config: viewFun("0xcc718f76", "config(bytes32)", {"_0": p.bytes32}, {"cap": p.uint184, "enabled": p.bool, "removableAt": p.uint64}), + convertToAssets: viewFun("0x07a2d13a", "convertToAssets(uint256)", {"shares": p.uint256}, p.uint256), + convertToShares: viewFun("0xc6e6f592", "convertToShares(uint256)", {"assets": p.uint256}, p.uint256), + curator: viewFun("0xe66f53b7", "curator()", {}, p.address), + decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), + deposit: fun("0x6e553f65", "deposit(uint256,address)", {"assets": p.uint256, "receiver": p.address}, p.uint256), + eip712Domain: viewFun("0x84b0196e", "eip712Domain()", {}, {"fields": p.bytes1, "name": p.string, "version": p.string, "chainId": p.uint256, "verifyingContract": p.address, "salt": p.bytes32, "extensions": p.array(p.uint256)}), + fee: viewFun("0xddca3f43", "fee()", {}, p.uint96), + feeRecipient: viewFun("0x46904840", "feeRecipient()", {}, p.address), + guardian: viewFun("0x452a9320", "guardian()", {}, p.address), + isAllocator: viewFun("0x4dedf20e", "isAllocator(address)", {"_0": p.address}, p.bool), + lastTotalAssets: viewFun("0x568efc07", "lastTotalAssets()", {}, p.uint256), + maxDeposit: viewFun("0x402d267d", "maxDeposit(address)", {"_0": p.address}, p.uint256), + maxMint: viewFun("0xc63d75b6", "maxMint(address)", {"_0": p.address}, p.uint256), + maxRedeem: viewFun("0xd905777e", "maxRedeem(address)", {"owner": p.address}, p.uint256), + maxWithdraw: viewFun("0xce96cb77", "maxWithdraw(address)", {"owner": p.address}, p.uint256), + mint: fun("0x94bf804d", "mint(uint256,address)", {"shares": p.uint256, "receiver": p.address}, p.uint256), + multicall: fun("0xac9650d8", "multicall(bytes[])", {"data": p.array(p.bytes)}, p.array(p.bytes)), + name: viewFun("0x06fdde03", "name()", {}, p.string), + nonces: viewFun("0x7ecebe00", "nonces(address)", {"owner": p.address}, p.uint256), + owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), + pendingCap: viewFun("0xa31be5d6", "pendingCap(bytes32)", {"_0": p.bytes32}, {"value": p.uint192, "validAt": p.uint64}), + pendingGuardian: viewFun("0x762c31ba", "pendingGuardian()", {}, {"value": p.address, "validAt": p.uint64}), + pendingOwner: viewFun("0xe30c3978", "pendingOwner()", {}, p.address), + pendingTimelock: viewFun("0x7cc4d9a1", "pendingTimelock()", {}, {"value": p.uint192, "validAt": p.uint64}), + permit: fun("0xd505accf", "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)", {"owner": p.address, "spender": p.address, "value": p.uint256, "deadline": p.uint256, "v": p.uint8, "r": p.bytes32, "s": p.bytes32}, ), + previewDeposit: viewFun("0xef8b30f7", "previewDeposit(uint256)", {"assets": p.uint256}, p.uint256), + previewMint: viewFun("0xb3d7f6b9", "previewMint(uint256)", {"shares": p.uint256}, p.uint256), + previewRedeem: viewFun("0x4cdad506", "previewRedeem(uint256)", {"shares": p.uint256}, p.uint256), + previewWithdraw: viewFun("0x0a28a477", "previewWithdraw(uint256)", {"assets": p.uint256}, p.uint256), + reallocate: fun("0x7299aa31", "reallocate(((address,address,address,address,uint256),uint256)[])", {"allocations": p.array(p.struct({"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "assets": p.uint256}))}, ), + redeem: fun("0xba087652", "redeem(uint256,address,address)", {"shares": p.uint256, "receiver": p.address, "owner": p.address}, p.uint256), + renounceOwnership: fun("0x715018a6", "renounceOwnership()", {}, ), + revokePendingCap: fun("0x102f7b6c", "revokePendingCap(bytes32)", {"id": p.bytes32}, ), + revokePendingGuardian: fun("0x1ecca77c", "revokePendingGuardian()", {}, ), + revokePendingMarketRemoval: fun("0x4b998de5", "revokePendingMarketRemoval(bytes32)", {"id": p.bytes32}, ), + revokePendingTimelock: fun("0xc9649aa9", "revokePendingTimelock()", {}, ), + setCurator: fun("0xe90956cf", "setCurator(address)", {"newCurator": p.address}, ), + setFee: fun("0x69fe0e2d", "setFee(uint256)", {"newFee": p.uint256}, ), + setFeeRecipient: fun("0xe74b981b", "setFeeRecipient(address)", {"newFeeRecipient": p.address}, ), + setIsAllocator: fun("0xb192a84a", "setIsAllocator(address,bool)", {"newAllocator": p.address, "newIsAllocator": p.bool}, ), + setSkimRecipient: fun("0x2b30997b", "setSkimRecipient(address)", {"newSkimRecipient": p.address}, ), + setSupplyQueue: fun("0x2acc56f9", "setSupplyQueue(bytes32[])", {"newSupplyQueue": p.array(p.bytes32)}, ), + skim: fun("0xbc25cf77", "skim(address)", {"token": p.address}, ), + skimRecipient: viewFun("0x388af5b5", "skimRecipient()", {}, p.address), + submitCap: fun("0x3b24c2bf", "submitCap((address,address,address,address,uint256),uint256)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "newSupplyCap": p.uint256}, ), + submitGuardian: fun("0x9d6b4a45", "submitGuardian(address)", {"newGuardian": p.address}, ), + submitMarketRemoval: fun("0x84755b5f", "submitMarketRemoval((address,address,address,address,uint256))", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256})}, ), + submitTimelock: fun("0x7224a512", "submitTimelock(uint256)", {"newTimelock": p.uint256}, ), + supplyQueue: viewFun("0xf7d18521", "supplyQueue(uint256)", {"_0": p.uint256}, p.bytes32), + supplyQueueLength: viewFun("0xa17b3130", "supplyQueueLength()", {}, p.uint256), + symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), + timelock: viewFun("0xd33219b4", "timelock()", {}, p.uint256), + totalAssets: viewFun("0x01e1d114", "totalAssets()", {}, p.uint256), + totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), + transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"to": p.address, "value": p.uint256}, p.bool), + transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"from": p.address, "to": p.address, "value": p.uint256}, p.bool), + transferOwnership: fun("0xf2fde38b", "transferOwnership(address)", {"newOwner": p.address}, ), + updateWithdrawQueue: fun("0x41b67833", "updateWithdrawQueue(uint256[])", {"indexes": p.array(p.uint256)}, ), + withdraw: fun("0xb460af94", "withdraw(uint256,address,address)", {"assets": p.uint256, "receiver": p.address, "owner": p.address}, p.uint256), + withdrawQueue: viewFun("0x62518ddf", "withdrawQueue(uint256)", {"_0": p.uint256}, p.bytes32), + withdrawQueueLength: viewFun("0x33f91ebb", "withdrawQueueLength()", {}, p.uint256), +} + +export class Contract extends ContractBase { + + DECIMALS_OFFSET() { + return this.eth_call(functions.DECIMALS_OFFSET, {}) + } + + DOMAIN_SEPARATOR() { + return this.eth_call(functions.DOMAIN_SEPARATOR, {}) + } + + MORPHO() { + return this.eth_call(functions.MORPHO, {}) + } + + allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { + return this.eth_call(functions.allowance, {owner, spender}) + } + + asset() { + return this.eth_call(functions.asset, {}) + } + + balanceOf(account: BalanceOfParams["account"]) { + return this.eth_call(functions.balanceOf, {account}) + } + + config(_0: ConfigParams["_0"]) { + return this.eth_call(functions.config, {_0}) + } + + convertToAssets(shares: ConvertToAssetsParams["shares"]) { + return this.eth_call(functions.convertToAssets, {shares}) + } + + convertToShares(assets: ConvertToSharesParams["assets"]) { + return this.eth_call(functions.convertToShares, {assets}) + } + + curator() { + return this.eth_call(functions.curator, {}) + } + + decimals() { + return this.eth_call(functions.decimals, {}) + } + + eip712Domain() { + return this.eth_call(functions.eip712Domain, {}) + } + + fee() { + return this.eth_call(functions.fee, {}) + } + + feeRecipient() { + return this.eth_call(functions.feeRecipient, {}) + } + + guardian() { + return this.eth_call(functions.guardian, {}) + } + + isAllocator(_0: IsAllocatorParams["_0"]) { + return this.eth_call(functions.isAllocator, {_0}) + } + + lastTotalAssets() { + return this.eth_call(functions.lastTotalAssets, {}) + } + + maxDeposit(_0: MaxDepositParams["_0"]) { + return this.eth_call(functions.maxDeposit, {_0}) + } + + maxMint(_0: MaxMintParams["_0"]) { + return this.eth_call(functions.maxMint, {_0}) + } + + maxRedeem(owner: MaxRedeemParams["owner"]) { + return this.eth_call(functions.maxRedeem, {owner}) + } + + maxWithdraw(owner: MaxWithdrawParams["owner"]) { + return this.eth_call(functions.maxWithdraw, {owner}) + } + + name() { + return this.eth_call(functions.name, {}) + } + + nonces(owner: NoncesParams["owner"]) { + return this.eth_call(functions.nonces, {owner}) + } + + owner() { + return this.eth_call(functions.owner, {}) + } + + pendingCap(_0: PendingCapParams["_0"]) { + return this.eth_call(functions.pendingCap, {_0}) + } + + pendingGuardian() { + return this.eth_call(functions.pendingGuardian, {}) + } + + pendingOwner() { + return this.eth_call(functions.pendingOwner, {}) + } + + pendingTimelock() { + return this.eth_call(functions.pendingTimelock, {}) + } + + previewDeposit(assets: PreviewDepositParams["assets"]) { + return this.eth_call(functions.previewDeposit, {assets}) + } + + previewMint(shares: PreviewMintParams["shares"]) { + return this.eth_call(functions.previewMint, {shares}) + } + + previewRedeem(shares: PreviewRedeemParams["shares"]) { + return this.eth_call(functions.previewRedeem, {shares}) + } + + previewWithdraw(assets: PreviewWithdrawParams["assets"]) { + return this.eth_call(functions.previewWithdraw, {assets}) + } + + skimRecipient() { + return this.eth_call(functions.skimRecipient, {}) + } + + supplyQueue(_0: SupplyQueueParams["_0"]) { + return this.eth_call(functions.supplyQueue, {_0}) + } + + supplyQueueLength() { + return this.eth_call(functions.supplyQueueLength, {}) + } + + symbol() { + return this.eth_call(functions.symbol, {}) + } + + timelock() { + return this.eth_call(functions.timelock, {}) + } + + totalAssets() { + return this.eth_call(functions.totalAssets, {}) + } + + totalSupply() { + return this.eth_call(functions.totalSupply, {}) + } + + withdrawQueue(_0: WithdrawQueueParams["_0"]) { + return this.eth_call(functions.withdrawQueue, {_0}) + } + + withdrawQueueLength() { + return this.eth_call(functions.withdrawQueueLength, {}) + } +} + +/// Event types +export type AccrueInterestEventArgs = EParams +export type ApprovalEventArgs = EParams +export type DepositEventArgs = EParams +export type EIP712DomainChangedEventArgs = EParams +export type OwnershipTransferStartedEventArgs = EParams +export type OwnershipTransferredEventArgs = EParams +export type ReallocateSupplyEventArgs = EParams +export type ReallocateWithdrawEventArgs = EParams +export type RevokePendingCapEventArgs = EParams +export type RevokePendingGuardianEventArgs = EParams +export type RevokePendingMarketRemovalEventArgs = EParams +export type RevokePendingTimelockEventArgs = EParams +export type SetCapEventArgs = EParams +export type SetCuratorEventArgs = EParams +export type SetFeeEventArgs = EParams +export type SetFeeRecipientEventArgs = EParams +export type SetGuardianEventArgs = EParams +export type SetIsAllocatorEventArgs = EParams +export type SetSkimRecipientEventArgs = EParams +export type SetSupplyQueueEventArgs = EParams +export type SetTimelockEventArgs = EParams +export type SetWithdrawQueueEventArgs = EParams +export type SkimEventArgs = EParams +export type SubmitCapEventArgs = EParams +export type SubmitGuardianEventArgs = EParams +export type SubmitMarketRemovalEventArgs = EParams +export type SubmitTimelockEventArgs = EParams +export type TransferEventArgs = EParams +export type UpdateLastTotalAssetsEventArgs = EParams +export type WithdrawEventArgs = EParams + +/// Function types +export type DECIMALS_OFFSETParams = FunctionArguments +export type DECIMALS_OFFSETReturn = FunctionReturn + +export type DOMAIN_SEPARATORParams = FunctionArguments +export type DOMAIN_SEPARATORReturn = FunctionReturn + +export type MORPHOParams = FunctionArguments +export type MORPHOReturn = FunctionReturn + +export type AcceptCapParams = FunctionArguments +export type AcceptCapReturn = FunctionReturn + +export type AcceptGuardianParams = FunctionArguments +export type AcceptGuardianReturn = FunctionReturn + +export type AcceptOwnershipParams = FunctionArguments +export type AcceptOwnershipReturn = FunctionReturn + +export type AcceptTimelockParams = FunctionArguments +export type AcceptTimelockReturn = FunctionReturn + +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +export type AssetParams = FunctionArguments +export type AssetReturn = FunctionReturn + +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +export type ConfigParams = FunctionArguments +export type ConfigReturn = FunctionReturn + +export type ConvertToAssetsParams = FunctionArguments +export type ConvertToAssetsReturn = FunctionReturn + +export type ConvertToSharesParams = FunctionArguments +export type ConvertToSharesReturn = FunctionReturn + +export type CuratorParams = FunctionArguments +export type CuratorReturn = FunctionReturn + +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +export type Eip712DomainParams = FunctionArguments +export type Eip712DomainReturn = FunctionReturn + +export type FeeParams = FunctionArguments +export type FeeReturn = FunctionReturn + +export type FeeRecipientParams = FunctionArguments +export type FeeRecipientReturn = FunctionReturn + +export type GuardianParams = FunctionArguments +export type GuardianReturn = FunctionReturn + +export type IsAllocatorParams = FunctionArguments +export type IsAllocatorReturn = FunctionReturn + +export type LastTotalAssetsParams = FunctionArguments +export type LastTotalAssetsReturn = FunctionReturn + +export type MaxDepositParams = FunctionArguments +export type MaxDepositReturn = FunctionReturn + +export type MaxMintParams = FunctionArguments +export type MaxMintReturn = FunctionReturn + +export type MaxRedeemParams = FunctionArguments +export type MaxRedeemReturn = FunctionReturn + +export type MaxWithdrawParams = FunctionArguments +export type MaxWithdrawReturn = FunctionReturn + +export type MintParams = FunctionArguments +export type MintReturn = FunctionReturn + +export type MulticallParams = FunctionArguments +export type MulticallReturn = FunctionReturn + +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +export type NoncesParams = FunctionArguments +export type NoncesReturn = FunctionReturn + +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +export type PendingCapParams = FunctionArguments +export type PendingCapReturn = FunctionReturn + +export type PendingGuardianParams = FunctionArguments +export type PendingGuardianReturn = FunctionReturn + +export type PendingOwnerParams = FunctionArguments +export type PendingOwnerReturn = FunctionReturn + +export type PendingTimelockParams = FunctionArguments +export type PendingTimelockReturn = FunctionReturn + +export type PermitParams = FunctionArguments +export type PermitReturn = FunctionReturn + +export type PreviewDepositParams = FunctionArguments +export type PreviewDepositReturn = FunctionReturn + +export type PreviewMintParams = FunctionArguments +export type PreviewMintReturn = FunctionReturn + +export type PreviewRedeemParams = FunctionArguments +export type PreviewRedeemReturn = FunctionReturn + +export type PreviewWithdrawParams = FunctionArguments +export type PreviewWithdrawReturn = FunctionReturn + +export type ReallocateParams = FunctionArguments +export type ReallocateReturn = FunctionReturn + +export type RedeemParams = FunctionArguments +export type RedeemReturn = FunctionReturn + +export type RenounceOwnershipParams = FunctionArguments +export type RenounceOwnershipReturn = FunctionReturn + +export type RevokePendingCapParams = FunctionArguments +export type RevokePendingCapReturn = FunctionReturn + +export type RevokePendingGuardianParams = FunctionArguments +export type RevokePendingGuardianReturn = FunctionReturn + +export type RevokePendingMarketRemovalParams = FunctionArguments +export type RevokePendingMarketRemovalReturn = FunctionReturn + +export type RevokePendingTimelockParams = FunctionArguments +export type RevokePendingTimelockReturn = FunctionReturn + +export type SetCuratorParams = FunctionArguments +export type SetCuratorReturn = FunctionReturn + +export type SetFeeParams = FunctionArguments +export type SetFeeReturn = FunctionReturn + +export type SetFeeRecipientParams = FunctionArguments +export type SetFeeRecipientReturn = FunctionReturn + +export type SetIsAllocatorParams = FunctionArguments +export type SetIsAllocatorReturn = FunctionReturn + +export type SetSkimRecipientParams = FunctionArguments +export type SetSkimRecipientReturn = FunctionReturn + +export type SetSupplyQueueParams = FunctionArguments +export type SetSupplyQueueReturn = FunctionReturn + +export type SkimParams = FunctionArguments +export type SkimReturn = FunctionReturn + +export type SkimRecipientParams = FunctionArguments +export type SkimRecipientReturn = FunctionReturn + +export type SubmitCapParams = FunctionArguments +export type SubmitCapReturn = FunctionReturn + +export type SubmitGuardianParams = FunctionArguments +export type SubmitGuardianReturn = FunctionReturn + +export type SubmitMarketRemovalParams = FunctionArguments +export type SubmitMarketRemovalReturn = FunctionReturn + +export type SubmitTimelockParams = FunctionArguments +export type SubmitTimelockReturn = FunctionReturn + +export type SupplyQueueParams = FunctionArguments +export type SupplyQueueReturn = FunctionReturn + +export type SupplyQueueLengthParams = FunctionArguments +export type SupplyQueueLengthReturn = FunctionReturn + +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +export type TimelockParams = FunctionArguments +export type TimelockReturn = FunctionReturn + +export type TotalAssetsParams = FunctionArguments +export type TotalAssetsReturn = FunctionReturn + +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +export type TransferOwnershipParams = FunctionArguments +export type TransferOwnershipReturn = FunctionReturn + +export type UpdateWithdrawQueueParams = FunctionArguments +export type UpdateWithdrawQueueReturn = FunctionReturn + +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn + +export type WithdrawQueueParams = FunctionArguments +export type WithdrawQueueReturn = FunctionReturn + +export type WithdrawQueueLengthParams = FunctionArguments +export type WithdrawQueueLengthReturn = FunctionReturn + diff --git a/src/abi/morpho.ts b/src/abi/morpho.ts new file mode 100644 index 00000000..b2987f25 --- /dev/null +++ b/src/abi/morpho.ts @@ -0,0 +1,206 @@ +import * as p from '@subsquid/evm-codec' +import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' +import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' + +export const events = { + AccrueInterest: event("0x9d9bd501d0657d7dfe415f779a620a62b78bc508ddc0891fbbd8b7ac0f8fce87", "AccrueInterest(bytes32,uint256,uint256,uint256)", {"id": indexed(p.bytes32), "prevBorrowRate": p.uint256, "interest": p.uint256, "feeShares": p.uint256}), + Borrow: event("0x570954540bed6b1304a87dfe815a5eda4a648f7097a16240dcd85c9b5fd42a43", "Borrow(bytes32,address,address,address,uint256,uint256)", {"id": indexed(p.bytes32), "caller": p.address, "onBehalf": indexed(p.address), "receiver": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), + CreateMarket: event("0xac4b2400f169220b0c0afdde7a0b32e775ba727ea1cb30b35f935cdaab8683ac", "CreateMarket(bytes32,(address,address,address,address,uint256))", {"id": indexed(p.bytes32), "marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256})}), + EnableIrm: event("0x590e04cdebeccba40f566186b9746ad295a4cd358ea4fefaaea6ce79630d96c0", "EnableIrm(address)", {"irm": indexed(p.address)}), + EnableLltv: event("0x297b80e7a896fad470c630f6575072d609bde997260ff3db851939405ec29139", "EnableLltv(uint256)", {"lltv": p.uint256}), + FlashLoan: event("0xc76f1b4fe4396ac07a9fa55a415d4ca430e72651d37d3401f3bed7cb13fc4f12", "FlashLoan(address,address,uint256)", {"caller": indexed(p.address), "token": indexed(p.address), "assets": p.uint256}), + IncrementNonce: event("0xa58af1a0c70dba0c7aa60d1a1a147ebd61000d1690a968828ac718bca927f2c7", "IncrementNonce(address,address,uint256)", {"caller": indexed(p.address), "authorizer": indexed(p.address), "usedNonce": p.uint256}), + Liquidate: event("0xa4946ede45d0c6f06a0f5ce92c9ad3b4751452d2fe0e25010783bcab57a67e41", "Liquidate(bytes32,address,address,uint256,uint256,uint256,uint256,uint256)", {"id": indexed(p.bytes32), "caller": indexed(p.address), "borrower": indexed(p.address), "repaidAssets": p.uint256, "repaidShares": p.uint256, "seizedAssets": p.uint256, "badDebtAssets": p.uint256, "badDebtShares": p.uint256}), + Repay: event("0x52acb05cebbd3cd39715469f22afbf5a17496295ef3bc9bb5944056c63ccaa09", "Repay(bytes32,address,address,uint256,uint256)", {"id": indexed(p.bytes32), "caller": indexed(p.address), "onBehalf": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), + SetAuthorization: event("0xd5e969f01efe921d3f766bdebad25f0a05e3f237311f56482bf132d0326309c0", "SetAuthorization(address,address,address,bool)", {"caller": indexed(p.address), "authorizer": indexed(p.address), "authorized": indexed(p.address), "newIsAuthorized": p.bool}), + SetFee: event("0x139d6f58e9a127229667c8e3b36e88890a66cfc8ab1024ddc513e189e125b75b", "SetFee(bytes32,uint256)", {"id": indexed(p.bytes32), "newFee": p.uint256}), + SetFeeRecipient: event("0x2e979f80fe4d43055c584cf4a8467c55875ea36728fc37176c05acd784eb7a73", "SetFeeRecipient(address)", {"newFeeRecipient": indexed(p.address)}), + SetOwner: event("0x167d3e9c1016ab80e58802ca9da10ce5c6a0f4debc46a2e7a2cd9e56899a4fb5", "SetOwner(address)", {"newOwner": indexed(p.address)}), + Supply: event("0xedf8870433c83823eb071d3df1caa8d008f12f6440918c20d75a3602cda30fe0", "Supply(bytes32,address,address,uint256,uint256)", {"id": indexed(p.bytes32), "caller": indexed(p.address), "onBehalf": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), + SupplyCollateral: event("0xa3b9472a1399e17e123f3c2e6586c23e504184d504de59cdaa2b375e880c6184", "SupplyCollateral(bytes32,address,address,uint256)", {"id": indexed(p.bytes32), "caller": indexed(p.address), "onBehalf": indexed(p.address), "assets": p.uint256}), + Withdraw: event("0xa56fc0ad5702ec05ce63666221f796fb62437c32db1aa1aa075fc6484cf58fbf", "Withdraw(bytes32,address,address,address,uint256,uint256)", {"id": indexed(p.bytes32), "caller": p.address, "onBehalf": indexed(p.address), "receiver": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), + WithdrawCollateral: event("0xe80ebd7cc9223d7382aab2e0d1d6155c65651f83d53c8b9b06901d167e321142", "WithdrawCollateral(bytes32,address,address,address,uint256)", {"id": indexed(p.bytes32), "caller": p.address, "onBehalf": indexed(p.address), "receiver": indexed(p.address), "assets": p.uint256}), +} + +export const functions = { + DOMAIN_SEPARATOR: viewFun("0x3644e515", "DOMAIN_SEPARATOR()", {}, p.bytes32), + accrueInterest: fun("0x151c1ade", "accrueInterest((address,address,address,address,uint256))", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256})}, ), + borrow: fun("0x50d8cd4b", "borrow((address,address,address,address,uint256),uint256,uint256,address,address)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "assets": p.uint256, "shares": p.uint256, "onBehalf": p.address, "receiver": p.address}, {"_0": p.uint256, "_1": p.uint256}), + createMarket: fun("0x8c1358a2", "createMarket((address,address,address,address,uint256))", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256})}, ), + enableIrm: fun("0x5a64f51e", "enableIrm(address)", {"irm": p.address}, ), + enableLltv: fun("0x4d98a93b", "enableLltv(uint256)", {"lltv": p.uint256}, ), + extSloads: viewFun("0x7784c685", "extSloads(bytes32[])", {"slots": p.array(p.bytes32)}, p.array(p.bytes32)), + feeRecipient: viewFun("0x46904840", "feeRecipient()", {}, p.address), + flashLoan: fun("0xe0232b42", "flashLoan(address,uint256,bytes)", {"token": p.address, "assets": p.uint256, "data": p.bytes}, ), + idToMarketParams: viewFun("0x2c3c9157", "idToMarketParams(bytes32)", {"_0": p.bytes32}, {"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), + isAuthorized: viewFun("0x65e4ad9e", "isAuthorized(address,address)", {"_0": p.address, "_1": p.address}, p.bool), + isIrmEnabled: viewFun("0xf2b863ce", "isIrmEnabled(address)", {"_0": p.address}, p.bool), + isLltvEnabled: viewFun("0xb485f3b8", "isLltvEnabled(uint256)", {"_0": p.uint256}, p.bool), + liquidate: fun("0xd8eabcb8", "liquidate((address,address,address,address,uint256),address,uint256,uint256,bytes)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "borrower": p.address, "seizedAssets": p.uint256, "repaidShares": p.uint256, "data": p.bytes}, {"_0": p.uint256, "_1": p.uint256}), + market: viewFun("0x5c60e39a", "market(bytes32)", {"_0": p.bytes32}, {"totalSupplyAssets": p.uint128, "totalSupplyShares": p.uint128, "totalBorrowAssets": p.uint128, "totalBorrowShares": p.uint128, "lastUpdate": p.uint128, "fee": p.uint128}), + nonce: viewFun("0x70ae92d2", "nonce(address)", {"_0": p.address}, p.uint256), + owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), + position: viewFun("0x93c52062", "position(bytes32,address)", {"_0": p.bytes32, "_1": p.address}, {"supplyShares": p.uint256, "borrowShares": p.uint128, "collateral": p.uint128}), + repay: fun("0x20b76e81", "repay((address,address,address,address,uint256),uint256,uint256,address,bytes)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "assets": p.uint256, "shares": p.uint256, "onBehalf": p.address, "data": p.bytes}, {"_0": p.uint256, "_1": p.uint256}), + setAuthorization: fun("0xeecea000", "setAuthorization(address,bool)", {"authorized": p.address, "newIsAuthorized": p.bool}, ), + setAuthorizationWithSig: fun("0x8069218f", "setAuthorizationWithSig((address,address,bool,uint256,uint256),(uint8,bytes32,bytes32))", {"authorization": p.struct({"authorizer": p.address, "authorized": p.address, "isAuthorized": p.bool, "nonce": p.uint256, "deadline": p.uint256}), "signature": p.struct({"v": p.uint8, "r": p.bytes32, "s": p.bytes32})}, ), + setFee: fun("0x2b4f013c", "setFee((address,address,address,address,uint256),uint256)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "newFee": p.uint256}, ), + setFeeRecipient: fun("0xe74b981b", "setFeeRecipient(address)", {"newFeeRecipient": p.address}, ), + setOwner: fun("0x13af4035", "setOwner(address)", {"newOwner": p.address}, ), + supply: fun("0xa99aad89", "supply((address,address,address,address,uint256),uint256,uint256,address,bytes)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "assets": p.uint256, "shares": p.uint256, "onBehalf": p.address, "data": p.bytes}, {"_0": p.uint256, "_1": p.uint256}), + supplyCollateral: fun("0x238d6579", "supplyCollateral((address,address,address,address,uint256),uint256,address,bytes)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "assets": p.uint256, "onBehalf": p.address, "data": p.bytes}, ), + withdraw: fun("0x5c2bea49", "withdraw((address,address,address,address,uint256),uint256,uint256,address,address)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "assets": p.uint256, "shares": p.uint256, "onBehalf": p.address, "receiver": p.address}, {"_0": p.uint256, "_1": p.uint256}), + withdrawCollateral: fun("0x8720316d", "withdrawCollateral((address,address,address,address,uint256),uint256,address,address)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "assets": p.uint256, "onBehalf": p.address, "receiver": p.address}, ), +} + +export class Contract extends ContractBase { + + DOMAIN_SEPARATOR() { + return this.eth_call(functions.DOMAIN_SEPARATOR, {}) + } + + extSloads(slots: ExtSloadsParams["slots"]) { + return this.eth_call(functions.extSloads, {slots}) + } + + feeRecipient() { + return this.eth_call(functions.feeRecipient, {}) + } + + idToMarketParams(_0: IdToMarketParamsParams["_0"]) { + return this.eth_call(functions.idToMarketParams, {_0}) + } + + isAuthorized(_0: IsAuthorizedParams["_0"], _1: IsAuthorizedParams["_1"]) { + return this.eth_call(functions.isAuthorized, {_0, _1}) + } + + isIrmEnabled(_0: IsIrmEnabledParams["_0"]) { + return this.eth_call(functions.isIrmEnabled, {_0}) + } + + isLltvEnabled(_0: IsLltvEnabledParams["_0"]) { + return this.eth_call(functions.isLltvEnabled, {_0}) + } + + market(_0: MarketParams["_0"]) { + return this.eth_call(functions.market, {_0}) + } + + nonce(_0: NonceParams["_0"]) { + return this.eth_call(functions.nonce, {_0}) + } + + owner() { + return this.eth_call(functions.owner, {}) + } + + position(_0: PositionParams["_0"], _1: PositionParams["_1"]) { + return this.eth_call(functions.position, {_0, _1}) + } +} + +/// Event types +export type AccrueInterestEventArgs = EParams +export type BorrowEventArgs = EParams +export type CreateMarketEventArgs = EParams +export type EnableIrmEventArgs = EParams +export type EnableLltvEventArgs = EParams +export type FlashLoanEventArgs = EParams +export type IncrementNonceEventArgs = EParams +export type LiquidateEventArgs = EParams +export type RepayEventArgs = EParams +export type SetAuthorizationEventArgs = EParams +export type SetFeeEventArgs = EParams +export type SetFeeRecipientEventArgs = EParams +export type SetOwnerEventArgs = EParams +export type SupplyEventArgs = EParams +export type SupplyCollateralEventArgs = EParams +export type WithdrawEventArgs = EParams +export type WithdrawCollateralEventArgs = EParams + +/// Function types +export type DOMAIN_SEPARATORParams = FunctionArguments +export type DOMAIN_SEPARATORReturn = FunctionReturn + +export type AccrueInterestParams = FunctionArguments +export type AccrueInterestReturn = FunctionReturn + +export type BorrowParams = FunctionArguments +export type BorrowReturn = FunctionReturn + +export type CreateMarketParams = FunctionArguments +export type CreateMarketReturn = FunctionReturn + +export type EnableIrmParams = FunctionArguments +export type EnableIrmReturn = FunctionReturn + +export type EnableLltvParams = FunctionArguments +export type EnableLltvReturn = FunctionReturn + +export type ExtSloadsParams = FunctionArguments +export type ExtSloadsReturn = FunctionReturn + +export type FeeRecipientParams = FunctionArguments +export type FeeRecipientReturn = FunctionReturn + +export type FlashLoanParams = FunctionArguments +export type FlashLoanReturn = FunctionReturn + +export type IdToMarketParamsParams = FunctionArguments +export type IdToMarketParamsReturn = FunctionReturn + +export type IsAuthorizedParams = FunctionArguments +export type IsAuthorizedReturn = FunctionReturn + +export type IsIrmEnabledParams = FunctionArguments +export type IsIrmEnabledReturn = FunctionReturn + +export type IsLltvEnabledParams = FunctionArguments +export type IsLltvEnabledReturn = FunctionReturn + +export type LiquidateParams = FunctionArguments +export type LiquidateReturn = FunctionReturn + +export type MarketParams = FunctionArguments +export type MarketReturn = FunctionReturn + +export type NonceParams = FunctionArguments +export type NonceReturn = FunctionReturn + +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +export type PositionParams = FunctionArguments +export type PositionReturn = FunctionReturn + +export type RepayParams = FunctionArguments +export type RepayReturn = FunctionReturn + +export type SetAuthorizationParams = FunctionArguments +export type SetAuthorizationReturn = FunctionReturn + +export type SetAuthorizationWithSigParams = FunctionArguments +export type SetAuthorizationWithSigReturn = FunctionReturn + +export type SetFeeParams = FunctionArguments +export type SetFeeReturn = FunctionReturn + +export type SetFeeRecipientParams = FunctionArguments +export type SetFeeRecipientReturn = FunctionReturn + +export type SetOwnerParams = FunctionArguments +export type SetOwnerReturn = FunctionReturn + +export type SupplyParams = FunctionArguments +export type SupplyReturn = FunctionReturn + +export type SupplyCollateralParams = FunctionArguments +export type SupplyCollateralReturn = FunctionReturn + +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn + +export type WithdrawCollateralParams = FunctionArguments +export type WithdrawCollateralReturn = FunctionReturn + diff --git a/src/main-ousd.ts b/src/main-ousd.ts index ad173e93..ef7304c4 100644 --- a/src/main-ousd.ts +++ b/src/main-ousd.ts @@ -7,18 +7,15 @@ import { processStatus } from '@templates/processor-status' import * as dailyStats from './ousd/post-processors/daily-stats' import * as curve from './ousd/processors/curve' import { erc20s } from './ousd/processors/erc20s' +import { morphoMarketStatesProcessor } from './ousd/processors/morpho-market-states' import * as ousd from './ousd/processors/ousd' import * as strategies from './ousd/processors/strategies/strategies' import * as validateOusd from './ousd/validators/validate-ousd' export const processor = { stateSchema: 'ousd-processor', - processors: [ousd, strategies, curve, ...erc20s], - postProcessors: [ - exchangeRatesPostProcessor, - dailyStats, - processStatus('ousd'), - ], + processors: [ousd, strategies, curve, morphoMarketStatesProcessor, ...erc20s], + postProcessors: [exchangeRatesPostProcessor, dailyStats, processStatus('ousd')], validators: [validateOusd], } export default processor diff --git a/src/model/generated/index.ts b/src/model/generated/index.ts index 3709a6d8..53a31a7b 100644 --- a/src/model/generated/index.ts +++ b/src/model/generated/index.ts @@ -147,4 +147,5 @@ export * from "./ousdDailyStat.model" export * from "./ousdStrategyDailyStat.model" export * from "./ousdStrategyHoldingDailyStat.model" export * from "./ousdCollateralDailyStat.model" +export * from "./morphoMarketState.model" export * from "./eventWoethPriceUpdated.model" diff --git a/src/model/generated/morphoMarketState.model.ts b/src/model/generated/morphoMarketState.model.ts new file mode 100644 index 00000000..9996e052 --- /dev/null +++ b/src/model/generated/morphoMarketState.model.ts @@ -0,0 +1,41 @@ +import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, IntColumn as IntColumn_, DateTimeColumn as DateTimeColumn_, StringColumn as StringColumn_, BigIntColumn as BigIntColumn_} from "@subsquid/typeorm-store" + +@Entity_() +export class MorphoMarketState { + constructor(props?: Partial) { + Object.assign(this, props) + } + + @PrimaryColumn_() + id!: string + + @IntColumn_({nullable: false}) + chainId!: number + + @DateTimeColumn_({nullable: false}) + timestamp!: Date + + @IntColumn_({nullable: false}) + blockNumber!: number + + @StringColumn_({nullable: false}) + marketId!: string + + @BigIntColumn_({nullable: false}) + totalSupplyAssets!: bigint + + @BigIntColumn_({nullable: false}) + totalSupplyShares!: bigint + + @BigIntColumn_({nullable: false}) + totalBorrowAssets!: bigint + + @BigIntColumn_({nullable: false}) + totalBorrowShares!: bigint + + @BigIntColumn_({nullable: false}) + lastUpdate!: bigint + + @BigIntColumn_({nullable: false}) + fee!: bigint +} diff --git a/src/ousd/processors/morpho-market-states.ts b/src/ousd/processors/morpho-market-states.ts new file mode 100644 index 00000000..05e87fe6 --- /dev/null +++ b/src/ousd/processors/morpho-market-states.ts @@ -0,0 +1,69 @@ +import * as metaMorpho from '@abi/meta-morpho' +import * as morpho from '@abi/morpho' +import { MorphoMarketState } from '@model' +import { Context } from '@processor' +import { EvmBatchProcessor } from '@subsquid/evm-processor' +import { META_MORPHO_ADDRESS, MORPHO_ADDRESS } from '@utils/addresses' +import { blockFrequencyUpdater } from '@utils/blockFrequencyUpdater' +import { multicall } from '@utils/multicall' +import { range } from '@utils/range' + +const from = 20685100 + +const setup = (processor: EvmBatchProcessor) => { + processor.includeAllBlocks({ from }) +} + +const tracker = blockFrequencyUpdater({ from }) + +const process = async (ctx: Context) => { + const states: MorphoMarketState[] = [] + + await tracker(ctx, async (ctx, block) => { + const metaMorphoContract = new metaMorpho.Contract(ctx, block.header, META_MORPHO_ADDRESS) + const supplyLength = await metaMorphoContract.supplyQueueLength() + const marketIds = await multicall( + ctx, + block.header, + metaMorpho.functions.supplyQueue, + META_MORPHO_ADDRESS, + range(Number(supplyLength)).map((index) => ({ + _0: index, + })), + ) + const marketStates = await multicall( + ctx, + block.header, + morpho.functions.market, + MORPHO_ADDRESS, + marketIds.map((id) => ({ _0: id })), + ) + + states.push( + ...marketStates.map((state, index) => { + return new MorphoMarketState({ + id: `${ctx.chain.id}-${block.header.height}-${marketIds[index]}`, + chainId: ctx.chain.id, + timestamp: new Date(block.header.timestamp), + blockNumber: block.header.height, + marketId: marketIds[index], + totalSupplyAssets: state.totalSupplyAssets, + totalSupplyShares: state.totalSupplyShares, + totalBorrowAssets: state.totalBorrowAssets, + totalBorrowShares: state.totalBorrowShares, + lastUpdate: state.lastUpdate, + fee: state.fee, + }) + }), + ) + }) + + await ctx.store.insert(states) +} + +export const morphoMarketStatesProcessor = { + name: 'Morpho Market States', + from, + setup, + process, +} diff --git a/src/ousd/processors/strategies/metamorpho-strategy.ts b/src/ousd/processors/strategies/metamorpho-strategy.ts new file mode 100644 index 00000000..57dc6034 --- /dev/null +++ b/src/ousd/processors/strategies/metamorpho-strategy.ts @@ -0,0 +1,17 @@ +import { mainnetCurrencies } from '@shared/post-processors/exchange-rates/mainnetCurrencies' +import { IStrategyData } from '@templates/strategy' +import { OUSD_ADDRESS, addresses } from '@utils/addresses' + +import { USDC } from './const' + +export const metamorphoStrategy: IStrategyData = { + from: 20685100, + oTokenAddress: OUSD_ADDRESS, + kind: 'Generic', + name: 'OUSD MetaMorpho', + contractName: 'MetaMorphoStrategy', + address: addresses.strategies.ousd.MetaMorphoStrategy, + base: { address: mainnetCurrencies.USD, decimals: 18 }, + assets: [USDC], + earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, +} diff --git a/src/ousd/processors/strategies/strategies.ts b/src/ousd/processors/strategies/strategies.ts index 20354902..07f9bb73 100644 --- a/src/ousd/processors/strategies/strategies.ts +++ b/src/ousd/processors/strategies/strategies.ts @@ -1,20 +1,14 @@ import { OETHRewardTokenCollected } from '@model' import { Context } from '@processor' import { EvmBatchProcessor } from '@subsquid/evm-processor' -import { - IStrategyData, - createStrategyProcessor, - createStrategySetup, -} from '@templates/strategy' -import { - createStrategyRewardProcessor, - createStrategyRewardSetup, -} from '@templates/strategy-rewards' +import { IStrategyData, createStrategyProcessor, createStrategySetup } from '@templates/strategy' +import { createStrategyRewardProcessor, createStrategyRewardSetup } from '@templates/strategy-rewards' import { aaveStrategy } from './aave-strategy' import { convexMetaStrategy } from './convex-meta-strategy' import { fluxStrategy } from './flux-strategy' import { makerDsrStrategy } from './maker-dsr-strategy' +import { metamorphoStrategy } from './metamorpho-strategy' import { morphoAave } from './morpho-aave' import { morphoCompound } from './morpho-compound' @@ -25,6 +19,7 @@ const ousdStrategies: readonly IStrategyData[] = [ morphoAave, fluxStrategy, makerDsrStrategy, + metamorphoStrategy, // Deprecated // { @@ -45,7 +40,7 @@ const ousdStrategies: readonly IStrategyData[] = [ ] const strategies = ousdStrategies - +export const name = 'OUSD Strategies' export const from = Math.min(...strategies.map((s) => s.from)) export const setup = (processor: EvmBatchProcessor) => { diff --git a/src/processor.ts b/src/processor.ts index 5dcdb98c..585c8517 100644 --- a/src/processor.ts +++ b/src/processor.ts @@ -125,6 +125,10 @@ export const run = ({ }) => { assert(!processors.find((p) => p.from === undefined), 'All processors must have a `from` defined') + if (process.env.PROCESSOR) { + processors = processors.filter((p) => p.name?.includes(process.env.PROCESSOR!)) + } + const config = chainConfigs[chainId] if (!config) throw new Error('No chain configuration found.') const processor = createSquidProcessor(config) diff --git a/src/utils/addresses.ts b/src/utils/addresses.ts index 5c2bb53b..8f22b2c2 100644 --- a/src/utils/addresses.ts +++ b/src/utils/addresses.ts @@ -31,6 +31,8 @@ export const CURVE_FRXETH_OETH_POOL_ADDRESS = '0xfa0bbb0a5815f6648241c9221027b70 export const BALANCER_VAULT = '0xba12222222228d8ba445958a75a0704d566bf2c8' export const AURA_REWARDS_POOL_ADDRESS = '0xdd1fe5ad401d4777ce89959b7fa587e569bf125d' +export const MORPHO_ADDRESS = '0xbbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb' +export const META_MORPHO_ADDRESS = '0xbeef01735c132ada46aa9aa4c54623caa92a64cb' // ---------------- // Origin Addresses @@ -144,6 +146,7 @@ export const strategies = { CompoundStrategy: '0x9c459eeb3fa179a40329b81c1635525e9a0ef094', // Deprecated ConvexStrategy: '0xea2ef2e2e5a749d4a66b41db9ad85a38aa264cb3', // Deprecated LUSDMetaStrategy: '0x7A192DD9Cc4Ea9bdEdeC9992df74F1DA55e60a19', // Deprecated + MetaMorphoStrategy: '0x603cdeaec82a60e3c4a10da6ab546459e5f64fa0', }, } as const