diff --git a/src/abi/angle-transmuter/MorphoVault.json b/src/abi/angle-transmuter/MorphoVault.json new file mode 100644 index 000000000..5a4db57fd --- /dev/null +++ b/src/abi/angle-transmuter/MorphoVault.json @@ -0,0 +1,2506 @@ +[ + { + "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/src/dex/angle-transmuter/angle-transmuter-e2e.test.ts b/src/dex/angle-transmuter/angle-transmuter-e2e.test.ts index 0723b8c54..f84a4c9e4 100644 --- a/src/dex/angle-transmuter/angle-transmuter-e2e.test.ts +++ b/src/dex/angle-transmuter/angle-transmuter-e2e.test.ts @@ -11,6 +11,8 @@ import { import { Network, ContractMethod, SwapSide } from '../../constants'; import { StaticJsonRpcProvider } from '@ethersproject/providers'; import { generateConfig } from '../../config'; +import { Collateral } from './angle-transmuter-integration.test'; +import { BI_POWS } from '../../bigint-constants'; function testForNetwork( network: Network, @@ -20,6 +22,7 @@ function testForNetwork( tokenAAmount: string, tokenBAmount: string, nativeTokenAmount: string, + isKYC: boolean, ) { const provider = new StaticJsonRpcProvider( generateConfig(network).privateHttpProvider, @@ -52,19 +55,21 @@ function testForNetwork( provider, ); }); - it(`${tokenBSymbol} -> ${tokenASymbol}`, async () => { - await testE2E( - tokens[tokenBSymbol], - tokens[tokenASymbol], - holders[tokenBSymbol], - side === SwapSide.SELL ? tokenBAmount : tokenAAmount, - side, - dexKey, - contractMethod, - network, - provider, - ); - }); + if (!isKYC) { + it(`${tokenBSymbol} -> ${tokenASymbol}`, async () => { + await testE2E( + tokens[tokenBSymbol], + tokens[tokenASymbol], + holders[tokenBSymbol], + side === SwapSide.SELL ? tokenBAmount : tokenAAmount, + side, + dexKey, + contractMethod, + network, + provider, + ); + }); + } }); }); }), @@ -78,59 +83,42 @@ describe('AngleTransmuter E2E', () => { describe('Mainnet', () => { const network = Network.MAINNET; - describe('EUROC', () => { - const tokenASymbol: string = 'EUROC'; - const tokenBSymbol: string = 'EURA'; + const tokens = Tokens[network]; + const stables = [tokens.EURA, tokens.USDA]; - const tokenAAmount: string = '1000000'; - const tokenBAmount: string = '1000000000000000000'; - const nativeTokenAmount = '1000000000000000000'; + const collaterals: Collateral = { + USDA: [tokens.USDC, tokens.steakUSDC, tokens.bIB01], + EURA: [tokens.EUROC, tokens.bC3M, tokens.bERNX], + }; - testForNetwork( - network, - dexKey, - tokenASymbol, - tokenBSymbol, - tokenAAmount, - tokenBAmount, - nativeTokenAmount, - ); - }); - describe('BC3M', () => { - const tokenASymbol: string = 'bC3M'; - const tokenBSymbol: string = 'EURA'; + const isKYC: { [token: string]: boolean } = {}; + isKYC[tokens.bIB01.symbol!] = true; + isKYC[tokens.bC3M.symbol!] = true; + isKYC[tokens.bERNX.symbol!] = true; - const tokenAAmount: string = '100000000000000000'; - const tokenBAmount: string = '1000000000000000000'; - const nativeTokenAmount = '1000000000000000000'; + stables.forEach(stable => + collaterals[stable.symbol! as keyof Collateral].forEach(collateral => + describe(`${stable.symbol}/${collateral.symbol}`, () => { + const stableAmount: string = ( + 1n * BI_POWS[stable.decimals] + ).toString(); + const collateralAmount: string = ( + 1n * BI_POWS[collateral.decimals] + ).toString(); + const nativeTokenAmount = '1000000000000000000'; - testForNetwork( - network, - dexKey, - tokenASymbol, - tokenBSymbol, - tokenAAmount, - tokenBAmount, - nativeTokenAmount, - ); - }); - describe('BERNX', () => { - const tokenASymbol: string = 'bERNX'; - const tokenBSymbol: string = 'EURA'; - - const tokenAAmount: string = '500000000000000000'; - const tokenBAmount: string = '1000000000000000000'; - const nativeTokenAmount = '1000000000000000000'; - - testForNetwork( - network, - dexKey, - tokenASymbol, - tokenBSymbol, - tokenAAmount, - tokenBAmount, - nativeTokenAmount, - ); - }); + testForNetwork( + network, + dexKey, + collateral.symbol!, + stable.symbol!, + collateralAmount, + stableAmount, + nativeTokenAmount, + isKYC[collateral.symbol!], + ); + }), + ), + ); }); }); diff --git a/src/dex/angle-transmuter/angle-transmuter-events.test.ts b/src/dex/angle-transmuter/angle-transmuter-events.test.ts index 9cc5518fc..cc18504d4 100644 --- a/src/dex/angle-transmuter/angle-transmuter-events.test.ts +++ b/src/dex/angle-transmuter/angle-transmuter-events.test.ts @@ -34,45 +34,41 @@ describe('AngleTransmuter EventPool Mainnet', () => { const eventsToTest: Record
= { //Transmuter Events '0x00253582b2a3FE112feEC532221d9708c64cEFAb': { - // FeesSet: [19567142], + FeesSet: [], RedemptionCurveParamsSet: [], - // OracleSet: [19567142], - // Swap: [ - // 19582703, 19583592, 19584048, 19589408, 19602964, 19607526, 19611131, 19614332, 19616567, 19623965, 19625332, - // 19631246, 19631653, 19633515, 19638468, 19648373, 19653214, 19656178, 19657413, 19667310, 19667763, - // ], + OracleSet: [], + Swap: [ + 19582703, 19583592, 19584048, 19589408, 19602964, 19607526, 19611131, + 19614332, 19616567, 19623965, 19625332, 19631246, 19631653, 19633515, + 19638468, 19648373, 19653214, 19656178, 19657413, 19667310, 19667763, + ], Redeemed: [], ReservesAdjusted: [], - // CollateralAdded: [19567142], + CollateralAdded: [], CollateralRevoked: [], - // CollateralWhitelistStatusUpdated: [19567142], + CollateralWhitelistStatusUpdated: [], WhitelistStatusToggled: [], }, // Pyth Events - // "0x4305FB66699C3B2702D4d05CF36551390A4c69C6": { - // PriceFeedUpdate: [ - // 19611413, 19611413, 19611413, 19611413, 19611413, 19611413, 19611413, 19611413, 19611413, 19611413, 19611413, - // 19611413, 19618548, 19618548, 19618548, 19618548, 19618548, 19618548, 19618548, 19618548, 19618548, 19618548, - // 19618548, 19618548, 19625698, 19625698, 19625698, 19625698, 19625698, 19625698, 19625698, 19625698, 19625698, - // 19625698, 19625698, 19625698, 19625698, 19625698, 19625698, 19632847, 19632847, 19632847, 19632847, 19632847, - // 19632847, 19632847, 19632847, 19632847, 19632847, 19632847, 19632847, 19632847, 19632847, 19632847, 19633586, - // 19633586, 19639991, 19639991, 19639991, 19639991, 19639991, 19639991, 19639991, 19639991, 19639991, 19639991, - // 19639991, 19639991, 19647112, 19647112, 19647112, 19647112, 19647112, 19647112, 19647112, 19647112, 19647112, - // 19647112, 19647112, 19647112, 19649850, 19649850, 19654237, 19654237, 19654237, 19654237, 19654237, 19654237, - // 19654237, 19654237, 19654237, 19654237, 19654237, 19654237, - // ], - // }, - //Backed Events - // "0x83Ec02059F686E747392A22ddfED7833bA0d7cE3": { - // AnswerUpdated: [ - // 19574099, 19574442, 19581598, 19588736, 19610148, 19617280, 19624427, 19638723, 19667243, 19674385, - // ], - // }, - // "0x475855DAe09af1e3f2d380d766b9E630926ad3CE": { - // AnswerUpdated: [ - // 19574095, 19574443, 19581596, 19588737, 19610145, 19617284, 19624426, 19631578, 19638720, 19667241, 19674386, - // ], - // }, + '0x4305FB66699C3B2702D4d05CF36551390A4c69C6': { + PriceFeedUpdate: [ + 19611413, 19618548, 19625698, 19632847, 19633586, 19639991, 19647112, + 19649850, 19649850, 19654237, + ], + }, + // Backed Events + '0x83Ec02059F686E747392A22ddfED7833bA0d7cE3': { + AnswerUpdated: [ + 19574099, 19574442, 19581598, 19588736, 19610148, 19617280, 19624427, + 19638723, 19667243, 19674385, + ], + }, + '0x475855DAe09af1e3f2d380d766b9E630926ad3CE': { + AnswerUpdated: [ + 19574095, 19574443, 19581596, 19588737, 19610145, 19617284, 19624426, + 19631578, 19638720, 19667241, 19674386, + ], + }, //Redstone Events '0x6E27A25999B3C665E44D903B2139F5a4Be2B6C26': { AnswerUpdated: [], diff --git a/src/dex/angle-transmuter/angle-transmuter-integration.test.ts b/src/dex/angle-transmuter/angle-transmuter-integration.test.ts index 72742ab61..f45fade04 100644 --- a/src/dex/angle-transmuter/angle-transmuter-integration.test.ts +++ b/src/dex/angle-transmuter/angle-transmuter-integration.test.ts @@ -15,6 +15,9 @@ import { import { Tokens } from '../../../tests/constants-e2e'; import { AngleTransmuterEventPool } from './angle-transmuter-pool'; import { Address } from '../../types'; +import { SmartTokenParams } from '../../../tests/smart-tokens'; + +export type Collateral = { [stablecoin: string]: SmartTokenParams[] }; /* README @@ -60,7 +63,20 @@ function decodeReaderResult( }); } +function getExchangeAddress( + network: Network, + srcAddress: Address, + dstAddress: Address, +): Address { + const tokens = Tokens[network]; + return srcAddress.toLowerCase() === tokens.EURA.address.toLowerCase() || + dstAddress.toLowerCase() === tokens.EURA.address.toLowerCase() + ? '0x00253582b2a3FE112feEC532221d9708c64cEFAb' + : '0x222222fD79264BBE280b4986F6FEfBC3524d0137'; +} + async function checkOnChainPricing( + network: Network, angleTransmuter: AngleTransmuter, funcName: string, blockNumber: number, @@ -69,7 +85,7 @@ async function checkOnChainPricing( tokenIn: Address, tokenOut: Address, ) { - const exchangeAddress = '0x00253582b2a3FE112feEC532221d9708c64cEFAb'; + const exchangeAddress = getExchangeAddress(network, tokenIn, tokenOut); const readerIface = AngleTransmuterEventPool.angleTransmuterIface; const readerCallData = getReaderCalldata( @@ -80,6 +96,7 @@ async function checkOnChainPricing( tokenIn, tokenOut, ); + const readerResult = ( await angleTransmuter.dexHelper.multiContract.methods .aggregate(readerCallData) @@ -149,6 +166,7 @@ async function testPricingOnNetwork( // Check if onchain pricing equals to calculated ones await checkOnChainPricing( + network, angleTransmuter, funcNameToCheck, blockNumber, @@ -170,37 +188,33 @@ describe('AngleTransmuter', () => { const tokens = Tokens[network]; - const eurocSymbol = 'EUROC'; - const bC3MSymbol = 'bC3M'; - const bERNXSymbol = 'bERNX'; - const euraSymbol = 'EURA'; - - const amountsEUROC = [ - 0n, - 1n * BI_POWS[tokens[eurocSymbol].decimals], - 2n * BI_POWS[tokens[eurocSymbol].decimals], - 3n * BI_POWS[tokens[eurocSymbol].decimals], - 4n * BI_POWS[tokens[eurocSymbol].decimals], - 5n * BI_POWS[tokens[eurocSymbol].decimals], - 6n * BI_POWS[tokens[eurocSymbol].decimals], - 7n * BI_POWS[tokens[eurocSymbol].decimals], - 8n * BI_POWS[tokens[eurocSymbol].decimals], - 9n * BI_POWS[tokens[eurocSymbol].decimals], - 10n * BI_POWS[tokens[eurocSymbol].decimals], + const stables = [ + // tokens.EURA, + tokens.USDA, ]; - const amountsEURA = [ + const collaterals: Collateral = { + USDA: [tokens.USDC, tokens.steakUSDC, tokens.bIB01], + EURA: [tokens.EUROC, tokens.bC3M, tokens.bERNX], + }; + + const isKYC: { [token: string]: boolean } = {}; + isKYC[tokens.bIB01.symbol!] = true; + isKYC[tokens.bC3M.symbol!] = true; + isKYC[tokens.bERNX.symbol!] = true; + + const amounts = [ 0n, - 1n * BI_POWS[tokens[euraSymbol].decimals], - 2n * BI_POWS[tokens[euraSymbol].decimals], - 3n * BI_POWS[tokens[euraSymbol].decimals], - 4n * BI_POWS[tokens[euraSymbol].decimals], - 5n * BI_POWS[tokens[euraSymbol].decimals], - 6n * BI_POWS[tokens[euraSymbol].decimals], - 7n * BI_POWS[tokens[euraSymbol].decimals], - 8n * BI_POWS[tokens[euraSymbol].decimals], - 9n * BI_POWS[tokens[euraSymbol].decimals], - 10n * BI_POWS[tokens[euraSymbol].decimals], + 1n * BI_POWS[tokens.USDA.decimals], + 2n * BI_POWS[tokens.USDA.decimals], + 3n * BI_POWS[tokens.USDA.decimals], + 4n * BI_POWS[tokens.USDA.decimals], + 5n * BI_POWS[tokens.USDA.decimals], + 6n * BI_POWS[tokens.USDA.decimals], + 7n * BI_POWS[tokens.USDA.decimals], + 8n * BI_POWS[tokens.USDA.decimals], + 9n * BI_POWS[tokens.USDA.decimals], + 10n * BI_POWS[tokens.USDA.decimals], ]; beforeAll(async () => { @@ -211,112 +225,126 @@ describe('AngleTransmuter', () => { } }); - it('getPoolIdentifiers and getPricesVolume SELL - EUROC', async () => { - await testPricingOnNetwork( - angleTransmuter, - network, - dexKey, - blockNumber, - eurocSymbol, - euraSymbol, - SwapSide.SELL, - amountsEUROC, - 'quoteIn', - ); - }); - - it('getPoolIdentifiers and getPricesVolume SELL - EURA', async () => { - await testPricingOnNetwork( - angleTransmuter, - network, - dexKey, - blockNumber, - euraSymbol, - eurocSymbol, - SwapSide.SELL, - amountsEURA, - 'quoteIn', - ); - }); - - it('getPoolIdentifiers and getPricesVolume BUY - EUROC', async () => { - await testPricingOnNetwork( - angleTransmuter, - network, - dexKey, - blockNumber, - eurocSymbol, - euraSymbol, - SwapSide.BUY, - amountsEURA, - 'quoteOut', - ); - }); - - it('getPoolIdentifiers and getPricesVolume BUY - EURA', async () => { - await testPricingOnNetwork( - angleTransmuter, - network, - dexKey, - blockNumber, - euraSymbol, - eurocSymbol, - SwapSide.BUY, - amountsEUROC, - 'quoteOut', - ); - }); - - it('getTopPoolsForToken - EUROC', async () => { - // We have to check without calling initializePricing, because - // pool-tracker is not calling that function - const newAngleTransmuter = new AngleTransmuter( - network, - dexKey, - dexHelper, - ); - if (newAngleTransmuter.updatePoolState) { - await newAngleTransmuter.updatePoolState(); - } - const poolLiquidity = await newAngleTransmuter.getTopPoolsForToken( - tokens[eurocSymbol].address, - 10, - ); - console.log(`${eurocSymbol} Top Pools:`, poolLiquidity); - - if (!newAngleTransmuter.hasConstantPriceLargeAmounts) { - checkPoolsLiquidity( - poolLiquidity, - Tokens[network][eurocSymbol].address, - dexKey, - ); - } - }); - - it('getTopPoolsForToken - EURA', async () => { - // We have to check without calling initializePricing, because - // pool-tracker is not calling that function - const newAngleTransmuter = new AngleTransmuter( - network, - dexKey, - dexHelper, - ); - if (newAngleTransmuter.updatePoolState) { - await newAngleTransmuter.updatePoolState(); - } - const poolLiquidity = await newAngleTransmuter.getTopPoolsForToken( - tokens[euraSymbol].address, - 10, - ); - console.log(`${euraSymbol} Top Pools:`, poolLiquidity); - - if (!newAngleTransmuter.hasConstantPriceLargeAmounts) { - checkPoolsLiquidity( - poolLiquidity, - Tokens[network][euraSymbol].address, - dexKey, - ); - } - }); + stables.forEach(stable => + collaterals[stable.symbol! as keyof Collateral].forEach(collateral => + describe(`${stable.symbol}/${collateral.symbol}`, () => { + const amountsCollateral = [ + 0n, + 1n * BI_POWS[collateral.decimals], + 2n * BI_POWS[collateral.decimals], + 3n * BI_POWS[collateral.decimals], + 4n * BI_POWS[collateral.decimals], + 5n * BI_POWS[collateral.decimals], + 6n * BI_POWS[collateral.decimals], + 7n * BI_POWS[collateral.decimals], + 8n * BI_POWS[collateral.decimals], + 9n * BI_POWS[collateral.decimals], + 10n * BI_POWS[collateral.decimals], + ]; + + it('getTopPoolsForToken - collateral', async () => { + // We have to check without calling initializePricing, because + // pool-tracker is not calling that function + const newAngleTransmuter = new AngleTransmuter( + network, + dexKey, + dexHelper, + ); + if (newAngleTransmuter.updatePoolState) { + await newAngleTransmuter.updatePoolState(); + } + const poolLiquidity = await newAngleTransmuter.getTopPoolsForToken( + collateral.address, + 10, + ); + console.log(`${collateral.symbol} Top Pools:`, poolLiquidity); + + if (!newAngleTransmuter.hasConstantPriceLargeAmounts) { + checkPoolsLiquidity(poolLiquidity, collateral.address, dexKey); + } + }); + + it('getTopPoolsForToken - stablecoin', async () => { + // We have to check without calling initializePricing, because + // pool-tracker is not calling that function + const newAngleTransmuter = new AngleTransmuter( + network, + dexKey, + dexHelper, + ); + if (newAngleTransmuter.updatePoolState) { + await newAngleTransmuter.updatePoolState(); + } + const poolLiquidity = await newAngleTransmuter.getTopPoolsForToken( + stable.address, + 10, + ); + console.log(`${stable.symbol} Top Pools:`, poolLiquidity); + + if (!newAngleTransmuter.hasConstantPriceLargeAmounts) { + checkPoolsLiquidity(poolLiquidity, stable.address, dexKey); + } + }); + + it('getPoolIdentifiers and getPricesVolume SELL - collateral', async () => { + await testPricingOnNetwork( + angleTransmuter, + network, + dexKey, + blockNumber, + collateral.symbol!, + stable.symbol!, + SwapSide.SELL, + amountsCollateral, + 'quoteIn', + ); + }); + + it('getPoolIdentifiers and getPricesVolume BUY - stablecoin', async () => { + await testPricingOnNetwork( + angleTransmuter, + network, + dexKey, + blockNumber, + stable.symbol!, + collateral.symbol!, + SwapSide.BUY, + amountsCollateral, + 'quoteOut', + ); + }); + + if (!isKYC[collateral.symbol!]) { + it('getPoolIdentifiers and getPricesVolume SELL - stablecoin', async () => { + await testPricingOnNetwork( + angleTransmuter, + network, + dexKey, + blockNumber, + stable.symbol!, + collateral.symbol!, + SwapSide.SELL, + amounts, + 'quoteIn', + ); + }); + + it('getPoolIdentifiers and getPricesVolume BUY - collateral', async () => { + await testPricingOnNetwork( + angleTransmuter, + network, + dexKey, + blockNumber, + collateral.symbol!, + stable.symbol!, + SwapSide.BUY, + amounts, + 'quoteOut', + ); + }); + } + }), + ), + ); }); }); diff --git a/src/dex/angle-transmuter/angle-transmuter-pool.ts b/src/dex/angle-transmuter/angle-transmuter-pool.ts index 3acff260d..cdb9d8eb2 100644 --- a/src/dex/angle-transmuter/angle-transmuter-pool.ts +++ b/src/dex/angle-transmuter/angle-transmuter-pool.ts @@ -16,6 +16,7 @@ import { PoolConfig, PoolState, PythConfig, + TransmuterParams, TransmuterState, } from './types'; import TransmuterABI from '../../abi/angle-transmuter/Transmuter.json'; @@ -35,7 +36,6 @@ import { BackedSubscriber } from './backedOracle'; import { SwapSide } from '../../constants'; import { ethers } from 'ethers'; import { BLOCK_UPGRADE_ORACLE } from './constants'; -import { log } from 'console'; export class AngleTransmuterEventPool extends ComposedEventSubscriber