diff --git a/package.json b/package.json index 621ad6aed..4186500d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chatweb3-frontend", - "version": "0.2.1", + "version": "0.2.2", "private": true, "scripts": { "dev": "next dev", @@ -29,7 +29,7 @@ "@liquity/lib-base": "^3.0.0", "@liquity/lib-ethers": "^3.4.0", "@next/font": "13.1.2", - "@rainbow-me/rainbowkit": "^0.12.0", + "@rainbow-me/rainbowkit": "^1.0.11", "@types/node": "18.11.18", "@types/react": "18.0.27", "@types/react-dom": "18.0.10", @@ -40,7 +40,7 @@ "date-fns": "^2.30.0", "eslint": "8.32.0", "eslint-config-next": "13.1.2", - "ethers": "^5.7.2", + "ethers": "5", "graphql-request": "^6.1.0", "json-bigint": "^1.0.0", "next": "13.1.2", @@ -60,8 +60,9 @@ "siwe": "^2.1.4", "swr": "^2.0.4", "typescript": "^5.2.2", - "viem": "^1.9.3", - "wagmi": "^0.12.0", + "viem": "^1.10.13", + "wagmi": "^1.4.2", + "yarn ": "^1.0.11", "zksync-web3": "^0.14.3" }, "devDependencies": { diff --git a/src/abi/SeaportAbi.json b/src/abi/SeaportAbi.json deleted file mode 100644 index 0eaf60b4e..000000000 --- a/src/abi/SeaportAbi.json +++ /dev/null @@ -1,2258 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "conduitController", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "components": [ - { "internalType": "address", "name": "offerer", "type": "address" }, - { "internalType": "address", "name": "zone", "type": "address" }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { "internalType": "address", "name": "token", "type": "address" }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - } - ], - "internalType": "structOfferItem[]", - "name": "offer", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { "internalType": "address", "name": "token", "type": "address" }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structConsiderationItem[]", - "name": "consideration", - "type": "tuple[]" - }, - { - "internalType": "enumOrderType", - "name": "orderType", - "type": "uint8" - }, - { "internalType": "uint256", "name": "startTime", "type": "uint256" }, - { "internalType": "uint256", "name": "endTime", "type": "uint256" }, - { "internalType": "bytes32", "name": "zoneHash", "type": "bytes32" }, - { "internalType": "uint256", "name": "salt", "type": "uint256" }, - { - "internalType": "bytes32", - "name": "conduitKey", - "type": "bytes32" - }, - { "internalType": "uint256", "name": "counter", "type": "uint256" } - ], - "internalType": "structOrderComponents[]", - "name": "orders", - "type": "tuple[]" - } - ], - "name": "cancel", - "outputs": [ - { "internalType": "bool", "name": "cancelled", "type": "bool" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "offerer", - "type": "address" - }, - { "internalType": "address", "name": "zone", "type": "address" }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - } - ], - "internalType": "structOfferItem[]", - "name": "offer", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structConsiderationItem[]", - "name": "consideration", - "type": "tuple[]" - }, - { - "internalType": "enumOrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "startTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endTime", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "zoneHash", - "type": "bytes32" - }, - { "internalType": "uint256", "name": "salt", "type": "uint256" }, - { - "internalType": "bytes32", - "name": "conduitKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "totalOriginalConsiderationItems", - "type": "uint256" - } - ], - "internalType": "structOrderParameters", - "name": "parameters", - "type": "tuple" - }, - { "internalType": "uint120", "name": "numerator", "type": "uint120" }, - { - "internalType": "uint120", - "name": "denominator", - "type": "uint120" - }, - { "internalType": "bytes", "name": "signature", "type": "bytes" }, - { "internalType": "bytes", "name": "extraData", "type": "bytes" } - ], - "internalType": "structAdvancedOrder", - "name": "advancedOrder", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "orderIndex", - "type": "uint256" - }, - { "internalType": "enumSide", "name": "side", "type": "uint8" }, - { "internalType": "uint256", "name": "index", "type": "uint256" }, - { - "internalType": "uint256", - "name": "identifier", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "criteriaProof", - "type": "bytes32[]" - } - ], - "internalType": "structCriteriaResolver[]", - "name": "criteriaResolvers", - "type": "tuple[]" - }, - { - "internalType": "bytes32", - "name": "fulfillerConduitKey", - "type": "bytes32" - }, - { "internalType": "address", "name": "recipient", "type": "address" } - ], - "name": "fulfillAdvancedOrder", - "outputs": [ - { "internalType": "bool", "name": "fulfilled", "type": "bool" } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "offerer", - "type": "address" - }, - { "internalType": "address", "name": "zone", "type": "address" }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - } - ], - "internalType": "structOfferItem[]", - "name": "offer", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structConsiderationItem[]", - "name": "consideration", - "type": "tuple[]" - }, - { - "internalType": "enumOrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "startTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endTime", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "zoneHash", - "type": "bytes32" - }, - { "internalType": "uint256", "name": "salt", "type": "uint256" }, - { - "internalType": "bytes32", - "name": "conduitKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "totalOriginalConsiderationItems", - "type": "uint256" - } - ], - "internalType": "structOrderParameters", - "name": "parameters", - "type": "tuple" - }, - { "internalType": "uint120", "name": "numerator", "type": "uint120" }, - { - "internalType": "uint120", - "name": "denominator", - "type": "uint120" - }, - { "internalType": "bytes", "name": "signature", "type": "bytes" }, - { "internalType": "bytes", "name": "extraData", "type": "bytes" } - ], - "internalType": "structAdvancedOrder[]", - "name": "advancedOrders", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "orderIndex", - "type": "uint256" - }, - { "internalType": "enumSide", "name": "side", "type": "uint8" }, - { "internalType": "uint256", "name": "index", "type": "uint256" }, - { - "internalType": "uint256", - "name": "identifier", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "criteriaProof", - "type": "bytes32[]" - } - ], - "internalType": "structCriteriaResolver[]", - "name": "criteriaResolvers", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "orderIndex", - "type": "uint256" - }, - { "internalType": "uint256", "name": "itemIndex", "type": "uint256" } - ], - "internalType": "structFulfillmentComponent[][]", - "name": "offerFulfillments", - "type": "tuple[][]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "orderIndex", - "type": "uint256" - }, - { "internalType": "uint256", "name": "itemIndex", "type": "uint256" } - ], - "internalType": "structFulfillmentComponent[][]", - "name": "considerationFulfillments", - "type": "tuple[][]" - }, - { - "internalType": "bytes32", - "name": "fulfillerConduitKey", - "type": "bytes32" - }, - { "internalType": "address", "name": "recipient", "type": "address" }, - { - "internalType": "uint256", - "name": "maximumFulfilled", - "type": "uint256" - } - ], - "name": "fulfillAvailableAdvancedOrders", - "outputs": [ - { "internalType": "bool[]", "name": "availableOrders", "type": "bool[]" }, - { - "components": [ - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { "internalType": "address", "name": "token", "type": "address" }, - { - "internalType": "uint256", - "name": "identifier", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structReceivedItem", - "name": "item", - "type": "tuple" - }, - { "internalType": "address", "name": "offerer", "type": "address" }, - { "internalType": "bytes32", "name": "conduitKey", "type": "bytes32" } - ], - "internalType": "structExecution[]", - "name": "executions", - "type": "tuple[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "offerer", - "type": "address" - }, - { "internalType": "address", "name": "zone", "type": "address" }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - } - ], - "internalType": "structOfferItem[]", - "name": "offer", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structConsiderationItem[]", - "name": "consideration", - "type": "tuple[]" - }, - { - "internalType": "enumOrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "startTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endTime", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "zoneHash", - "type": "bytes32" - }, - { "internalType": "uint256", "name": "salt", "type": "uint256" }, - { - "internalType": "bytes32", - "name": "conduitKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "totalOriginalConsiderationItems", - "type": "uint256" - } - ], - "internalType": "structOrderParameters", - "name": "parameters", - "type": "tuple" - }, - { "internalType": "bytes", "name": "signature", "type": "bytes" } - ], - "internalType": "structOrder[]", - "name": "orders", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "orderIndex", - "type": "uint256" - }, - { "internalType": "uint256", "name": "itemIndex", "type": "uint256" } - ], - "internalType": "structFulfillmentComponent[][]", - "name": "offerFulfillments", - "type": "tuple[][]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "orderIndex", - "type": "uint256" - }, - { "internalType": "uint256", "name": "itemIndex", "type": "uint256" } - ], - "internalType": "structFulfillmentComponent[][]", - "name": "considerationFulfillments", - "type": "tuple[][]" - }, - { - "internalType": "bytes32", - "name": "fulfillerConduitKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "maximumFulfilled", - "type": "uint256" - } - ], - "name": "fulfillAvailableOrders", - "outputs": [ - { "internalType": "bool[]", "name": "availableOrders", "type": "bool[]" }, - { - "components": [ - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { "internalType": "address", "name": "token", "type": "address" }, - { - "internalType": "uint256", - "name": "identifier", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structReceivedItem", - "name": "item", - "type": "tuple" - }, - { "internalType": "address", "name": "offerer", "type": "address" }, - { "internalType": "bytes32", "name": "conduitKey", "type": "bytes32" } - ], - "internalType": "structExecution[]", - "name": "executions", - "type": "tuple[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "considerationToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "considerationIdentifier", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "considerationAmount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "offerer", - "type": "address" - }, - { "internalType": "address", "name": "zone", "type": "address" }, - { - "internalType": "address", - "name": "offerToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "offerIdentifier", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "offerAmount", - "type": "uint256" - }, - { - "internalType": "enumBasicOrderType", - "name": "basicOrderType", - "type": "uint8" - }, - { "internalType": "uint256", "name": "startTime", "type": "uint256" }, - { "internalType": "uint256", "name": "endTime", "type": "uint256" }, - { "internalType": "bytes32", "name": "zoneHash", "type": "bytes32" }, - { "internalType": "uint256", "name": "salt", "type": "uint256" }, - { - "internalType": "bytes32", - "name": "offererConduitKey", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "fulfillerConduitKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "totalOriginalAdditionalRecipients", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structAdditionalRecipient[]", - "name": "additionalRecipients", - "type": "tuple[]" - }, - { "internalType": "bytes", "name": "signature", "type": "bytes" } - ], - "internalType": "structBasicOrderParameters", - "name": "parameters", - "type": "tuple" - } - ], - "name": "fulfillBasicOrder", - "outputs": [ - { "internalType": "bool", "name": "fulfilled", "type": "bool" } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "considerationToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "considerationIdentifier", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "considerationAmount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "offerer", - "type": "address" - }, - { "internalType": "address", "name": "zone", "type": "address" }, - { - "internalType": "address", - "name": "offerToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "offerIdentifier", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "offerAmount", - "type": "uint256" - }, - { - "internalType": "enumBasicOrderType", - "name": "basicOrderType", - "type": "uint8" - }, - { "internalType": "uint256", "name": "startTime", "type": "uint256" }, - { "internalType": "uint256", "name": "endTime", "type": "uint256" }, - { "internalType": "bytes32", "name": "zoneHash", "type": "bytes32" }, - { "internalType": "uint256", "name": "salt", "type": "uint256" }, - { - "internalType": "bytes32", - "name": "offererConduitKey", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "fulfillerConduitKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "totalOriginalAdditionalRecipients", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structAdditionalRecipient[]", - "name": "additionalRecipients", - "type": "tuple[]" - }, - { "internalType": "bytes", "name": "signature", "type": "bytes" } - ], - "internalType": "structBasicOrderParameters", - "name": "parameters", - "type": "tuple" - } - ], - "name": "fulfillBasicOrder_efficient_6GL6yc", - "outputs": [ - { "internalType": "bool", "name": "fulfilled", "type": "bool" } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "offerer", - "type": "address" - }, - { "internalType": "address", "name": "zone", "type": "address" }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - } - ], - "internalType": "structOfferItem[]", - "name": "offer", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structConsiderationItem[]", - "name": "consideration", - "type": "tuple[]" - }, - { - "internalType": "enumOrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "startTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endTime", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "zoneHash", - "type": "bytes32" - }, - { "internalType": "uint256", "name": "salt", "type": "uint256" }, - { - "internalType": "bytes32", - "name": "conduitKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "totalOriginalConsiderationItems", - "type": "uint256" - } - ], - "internalType": "structOrderParameters", - "name": "parameters", - "type": "tuple" - }, - { "internalType": "bytes", "name": "signature", "type": "bytes" } - ], - "internalType": "structOrder", - "name": "order", - "type": "tuple" - }, - { - "internalType": "bytes32", - "name": "fulfillerConduitKey", - "type": "bytes32" - } - ], - "name": "fulfillOrder", - "outputs": [ - { "internalType": "bool", "name": "fulfilled", "type": "bool" } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "contractOfferer", - "type": "address" - } - ], - "name": "getContractOffererNonce", - "outputs": [ - { "internalType": "uint256", "name": "nonce", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "offerer", "type": "address" } - ], - "name": "getCounter", - "outputs": [ - { "internalType": "uint256", "name": "counter", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { "internalType": "address", "name": "offerer", "type": "address" }, - { "internalType": "address", "name": "zone", "type": "address" }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { "internalType": "address", "name": "token", "type": "address" }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - } - ], - "internalType": "structOfferItem[]", - "name": "offer", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { "internalType": "address", "name": "token", "type": "address" }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structConsiderationItem[]", - "name": "consideration", - "type": "tuple[]" - }, - { - "internalType": "enumOrderType", - "name": "orderType", - "type": "uint8" - }, - { "internalType": "uint256", "name": "startTime", "type": "uint256" }, - { "internalType": "uint256", "name": "endTime", "type": "uint256" }, - { "internalType": "bytes32", "name": "zoneHash", "type": "bytes32" }, - { "internalType": "uint256", "name": "salt", "type": "uint256" }, - { - "internalType": "bytes32", - "name": "conduitKey", - "type": "bytes32" - }, - { "internalType": "uint256", "name": "counter", "type": "uint256" } - ], - "internalType": "structOrderComponents", - "name": "order", - "type": "tuple" - } - ], - "name": "getOrderHash", - "outputs": [ - { "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } - ], - "name": "getOrderStatus", - "outputs": [ - { "internalType": "bool", "name": "isValidated", "type": "bool" }, - { "internalType": "bool", "name": "isCancelled", "type": "bool" }, - { "internalType": "uint256", "name": "totalFilled", "type": "uint256" }, - { "internalType": "uint256", "name": "totalSize", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "incrementCounter", - "outputs": [ - { "internalType": "uint256", "name": "newCounter", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "information", - "outputs": [ - { "internalType": "string", "name": "version", "type": "string" }, - { - "internalType": "bytes32", - "name": "domainSeparator", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "conduitController", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "offerer", - "type": "address" - }, - { "internalType": "address", "name": "zone", "type": "address" }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - } - ], - "internalType": "structOfferItem[]", - "name": "offer", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structConsiderationItem[]", - "name": "consideration", - "type": "tuple[]" - }, - { - "internalType": "enumOrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "startTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endTime", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "zoneHash", - "type": "bytes32" - }, - { "internalType": "uint256", "name": "salt", "type": "uint256" }, - { - "internalType": "bytes32", - "name": "conduitKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "totalOriginalConsiderationItems", - "type": "uint256" - } - ], - "internalType": "structOrderParameters", - "name": "parameters", - "type": "tuple" - }, - { "internalType": "uint120", "name": "numerator", "type": "uint120" }, - { - "internalType": "uint120", - "name": "denominator", - "type": "uint120" - }, - { "internalType": "bytes", "name": "signature", "type": "bytes" }, - { "internalType": "bytes", "name": "extraData", "type": "bytes" } - ], - "internalType": "structAdvancedOrder[]", - "name": "orders", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "orderIndex", - "type": "uint256" - }, - { "internalType": "enumSide", "name": "side", "type": "uint8" }, - { "internalType": "uint256", "name": "index", "type": "uint256" }, - { - "internalType": "uint256", - "name": "identifier", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "criteriaProof", - "type": "bytes32[]" - } - ], - "internalType": "structCriteriaResolver[]", - "name": "criteriaResolvers", - "type": "tuple[]" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "orderIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "itemIndex", - "type": "uint256" - } - ], - "internalType": "structFulfillmentComponent[]", - "name": "offerComponents", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "orderIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "itemIndex", - "type": "uint256" - } - ], - "internalType": "structFulfillmentComponent[]", - "name": "considerationComponents", - "type": "tuple[]" - } - ], - "internalType": "structFulfillment[]", - "name": "fulfillments", - "type": "tuple[]" - }, - { "internalType": "address", "name": "recipient", "type": "address" } - ], - "name": "matchAdvancedOrders", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { "internalType": "address", "name": "token", "type": "address" }, - { - "internalType": "uint256", - "name": "identifier", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structReceivedItem", - "name": "item", - "type": "tuple" - }, - { "internalType": "address", "name": "offerer", "type": "address" }, - { "internalType": "bytes32", "name": "conduitKey", "type": "bytes32" } - ], - "internalType": "structExecution[]", - "name": "executions", - "type": "tuple[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "offerer", - "type": "address" - }, - { "internalType": "address", "name": "zone", "type": "address" }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - } - ], - "internalType": "structOfferItem[]", - "name": "offer", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structConsiderationItem[]", - "name": "consideration", - "type": "tuple[]" - }, - { - "internalType": "enumOrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "startTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endTime", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "zoneHash", - "type": "bytes32" - }, - { "internalType": "uint256", "name": "salt", "type": "uint256" }, - { - "internalType": "bytes32", - "name": "conduitKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "totalOriginalConsiderationItems", - "type": "uint256" - } - ], - "internalType": "structOrderParameters", - "name": "parameters", - "type": "tuple" - }, - { "internalType": "bytes", "name": "signature", "type": "bytes" } - ], - "internalType": "structOrder[]", - "name": "orders", - "type": "tuple[]" - }, - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "orderIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "itemIndex", - "type": "uint256" - } - ], - "internalType": "structFulfillmentComponent[]", - "name": "offerComponents", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "orderIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "itemIndex", - "type": "uint256" - } - ], - "internalType": "structFulfillmentComponent[]", - "name": "considerationComponents", - "type": "tuple[]" - } - ], - "internalType": "structFulfillment[]", - "name": "fulfillments", - "type": "tuple[]" - } - ], - "name": "matchOrders", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { "internalType": "address", "name": "token", "type": "address" }, - { - "internalType": "uint256", - "name": "identifier", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structReceivedItem", - "name": "item", - "type": "tuple" - }, - { "internalType": "address", "name": "offerer", "type": "address" }, - { "internalType": "bytes32", "name": "conduitKey", "type": "bytes32" } - ], - "internalType": "structExecution[]", - "name": "executions", - "type": "tuple[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { "internalType": "string", "name": "contractName", "type": "string" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "offerer", - "type": "address" - }, - { "internalType": "address", "name": "zone", "type": "address" }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - } - ], - "internalType": "structOfferItem[]", - "name": "offer", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structConsiderationItem[]", - "name": "consideration", - "type": "tuple[]" - }, - { - "internalType": "enumOrderType", - "name": "orderType", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "startTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endTime", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "zoneHash", - "type": "bytes32" - }, - { "internalType": "uint256", "name": "salt", "type": "uint256" }, - { - "internalType": "bytes32", - "name": "conduitKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "totalOriginalConsiderationItems", - "type": "uint256" - } - ], - "internalType": "structOrderParameters", - "name": "parameters", - "type": "tuple" - }, - { "internalType": "bytes", "name": "signature", "type": "bytes" } - ], - "internalType": "structOrder[]", - "name": "orders", - "type": "tuple[]" - } - ], - "name": "validate", - "outputs": [ - { "internalType": "bool", "name": "validated", "type": "bool" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "BadContractSignature", "type": "error" }, - { "inputs": [], "name": "BadFraction", "type": "error" }, - { - "inputs": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "BadReturnValueFromERC20OnTransfer", - "type": "error" - }, - { - "inputs": [{ "internalType": "uint8", "name": "v", "type": "uint8" }], - "name": "BadSignatureV", - "type": "error" - }, - { "inputs": [], "name": "CannotCancelOrder", "type": "error" }, - { - "inputs": [], - "name": "ConsiderationCriteriaResolverOutOfRange", - "type": "error" - }, - { - "inputs": [], - "name": "ConsiderationLengthNotEqualToTotalOriginal", - "type": "error" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "orderIndex", "type": "uint256" }, - { - "internalType": "uint256", - "name": "considerationIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shortfallAmount", - "type": "uint256" - } - ], - "name": "ConsiderationNotMet", - "type": "error" - }, - { "inputs": [], "name": "CriteriaNotEnabledForItem", "type": "error" }, - { - "inputs": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { - "internalType": "uint256[]", - "name": "identifiers", - "type": "uint256[]" - }, - { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } - ], - "name": "ERC1155BatchTransferGenericFailure", - "type": "error" - }, - { "inputs": [], "name": "InexactFraction", "type": "error" }, - { "inputs": [], "name": "InsufficientNativeTokensSupplied", "type": "error" }, - { "inputs": [], "name": "Invalid1155BatchTransferEncoding", "type": "error" }, - { - "inputs": [], - "name": "InvalidBasicOrderParameterEncoding", - "type": "error" - }, - { - "inputs": [ - { "internalType": "address", "name": "conduit", "type": "address" } - ], - "name": "InvalidCallToConduit", - "type": "error" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "conduitKey", "type": "bytes32" }, - { "internalType": "address", "name": "conduit", "type": "address" } - ], - "name": "InvalidConduit", - "type": "error" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } - ], - "name": "InvalidContractOrder", - "type": "error" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "InvalidERC721TransferAmount", - "type": "error" - }, - { "inputs": [], "name": "InvalidFulfillmentComponentData", "type": "error" }, - { - "inputs": [ - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "InvalidMsgValue", - "type": "error" - }, - { "inputs": [], "name": "InvalidNativeOfferItem", "type": "error" }, - { "inputs": [], "name": "InvalidProof", "type": "error" }, - { - "inputs": [ - { "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } - ], - "name": "InvalidRestrictedOrder", - "type": "error" - }, - { "inputs": [], "name": "InvalidSignature", "type": "error" }, - { "inputs": [], "name": "InvalidSigner", "type": "error" }, - { - "inputs": [ - { "internalType": "uint256", "name": "startTime", "type": "uint256" }, - { "internalType": "uint256", "name": "endTime", "type": "uint256" } - ], - "name": "InvalidTime", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "fulfillmentIndex", - "type": "uint256" - } - ], - "name": "MismatchedFulfillmentOfferAndConsiderationComponents", - "type": "error" - }, - { - "inputs": [{ "internalType": "enumSide", "name": "side", "type": "uint8" }], - "name": "MissingFulfillmentComponentOnAggregation", - "type": "error" - }, - { "inputs": [], "name": "MissingItemAmount", "type": "error" }, - { - "inputs": [], - "name": "MissingOriginalConsiderationItems", - "type": "error" - }, - { - "inputs": [ - { "internalType": "address", "name": "account", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "NativeTokenTransferGenericFailure", - "type": "error" - }, - { - "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } - ], - "name": "NoContract", - "type": "error" - }, - { "inputs": [], "name": "NoReentrantCalls", "type": "error" }, - { "inputs": [], "name": "NoSpecifiedOrdersAvailable", "type": "error" }, - { - "inputs": [], - "name": "OfferAndConsiderationRequiredOnFulfillment", - "type": "error" - }, - { "inputs": [], "name": "OfferCriteriaResolverOutOfRange", "type": "error" }, - { - "inputs": [ - { "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } - ], - "name": "OrderAlreadyFilled", - "type": "error" - }, - { - "inputs": [{ "internalType": "enumSide", "name": "side", "type": "uint8" }], - "name": "OrderCriteriaResolverOutOfRange", - "type": "error" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } - ], - "name": "OrderIsCancelled", - "type": "error" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } - ], - "name": "OrderPartiallyFilled", - "type": "error" - }, - { "inputs": [], "name": "PartialFillsNotEnabledForOrder", "type": "error" }, - { - "inputs": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "identifier", "type": "uint256" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "TokenTransferGenericFailure", - "type": "error" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "orderIndex", "type": "uint256" }, - { - "internalType": "uint256", - "name": "considerationIndex", - "type": "uint256" - } - ], - "name": "UnresolvedConsiderationCriteria", - "type": "error" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "orderIndex", "type": "uint256" }, - { "internalType": "uint256", "name": "offerIndex", "type": "uint256" } - ], - "name": "UnresolvedOfferCriteria", - "type": "error" - }, - { "inputs": [], "name": "UnusedItemParameters", "type": "error" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newCounter", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "offerer", - "type": "address" - } - ], - "name": "CounterIncremented", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "orderHash", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "offerer", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "zone", - "type": "address" - } - ], - "name": "OrderCancelled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "orderHash", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "offerer", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "zone", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { "internalType": "address", "name": "token", "type": "address" }, - { - "internalType": "uint256", - "name": "identifier", - "type": "uint256" - }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "indexed": false, - "internalType": "structSpentItem[]", - "name": "offer", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { "internalType": "address", "name": "token", "type": "address" }, - { - "internalType": "uint256", - "name": "identifier", - "type": "uint256" - }, - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "indexed": false, - "internalType": "structReceivedItem[]", - "name": "consideration", - "type": "tuple[]" - } - ], - "name": "OrderFulfilled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "orderHash", - "type": "bytes32" - }, - { - "components": [ - { "internalType": "address", "name": "offerer", "type": "address" }, - { "internalType": "address", "name": "zone", "type": "address" }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { "internalType": "address", "name": "token", "type": "address" }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - } - ], - "internalType": "structOfferItem[]", - "name": "offer", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "enumItemType", - "name": "itemType", - "type": "uint8" - }, - { "internalType": "address", "name": "token", "type": "address" }, - { - "internalType": "uint256", - "name": "identifierOrCriteria", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "startAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endAmount", - "type": "uint256" - }, - { - "internalType": "addresspayable", - "name": "recipient", - "type": "address" - } - ], - "internalType": "structConsiderationItem[]", - "name": "consideration", - "type": "tuple[]" - }, - { - "internalType": "enumOrderType", - "name": "orderType", - "type": "uint8" - }, - { "internalType": "uint256", "name": "startTime", "type": "uint256" }, - { "internalType": "uint256", "name": "endTime", "type": "uint256" }, - { "internalType": "bytes32", "name": "zoneHash", "type": "bytes32" }, - { "internalType": "uint256", "name": "salt", "type": "uint256" }, - { - "internalType": "bytes32", - "name": "conduitKey", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "totalOriginalConsiderationItems", - "type": "uint256" - } - ], - "indexed": false, - "internalType": "structOrderParameters", - "name": "orderParameters", - "type": "tuple" - } - ], - "name": "OrderValidated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32[]", - "name": "orderHashes", - "type": "bytes32[]" - } - ], - "name": "OrdersMatched", - "type": "event" - } -] diff --git a/src/abi/SeaportAbi.ts b/src/abi/SeaportAbi.ts new file mode 100644 index 000000000..4ee7d71de --- /dev/null +++ b/src/abi/SeaportAbi.ts @@ -0,0 +1,2214 @@ +export default [ + { + inputs: [ + { + internalType: 'address', + name: 'conduitController', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + inputs: [ + { + components: [ + { internalType: 'address', name: 'offerer', type: 'address' }, + { internalType: 'address', name: 'zone', type: 'address' }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { internalType: 'address', name: 'token', type: 'address' }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + ], + internalType: 'structOfferItem[]', + name: 'offer', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { internalType: 'address', name: 'token', type: 'address' }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structConsiderationItem[]', + name: 'consideration', + type: 'tuple[]', + }, + { + internalType: 'enumOrderType', + name: 'orderType', + type: 'uint8', + }, + { internalType: 'uint256', name: 'startTime', type: 'uint256' }, + { internalType: 'uint256', name: 'endTime', type: 'uint256' }, + { internalType: 'bytes32', name: 'zoneHash', type: 'bytes32' }, + { internalType: 'uint256', name: 'salt', type: 'uint256' }, + { + internalType: 'bytes32', + name: 'conduitKey', + type: 'bytes32', + }, + { internalType: 'uint256', name: 'counter', type: 'uint256' }, + ], + internalType: 'structOrderComponents[]', + name: 'orders', + type: 'tuple[]', + }, + ], + name: 'cancel', + outputs: [{ internalType: 'bool', name: 'cancelled', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: 'address', + name: 'offerer', + type: 'address', + }, + { internalType: 'address', name: 'zone', type: 'address' }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + ], + internalType: 'structOfferItem[]', + name: 'offer', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structConsiderationItem[]', + name: 'consideration', + type: 'tuple[]', + }, + { + internalType: 'enumOrderType', + name: 'orderType', + type: 'uint8', + }, + { + internalType: 'uint256', + name: 'startTime', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endTime', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'zoneHash', + type: 'bytes32', + }, + { internalType: 'uint256', name: 'salt', type: 'uint256' }, + { + internalType: 'bytes32', + name: 'conduitKey', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'totalOriginalConsiderationItems', + type: 'uint256', + }, + ], + internalType: 'structOrderParameters', + name: 'parameters', + type: 'tuple', + }, + { internalType: 'uint120', name: 'numerator', type: 'uint120' }, + { + internalType: 'uint120', + name: 'denominator', + type: 'uint120', + }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + { internalType: 'bytes', name: 'extraData', type: 'bytes' }, + ], + internalType: 'structAdvancedOrder', + name: 'advancedOrder', + type: 'tuple', + }, + { + components: [ + { + internalType: 'uint256', + name: 'orderIndex', + type: 'uint256', + }, + { internalType: 'enumSide', name: 'side', type: 'uint8' }, + { internalType: 'uint256', name: 'index', type: 'uint256' }, + { + internalType: 'uint256', + name: 'identifier', + type: 'uint256', + }, + { + internalType: 'bytes32[]', + name: 'criteriaProof', + type: 'bytes32[]', + }, + ], + internalType: 'structCriteriaResolver[]', + name: 'criteriaResolvers', + type: 'tuple[]', + }, + { + internalType: 'bytes32', + name: 'fulfillerConduitKey', + type: 'bytes32', + }, + { internalType: 'address', name: 'recipient', type: 'address' }, + ], + name: 'fulfillAdvancedOrder', + outputs: [{ internalType: 'bool', name: 'fulfilled', type: 'bool' }], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: 'address', + name: 'offerer', + type: 'address', + }, + { internalType: 'address', name: 'zone', type: 'address' }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + ], + internalType: 'structOfferItem[]', + name: 'offer', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structConsiderationItem[]', + name: 'consideration', + type: 'tuple[]', + }, + { + internalType: 'enumOrderType', + name: 'orderType', + type: 'uint8', + }, + { + internalType: 'uint256', + name: 'startTime', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endTime', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'zoneHash', + type: 'bytes32', + }, + { internalType: 'uint256', name: 'salt', type: 'uint256' }, + { + internalType: 'bytes32', + name: 'conduitKey', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'totalOriginalConsiderationItems', + type: 'uint256', + }, + ], + internalType: 'structOrderParameters', + name: 'parameters', + type: 'tuple', + }, + { internalType: 'uint120', name: 'numerator', type: 'uint120' }, + { + internalType: 'uint120', + name: 'denominator', + type: 'uint120', + }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + { internalType: 'bytes', name: 'extraData', type: 'bytes' }, + ], + internalType: 'structAdvancedOrder[]', + name: 'advancedOrders', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'uint256', + name: 'orderIndex', + type: 'uint256', + }, + { internalType: 'enumSide', name: 'side', type: 'uint8' }, + { internalType: 'uint256', name: 'index', type: 'uint256' }, + { + internalType: 'uint256', + name: 'identifier', + type: 'uint256', + }, + { + internalType: 'bytes32[]', + name: 'criteriaProof', + type: 'bytes32[]', + }, + ], + internalType: 'structCriteriaResolver[]', + name: 'criteriaResolvers', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'uint256', + name: 'orderIndex', + type: 'uint256', + }, + { internalType: 'uint256', name: 'itemIndex', type: 'uint256' }, + ], + internalType: 'structFulfillmentComponent[][]', + name: 'offerFulfillments', + type: 'tuple[][]', + }, + { + components: [ + { + internalType: 'uint256', + name: 'orderIndex', + type: 'uint256', + }, + { internalType: 'uint256', name: 'itemIndex', type: 'uint256' }, + ], + internalType: 'structFulfillmentComponent[][]', + name: 'considerationFulfillments', + type: 'tuple[][]', + }, + { + internalType: 'bytes32', + name: 'fulfillerConduitKey', + type: 'bytes32', + }, + { internalType: 'address', name: 'recipient', type: 'address' }, + { + internalType: 'uint256', + name: 'maximumFulfilled', + type: 'uint256', + }, + ], + name: 'fulfillAvailableAdvancedOrders', + outputs: [ + { internalType: 'bool[]', name: 'availableOrders', type: 'bool[]' }, + { + components: [ + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { internalType: 'address', name: 'token', type: 'address' }, + { + internalType: 'uint256', + name: 'identifier', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structReceivedItem', + name: 'item', + type: 'tuple', + }, + { internalType: 'address', name: 'offerer', type: 'address' }, + { internalType: 'bytes32', name: 'conduitKey', type: 'bytes32' }, + ], + internalType: 'structExecution[]', + name: 'executions', + type: 'tuple[]', + }, + ], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: 'address', + name: 'offerer', + type: 'address', + }, + { internalType: 'address', name: 'zone', type: 'address' }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + ], + internalType: 'structOfferItem[]', + name: 'offer', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structConsiderationItem[]', + name: 'consideration', + type: 'tuple[]', + }, + { + internalType: 'enumOrderType', + name: 'orderType', + type: 'uint8', + }, + { + internalType: 'uint256', + name: 'startTime', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endTime', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'zoneHash', + type: 'bytes32', + }, + { internalType: 'uint256', name: 'salt', type: 'uint256' }, + { + internalType: 'bytes32', + name: 'conduitKey', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'totalOriginalConsiderationItems', + type: 'uint256', + }, + ], + internalType: 'structOrderParameters', + name: 'parameters', + type: 'tuple', + }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + ], + internalType: 'structOrder[]', + name: 'orders', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'uint256', + name: 'orderIndex', + type: 'uint256', + }, + { internalType: 'uint256', name: 'itemIndex', type: 'uint256' }, + ], + internalType: 'structFulfillmentComponent[][]', + name: 'offerFulfillments', + type: 'tuple[][]', + }, + { + components: [ + { + internalType: 'uint256', + name: 'orderIndex', + type: 'uint256', + }, + { internalType: 'uint256', name: 'itemIndex', type: 'uint256' }, + ], + internalType: 'structFulfillmentComponent[][]', + name: 'considerationFulfillments', + type: 'tuple[][]', + }, + { + internalType: 'bytes32', + name: 'fulfillerConduitKey', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'maximumFulfilled', + type: 'uint256', + }, + ], + name: 'fulfillAvailableOrders', + outputs: [ + { internalType: 'bool[]', name: 'availableOrders', type: 'bool[]' }, + { + components: [ + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { internalType: 'address', name: 'token', type: 'address' }, + { + internalType: 'uint256', + name: 'identifier', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structReceivedItem', + name: 'item', + type: 'tuple', + }, + { internalType: 'address', name: 'offerer', type: 'address' }, + { internalType: 'bytes32', name: 'conduitKey', type: 'bytes32' }, + ], + internalType: 'structExecution[]', + name: 'executions', + type: 'tuple[]', + }, + ], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'address', + name: 'considerationToken', + type: 'address', + }, + { + internalType: 'uint256', + name: 'considerationIdentifier', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'considerationAmount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'offerer', + type: 'address', + }, + { internalType: 'address', name: 'zone', type: 'address' }, + { + internalType: 'address', + name: 'offerToken', + type: 'address', + }, + { + internalType: 'uint256', + name: 'offerIdentifier', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'offerAmount', + type: 'uint256', + }, + { + internalType: 'enumBasicOrderType', + name: 'basicOrderType', + type: 'uint8', + }, + { internalType: 'uint256', name: 'startTime', type: 'uint256' }, + { internalType: 'uint256', name: 'endTime', type: 'uint256' }, + { internalType: 'bytes32', name: 'zoneHash', type: 'bytes32' }, + { internalType: 'uint256', name: 'salt', type: 'uint256' }, + { + internalType: 'bytes32', + name: 'offererConduitKey', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 'fulfillerConduitKey', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'totalOriginalAdditionalRecipients', + type: 'uint256', + }, + { + components: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structAdditionalRecipient[]', + name: 'additionalRecipients', + type: 'tuple[]', + }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + ], + internalType: 'structBasicOrderParameters', + name: 'parameters', + type: 'tuple', + }, + ], + name: 'fulfillBasicOrder', + outputs: [{ internalType: 'bool', name: 'fulfilled', type: 'bool' }], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'address', + name: 'considerationToken', + type: 'address', + }, + { + internalType: 'uint256', + name: 'considerationIdentifier', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'considerationAmount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'offerer', + type: 'address', + }, + { internalType: 'address', name: 'zone', type: 'address' }, + { + internalType: 'address', + name: 'offerToken', + type: 'address', + }, + { + internalType: 'uint256', + name: 'offerIdentifier', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'offerAmount', + type: 'uint256', + }, + { + internalType: 'enumBasicOrderType', + name: 'basicOrderType', + type: 'uint8', + }, + { internalType: 'uint256', name: 'startTime', type: 'uint256' }, + { internalType: 'uint256', name: 'endTime', type: 'uint256' }, + { internalType: 'bytes32', name: 'zoneHash', type: 'bytes32' }, + { internalType: 'uint256', name: 'salt', type: 'uint256' }, + { + internalType: 'bytes32', + name: 'offererConduitKey', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 'fulfillerConduitKey', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'totalOriginalAdditionalRecipients', + type: 'uint256', + }, + { + components: [ + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structAdditionalRecipient[]', + name: 'additionalRecipients', + type: 'tuple[]', + }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + ], + internalType: 'structBasicOrderParameters', + name: 'parameters', + type: 'tuple', + }, + ], + name: 'fulfillBasicOrder_efficient_6GL6yc', + outputs: [{ internalType: 'bool', name: 'fulfilled', type: 'bool' }], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: 'address', + name: 'offerer', + type: 'address', + }, + { internalType: 'address', name: 'zone', type: 'address' }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + ], + internalType: 'structOfferItem[]', + name: 'offer', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structConsiderationItem[]', + name: 'consideration', + type: 'tuple[]', + }, + { + internalType: 'enumOrderType', + name: 'orderType', + type: 'uint8', + }, + { + internalType: 'uint256', + name: 'startTime', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endTime', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'zoneHash', + type: 'bytes32', + }, + { internalType: 'uint256', name: 'salt', type: 'uint256' }, + { + internalType: 'bytes32', + name: 'conduitKey', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'totalOriginalConsiderationItems', + type: 'uint256', + }, + ], + internalType: 'structOrderParameters', + name: 'parameters', + type: 'tuple', + }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + ], + internalType: 'structOrder', + name: 'order', + type: 'tuple', + }, + { + internalType: 'bytes32', + name: 'fulfillerConduitKey', + type: 'bytes32', + }, + ], + name: 'fulfillOrder', + outputs: [{ internalType: 'bool', name: 'fulfilled', type: 'bool' }], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'contractOfferer', + type: 'address', + }, + ], + name: 'getContractOffererNonce', + outputs: [{ internalType: 'uint256', name: 'nonce', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: 'offerer', type: 'address' }], + name: 'getCounter', + outputs: [{ internalType: 'uint256', name: 'counter', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + components: [ + { internalType: 'address', name: 'offerer', type: 'address' }, + { internalType: 'address', name: 'zone', type: 'address' }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { internalType: 'address', name: 'token', type: 'address' }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + ], + internalType: 'structOfferItem[]', + name: 'offer', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { internalType: 'address', name: 'token', type: 'address' }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structConsiderationItem[]', + name: 'consideration', + type: 'tuple[]', + }, + { + internalType: 'enumOrderType', + name: 'orderType', + type: 'uint8', + }, + { internalType: 'uint256', name: 'startTime', type: 'uint256' }, + { internalType: 'uint256', name: 'endTime', type: 'uint256' }, + { internalType: 'bytes32', name: 'zoneHash', type: 'bytes32' }, + { internalType: 'uint256', name: 'salt', type: 'uint256' }, + { + internalType: 'bytes32', + name: 'conduitKey', + type: 'bytes32', + }, + { internalType: 'uint256', name: 'counter', type: 'uint256' }, + ], + internalType: 'structOrderComponents', + name: 'order', + type: 'tuple', + }, + ], + name: 'getOrderHash', + outputs: [{ internalType: 'bytes32', name: 'orderHash', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'bytes32', name: 'orderHash', type: 'bytes32' }], + name: 'getOrderStatus', + outputs: [ + { internalType: 'bool', name: 'isValidated', type: 'bool' }, + { internalType: 'bool', name: 'isCancelled', type: 'bool' }, + { internalType: 'uint256', name: 'totalFilled', type: 'uint256' }, + { internalType: 'uint256', name: 'totalSize', type: 'uint256' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'incrementCounter', + outputs: [{ internalType: 'uint256', name: 'newCounter', type: 'uint256' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'information', + outputs: [ + { internalType: 'string', name: 'version', type: 'string' }, + { + internalType: 'bytes32', + name: 'domainSeparator', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'conduitController', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: 'address', + name: 'offerer', + type: 'address', + }, + { internalType: 'address', name: 'zone', type: 'address' }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + ], + internalType: 'structOfferItem[]', + name: 'offer', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structConsiderationItem[]', + name: 'consideration', + type: 'tuple[]', + }, + { + internalType: 'enumOrderType', + name: 'orderType', + type: 'uint8', + }, + { + internalType: 'uint256', + name: 'startTime', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endTime', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'zoneHash', + type: 'bytes32', + }, + { internalType: 'uint256', name: 'salt', type: 'uint256' }, + { + internalType: 'bytes32', + name: 'conduitKey', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'totalOriginalConsiderationItems', + type: 'uint256', + }, + ], + internalType: 'structOrderParameters', + name: 'parameters', + type: 'tuple', + }, + { internalType: 'uint120', name: 'numerator', type: 'uint120' }, + { + internalType: 'uint120', + name: 'denominator', + type: 'uint120', + }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + { internalType: 'bytes', name: 'extraData', type: 'bytes' }, + ], + internalType: 'structAdvancedOrder[]', + name: 'orders', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'uint256', + name: 'orderIndex', + type: 'uint256', + }, + { internalType: 'enumSide', name: 'side', type: 'uint8' }, + { internalType: 'uint256', name: 'index', type: 'uint256' }, + { + internalType: 'uint256', + name: 'identifier', + type: 'uint256', + }, + { + internalType: 'bytes32[]', + name: 'criteriaProof', + type: 'bytes32[]', + }, + ], + internalType: 'structCriteriaResolver[]', + name: 'criteriaResolvers', + type: 'tuple[]', + }, + { + components: [ + { + components: [ + { + internalType: 'uint256', + name: 'orderIndex', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'itemIndex', + type: 'uint256', + }, + ], + internalType: 'structFulfillmentComponent[]', + name: 'offerComponents', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'uint256', + name: 'orderIndex', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'itemIndex', + type: 'uint256', + }, + ], + internalType: 'structFulfillmentComponent[]', + name: 'considerationComponents', + type: 'tuple[]', + }, + ], + internalType: 'structFulfillment[]', + name: 'fulfillments', + type: 'tuple[]', + }, + { internalType: 'address', name: 'recipient', type: 'address' }, + ], + name: 'matchAdvancedOrders', + outputs: [ + { + components: [ + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { internalType: 'address', name: 'token', type: 'address' }, + { + internalType: 'uint256', + name: 'identifier', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structReceivedItem', + name: 'item', + type: 'tuple', + }, + { internalType: 'address', name: 'offerer', type: 'address' }, + { internalType: 'bytes32', name: 'conduitKey', type: 'bytes32' }, + ], + internalType: 'structExecution[]', + name: 'executions', + type: 'tuple[]', + }, + ], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: 'address', + name: 'offerer', + type: 'address', + }, + { internalType: 'address', name: 'zone', type: 'address' }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + ], + internalType: 'structOfferItem[]', + name: 'offer', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structConsiderationItem[]', + name: 'consideration', + type: 'tuple[]', + }, + { + internalType: 'enumOrderType', + name: 'orderType', + type: 'uint8', + }, + { + internalType: 'uint256', + name: 'startTime', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endTime', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'zoneHash', + type: 'bytes32', + }, + { internalType: 'uint256', name: 'salt', type: 'uint256' }, + { + internalType: 'bytes32', + name: 'conduitKey', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'totalOriginalConsiderationItems', + type: 'uint256', + }, + ], + internalType: 'structOrderParameters', + name: 'parameters', + type: 'tuple', + }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + ], + internalType: 'structOrder[]', + name: 'orders', + type: 'tuple[]', + }, + { + components: [ + { + components: [ + { + internalType: 'uint256', + name: 'orderIndex', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'itemIndex', + type: 'uint256', + }, + ], + internalType: 'structFulfillmentComponent[]', + name: 'offerComponents', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'uint256', + name: 'orderIndex', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'itemIndex', + type: 'uint256', + }, + ], + internalType: 'structFulfillmentComponent[]', + name: 'considerationComponents', + type: 'tuple[]', + }, + ], + internalType: 'structFulfillment[]', + name: 'fulfillments', + type: 'tuple[]', + }, + ], + name: 'matchOrders', + outputs: [ + { + components: [ + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { internalType: 'address', name: 'token', type: 'address' }, + { + internalType: 'uint256', + name: 'identifier', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structReceivedItem', + name: 'item', + type: 'tuple', + }, + { internalType: 'address', name: 'offerer', type: 'address' }, + { internalType: 'bytes32', name: 'conduitKey', type: 'bytes32' }, + ], + internalType: 'structExecution[]', + name: 'executions', + type: 'tuple[]', + }, + ], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [], + name: 'name', + outputs: [{ internalType: 'string', name: 'contractName', type: 'string' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: 'address', + name: 'offerer', + type: 'address', + }, + { internalType: 'address', name: 'zone', type: 'address' }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + ], + internalType: 'structOfferItem[]', + name: 'offer', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { + internalType: 'address', + name: 'token', + type: 'address', + }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structConsiderationItem[]', + name: 'consideration', + type: 'tuple[]', + }, + { + internalType: 'enumOrderType', + name: 'orderType', + type: 'uint8', + }, + { + internalType: 'uint256', + name: 'startTime', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endTime', + type: 'uint256', + }, + { + internalType: 'bytes32', + name: 'zoneHash', + type: 'bytes32', + }, + { internalType: 'uint256', name: 'salt', type: 'uint256' }, + { + internalType: 'bytes32', + name: 'conduitKey', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'totalOriginalConsiderationItems', + type: 'uint256', + }, + ], + internalType: 'structOrderParameters', + name: 'parameters', + type: 'tuple', + }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + ], + internalType: 'structOrder[]', + name: 'orders', + type: 'tuple[]', + }, + ], + name: 'validate', + outputs: [{ internalType: 'bool', name: 'validated', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { inputs: [], name: 'BadContractSignature', type: 'error' }, + { inputs: [], name: 'BadFraction', type: 'error' }, + { + inputs: [ + { internalType: 'address', name: 'token', type: 'address' }, + { internalType: 'address', name: 'from', type: 'address' }, + { internalType: 'address', name: 'to', type: 'address' }, + { internalType: 'uint256', name: 'amount', type: 'uint256' }, + ], + name: 'BadReturnValueFromERC20OnTransfer', + type: 'error', + }, + { + inputs: [{ internalType: 'uint8', name: 'v', type: 'uint8' }], + name: 'BadSignatureV', + type: 'error', + }, + { inputs: [], name: 'CannotCancelOrder', type: 'error' }, + { + inputs: [], + name: 'ConsiderationCriteriaResolverOutOfRange', + type: 'error', + }, + { + inputs: [], + name: 'ConsiderationLengthNotEqualToTotalOriginal', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint256', name: 'orderIndex', type: 'uint256' }, + { + internalType: 'uint256', + name: 'considerationIndex', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'shortfallAmount', + type: 'uint256', + }, + ], + name: 'ConsiderationNotMet', + type: 'error', + }, + { inputs: [], name: 'CriteriaNotEnabledForItem', type: 'error' }, + { + inputs: [ + { internalType: 'address', name: 'token', type: 'address' }, + { internalType: 'address', name: 'from', type: 'address' }, + { internalType: 'address', name: 'to', type: 'address' }, + { + internalType: 'uint256[]', + name: 'identifiers', + type: 'uint256[]', + }, + { internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }, + ], + name: 'ERC1155BatchTransferGenericFailure', + type: 'error', + }, + { inputs: [], name: 'InexactFraction', type: 'error' }, + { inputs: [], name: 'InsufficientNativeTokensSupplied', type: 'error' }, + { inputs: [], name: 'Invalid1155BatchTransferEncoding', type: 'error' }, + { + inputs: [], + name: 'InvalidBasicOrderParameterEncoding', + type: 'error', + }, + { + inputs: [{ internalType: 'address', name: 'conduit', type: 'address' }], + name: 'InvalidCallToConduit', + type: 'error', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'conduitKey', type: 'bytes32' }, + { internalType: 'address', name: 'conduit', type: 'address' }, + ], + name: 'InvalidConduit', + type: 'error', + }, + { + inputs: [{ internalType: 'bytes32', name: 'orderHash', type: 'bytes32' }], + name: 'InvalidContractOrder', + type: 'error', + }, + { + inputs: [{ internalType: 'uint256', name: 'amount', type: 'uint256' }], + name: 'InvalidERC721TransferAmount', + type: 'error', + }, + { inputs: [], name: 'InvalidFulfillmentComponentData', type: 'error' }, + { + inputs: [{ internalType: 'uint256', name: 'value', type: 'uint256' }], + name: 'InvalidMsgValue', + type: 'error', + }, + { inputs: [], name: 'InvalidNativeOfferItem', type: 'error' }, + { inputs: [], name: 'InvalidProof', type: 'error' }, + { + inputs: [{ internalType: 'bytes32', name: 'orderHash', type: 'bytes32' }], + name: 'InvalidRestrictedOrder', + type: 'error', + }, + { inputs: [], name: 'InvalidSignature', type: 'error' }, + { inputs: [], name: 'InvalidSigner', type: 'error' }, + { + inputs: [ + { internalType: 'uint256', name: 'startTime', type: 'uint256' }, + { internalType: 'uint256', name: 'endTime', type: 'uint256' }, + ], + name: 'InvalidTime', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'fulfillmentIndex', + type: 'uint256', + }, + ], + name: 'MismatchedFulfillmentOfferAndConsiderationComponents', + type: 'error', + }, + { + inputs: [{ internalType: 'enumSide', name: 'side', type: 'uint8' }], + name: 'MissingFulfillmentComponentOnAggregation', + type: 'error', + }, + { inputs: [], name: 'MissingItemAmount', type: 'error' }, + { + inputs: [], + name: 'MissingOriginalConsiderationItems', + type: 'error', + }, + { + inputs: [ + { internalType: 'address', name: 'account', type: 'address' }, + { internalType: 'uint256', name: 'amount', type: 'uint256' }, + ], + name: 'NativeTokenTransferGenericFailure', + type: 'error', + }, + { + inputs: [{ internalType: 'address', name: 'account', type: 'address' }], + name: 'NoContract', + type: 'error', + }, + { inputs: [], name: 'NoReentrantCalls', type: 'error' }, + { inputs: [], name: 'NoSpecifiedOrdersAvailable', type: 'error' }, + { + inputs: [], + name: 'OfferAndConsiderationRequiredOnFulfillment', + type: 'error', + }, + { inputs: [], name: 'OfferCriteriaResolverOutOfRange', type: 'error' }, + { + inputs: [{ internalType: 'bytes32', name: 'orderHash', type: 'bytes32' }], + name: 'OrderAlreadyFilled', + type: 'error', + }, + { + inputs: [{ internalType: 'enumSide', name: 'side', type: 'uint8' }], + name: 'OrderCriteriaResolverOutOfRange', + type: 'error', + }, + { + inputs: [{ internalType: 'bytes32', name: 'orderHash', type: 'bytes32' }], + name: 'OrderIsCancelled', + type: 'error', + }, + { + inputs: [{ internalType: 'bytes32', name: 'orderHash', type: 'bytes32' }], + name: 'OrderPartiallyFilled', + type: 'error', + }, + { inputs: [], name: 'PartialFillsNotEnabledForOrder', type: 'error' }, + { + inputs: [ + { internalType: 'address', name: 'token', type: 'address' }, + { internalType: 'address', name: 'from', type: 'address' }, + { internalType: 'address', name: 'to', type: 'address' }, + { internalType: 'uint256', name: 'identifier', type: 'uint256' }, + { internalType: 'uint256', name: 'amount', type: 'uint256' }, + ], + name: 'TokenTransferGenericFailure', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint256', name: 'orderIndex', type: 'uint256' }, + { + internalType: 'uint256', + name: 'considerationIndex', + type: 'uint256', + }, + ], + name: 'UnresolvedConsiderationCriteria', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint256', name: 'orderIndex', type: 'uint256' }, + { internalType: 'uint256', name: 'offerIndex', type: 'uint256' }, + ], + name: 'UnresolvedOfferCriteria', + type: 'error', + }, + { inputs: [], name: 'UnusedItemParameters', type: 'error' }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'newCounter', + type: 'uint256', + }, + { + indexed: true, + internalType: 'address', + name: 'offerer', + type: 'address', + }, + ], + name: 'CounterIncremented', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'bytes32', + name: 'orderHash', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'offerer', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'zone', + type: 'address', + }, + ], + name: 'OrderCancelled', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'bytes32', + name: 'orderHash', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'offerer', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'zone', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'recipient', + type: 'address', + }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { internalType: 'address', name: 'token', type: 'address' }, + { + internalType: 'uint256', + name: 'identifier', + type: 'uint256', + }, + { internalType: 'uint256', name: 'amount', type: 'uint256' }, + ], + indexed: false, + internalType: 'structSpentItem[]', + name: 'offer', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { internalType: 'address', name: 'token', type: 'address' }, + { + internalType: 'uint256', + name: 'identifier', + type: 'uint256', + }, + { internalType: 'uint256', name: 'amount', type: 'uint256' }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + indexed: false, + internalType: 'structReceivedItem[]', + name: 'consideration', + type: 'tuple[]', + }, + ], + name: 'OrderFulfilled', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'bytes32', + name: 'orderHash', + type: 'bytes32', + }, + { + components: [ + { internalType: 'address', name: 'offerer', type: 'address' }, + { internalType: 'address', name: 'zone', type: 'address' }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { internalType: 'address', name: 'token', type: 'address' }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + ], + internalType: 'structOfferItem[]', + name: 'offer', + type: 'tuple[]', + }, + { + components: [ + { + internalType: 'enumItemType', + name: 'itemType', + type: 'uint8', + }, + { internalType: 'address', name: 'token', type: 'address' }, + { + internalType: 'uint256', + name: 'identifierOrCriteria', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'startAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'endAmount', + type: 'uint256', + }, + { + internalType: 'addresspayable', + name: 'recipient', + type: 'address', + }, + ], + internalType: 'structConsiderationItem[]', + name: 'consideration', + type: 'tuple[]', + }, + { + internalType: 'enumOrderType', + name: 'orderType', + type: 'uint8', + }, + { internalType: 'uint256', name: 'startTime', type: 'uint256' }, + { internalType: 'uint256', name: 'endTime', type: 'uint256' }, + { internalType: 'bytes32', name: 'zoneHash', type: 'bytes32' }, + { internalType: 'uint256', name: 'salt', type: 'uint256' }, + { + internalType: 'bytes32', + name: 'conduitKey', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'totalOriginalConsiderationItems', + type: 'uint256', + }, + ], + indexed: false, + internalType: 'structOrderParameters', + name: 'orderParameters', + type: 'tuple', + }, + ], + name: 'OrderValidated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'bytes32[]', + name: 'orderHashes', + type: 'bytes32[]', + }, + ], + name: 'OrdersMatched', + type: 'event', + }, +] as const; diff --git a/src/abi/erc4626ABI.json b/src/abi/erc4626ABI.json deleted file mode 100644 index 94a9a46e0..000000000 --- a/src/abi/erc4626ABI.json +++ /dev/null @@ -1,877 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_daiJoin", - "type": "address" - }, - { - "internalType": "address", - "name": "_pot", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "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": [ - { - "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": 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": "DOMAIN_SEPARATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "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": "", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "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": "dai", - "outputs": [ - { - "internalType": "contract DaiLike", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "daiJoin", - "outputs": [ - { - "internalType": "contract DaiJoinLike", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "deploymentChainId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "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": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxDeposit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxMint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "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": "", - "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": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "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": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "pot", - "outputs": [ - { - "internalType": "contract PotLike", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "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": [ - { - "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": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalAssets", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "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": [], - "name": "vat", - "outputs": [ - { - "internalType": "contract VatLike", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "version", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "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" - } -] diff --git a/src/abi/erc4626ABI.ts b/src/abi/erc4626ABI.ts new file mode 100644 index 000000000..46eca94fd --- /dev/null +++ b/src/abi/erc4626ABI.ts @@ -0,0 +1,877 @@ +export default [ + { + inputs: [ + { + internalType: 'address', + name: '_daiJoin', + type: 'address', + }, + { + internalType: 'address', + name: '_pot', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + 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: [ + { + 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: 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: 'DOMAIN_SEPARATOR', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'PERMIT_TYPEHASH', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'address', + name: '', + 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: '', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + 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: 'dai', + outputs: [ + { + internalType: 'contract DaiLike', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'daiJoin', + outputs: [ + { + internalType: 'contract DaiJoinLike', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'decimals', + outputs: [ + { + internalType: 'uint8', + name: '', + type: 'uint8', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'subtractedValue', + type: 'uint256', + }, + ], + name: 'decreaseAllowance', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'deploymentChainId', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + 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: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'addedValue', + type: 'uint256', + }, + ], + name: 'increaseAllowance', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'maxDeposit', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'maxMint', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'pure', + 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: '', + 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: [], + name: 'name', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'nonces', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + 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: 'bytes', + name: 'signature', + type: 'bytes', + }, + ], + name: 'permit', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + { + internalType: 'uint8', + name: 'v', + type: 'uint8', + }, + { + internalType: 'bytes32', + name: 'r', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 's', + type: 'bytes32', + }, + ], + name: 'permit', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'pot', + outputs: [ + { + internalType: 'contract PotLike', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + 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: [ + { + 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: 'symbol', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'totalAssets', + outputs: [ + { + internalType: 'uint256', + name: '', + 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: [], + name: 'vat', + outputs: [ + { + internalType: 'contract VatLike', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'version', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + 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', + }, +] as const; diff --git a/src/abi/frxETHMinter.json b/src/abi/frxETHMinter.json deleted file mode 100644 index 8f92aef5f..000000000 --- a/src/abi/frxETHMinter.json +++ /dev/null @@ -1,696 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "depositContractAddress", - "type": "address" - }, - { "internalType": "address", "name": "frxETHAddress", "type": "address" }, - { - "internalType": "address", - "name": "sfrxETHAddress", - "type": "address" - }, - { "internalType": "address", "name": "_owner", "type": "address" }, - { - "internalType": "address", - "name": "_timelock_address", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_withdrawalCredential", - "type": "bytes" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bool", - "name": "new_status", - "type": "bool" - } - ], - "name": "DepositEtherPaused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes", - "name": "pubKey", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "withdrawalCredential", - "type": "bytes" - } - ], - "name": "DepositSent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "sent_amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "withheld_amt", - "type": "uint256" - } - ], - "name": "ETHSubmitted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "tokenAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenAmount", - "type": "uint256" - } - ], - "name": "EmergencyERC20Recovered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "EmergencyEtherRecovered", - "type": "event" - }, - { "anonymous": false, "inputs": [], "name": "KeysCleared", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "oldOwner", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnerChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnerNominated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bool", - "name": "new_status", - "type": "bool" - } - ], - "name": "SubmitPaused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "timelock_address", - "type": "address" - } - ], - "name": "TimelockChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes", - "name": "pubKey", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "withdrawalCredential", - "type": "bytes" - } - ], - "name": "ValidatorAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "ValidatorArrayCleared", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes", - "name": "pubKey", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "remove_idx", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "dont_care_about_ordering", - "type": "bool" - } - ], - "name": "ValidatorRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "times", - "type": "uint256" - } - ], - "name": "ValidatorsPopped", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes", - "name": "from_pubKey", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "to_pubKey", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "from_idx", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "to_idx", - "type": "uint256" - } - ], - "name": "ValidatorsSwapped", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes", - "name": "_withdrawalCredential", - "type": "bytes" - } - ], - "name": "WithdrawalCredentialSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "WithheldETHMoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newRatio", - "type": "uint256" - } - ], - "name": "WithholdRatioSet", - "type": "event" - }, - { - "inputs": [], - "name": "DEPOSIT_SIZE", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "RATIO_PRECISION", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "acceptOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], - "name": "activeValidators", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { "internalType": "bytes", "name": "pubKey", "type": "bytes" }, - { "internalType": "bytes", "name": "signature", "type": "bytes" }, - { - "internalType": "bytes32", - "name": "depositDataRoot", - "type": "bytes32" - } - ], - "internalType": "struct OperatorRegistry.Validator", - "name": "validator", - "type": "tuple" - } - ], - "name": "addValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { "internalType": "bytes", "name": "pubKey", "type": "bytes" }, - { "internalType": "bytes", "name": "signature", "type": "bytes" }, - { - "internalType": "bytes32", - "name": "depositDataRoot", - "type": "bytes32" - } - ], - "internalType": "struct OperatorRegistry.Validator[]", - "name": "validatorArray", - "type": "tuple[]" - } - ], - "name": "addValidators", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "clearValidatorArray", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "currentWithheldETH", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "depositContract", - "outputs": [ - { - "internalType": "contract IDepositContract", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "max_deposits", "type": "uint256" } - ], - "name": "depositEther", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "depositEtherPaused", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "frxETHToken", - "outputs": [ - { "internalType": "contract frxETH", "name": "", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "i", "type": "uint256" }], - "name": "getValidator", - "outputs": [ - { "internalType": "bytes", "name": "pubKey", "type": "bytes" }, - { - "internalType": "bytes", - "name": "withdrawalCredentials", - "type": "bytes" - }, - { "internalType": "bytes", "name": "signature", "type": "bytes" }, - { - "internalType": "bytes32", - "name": "depositDataRoot", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes", "name": "pubKey", "type": "bytes" }, - { "internalType": "bytes", "name": "signature", "type": "bytes" }, - { - "internalType": "bytes32", - "name": "depositDataRoot", - "type": "bytes32" - } - ], - "name": "getValidatorStruct", - "outputs": [ - { - "components": [ - { "internalType": "bytes", "name": "pubKey", "type": "bytes" }, - { "internalType": "bytes", "name": "signature", "type": "bytes" }, - { - "internalType": "bytes32", - "name": "depositDataRoot", - "type": "bytes32" - } - ], - "internalType": "struct OperatorRegistry.Validator", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address payable", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "moveWithheldETH", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_owner", "type": "address" } - ], - "name": "nominateNewOwner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "nominatedOwner", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "numValidators", - "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": "uint256", "name": "times", "type": "uint256" } - ], - "name": "popValidators", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "tokenAddress", "type": "address" }, - { "internalType": "uint256", "name": "tokenAmount", "type": "uint256" } - ], - "name": "recoverERC20", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "recoverEther", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "remove_idx", "type": "uint256" }, - { - "internalType": "bool", - "name": "dont_care_about_ordering", - "type": "bool" - } - ], - "name": "removeValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_timelock_address", - "type": "address" - } - ], - "name": "setTimelock", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_new_withdrawal_pubkey", - "type": "bytes" - } - ], - "name": "setWithdrawalCredential", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "newRatio", "type": "uint256" } - ], - "name": "setWithholdRatio", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "sfrxETHToken", - "outputs": [ - { "internalType": "contract IsfrxETH", "name": "", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "submit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "recipient", "type": "address" } - ], - "name": "submitAndDeposit", - "outputs": [ - { "internalType": "uint256", "name": "shares", "type": "uint256" } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "recipient", "type": "address" } - ], - "name": "submitAndGive", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "submitPaused", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "from_idx", "type": "uint256" }, - { "internalType": "uint256", "name": "to_idx", "type": "uint256" } - ], - "name": "swapValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "timelock_address", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "togglePauseDepositEther", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "togglePauseSubmits", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withholdRatio", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { "stateMutability": "payable", "type": "receive" } -] diff --git a/src/abi/frxETHMinter.ts b/src/abi/frxETHMinter.ts new file mode 100644 index 000000000..c2450ab83 --- /dev/null +++ b/src/abi/frxETHMinter.ts @@ -0,0 +1,676 @@ +export default [ + { + inputs: [ + { + internalType: 'address', + name: 'depositContractAddress', + type: 'address', + }, + { internalType: 'address', name: 'frxETHAddress', type: 'address' }, + { + internalType: 'address', + name: 'sfrxETHAddress', + type: 'address', + }, + { internalType: 'address', name: '_owner', type: 'address' }, + { + internalType: 'address', + name: '_timelock_address', + type: 'address', + }, + { + internalType: 'bytes', + name: '_withdrawalCredential', + type: 'bytes', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'bool', + name: 'new_status', + type: 'bool', + }, + ], + name: 'DepositEtherPaused', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes', + name: 'pubKey', + type: 'bytes', + }, + { + indexed: false, + internalType: 'bytes', + name: 'withdrawalCredential', + type: 'bytes', + }, + ], + name: 'DepositSent', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'recipient', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'sent_amount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'withheld_amt', + type: 'uint256', + }, + ], + name: 'ETHSubmitted', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'tokenAddress', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'tokenAmount', + type: 'uint256', + }, + ], + name: 'EmergencyERC20Recovered', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'EmergencyEtherRecovered', + type: 'event', + }, + { anonymous: false, inputs: [], name: 'KeysCleared', type: 'event' }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'oldOwner', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'OwnerChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'OwnerNominated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'bool', + name: 'new_status', + type: 'bool', + }, + ], + name: 'SubmitPaused', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'timelock_address', + type: 'address', + }, + ], + name: 'TimelockChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'bytes', + name: 'pubKey', + type: 'bytes', + }, + { + indexed: false, + internalType: 'bytes', + name: 'withdrawalCredential', + type: 'bytes', + }, + ], + name: 'ValidatorAdded', + type: 'event', + }, + { + anonymous: false, + inputs: [], + name: 'ValidatorArrayCleared', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'bytes', + name: 'pubKey', + type: 'bytes', + }, + { + indexed: false, + internalType: 'uint256', + name: 'remove_idx', + type: 'uint256', + }, + { + indexed: false, + internalType: 'bool', + name: 'dont_care_about_ordering', + type: 'bool', + }, + ], + name: 'ValidatorRemoved', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'times', + type: 'uint256', + }, + ], + name: 'ValidatorsPopped', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'bytes', + name: 'from_pubKey', + type: 'bytes', + }, + { + indexed: false, + internalType: 'bytes', + name: 'to_pubKey', + type: 'bytes', + }, + { + indexed: false, + internalType: 'uint256', + name: 'from_idx', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'to_idx', + type: 'uint256', + }, + ], + name: 'ValidatorsSwapped', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'bytes', + name: '_withdrawalCredential', + type: 'bytes', + }, + ], + name: 'WithdrawalCredentialSet', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'to', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'WithheldETHMoved', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'newRatio', + type: 'uint256', + }, + ], + name: 'WithholdRatioSet', + type: 'event', + }, + { + inputs: [], + name: 'DEPOSIT_SIZE', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'RATIO_PRECISION', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'acceptOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'bytes', name: '', type: 'bytes' }], + name: 'activeValidators', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + components: [ + { internalType: 'bytes', name: 'pubKey', type: 'bytes' }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + { + internalType: 'bytes32', + name: 'depositDataRoot', + type: 'bytes32', + }, + ], + internalType: 'struct OperatorRegistry.Validator', + name: 'validator', + type: 'tuple', + }, + ], + name: 'addValidator', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { internalType: 'bytes', name: 'pubKey', type: 'bytes' }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + { + internalType: 'bytes32', + name: 'depositDataRoot', + type: 'bytes32', + }, + ], + internalType: 'struct OperatorRegistry.Validator[]', + name: 'validatorArray', + type: 'tuple[]', + }, + ], + name: 'addValidators', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'clearValidatorArray', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'currentWithheldETH', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'depositContract', + outputs: [ + { + internalType: 'contract IDepositContract', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: 'max_deposits', type: 'uint256' }], + name: 'depositEther', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'depositEtherPaused', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'frxETHToken', + outputs: [{ internalType: 'contract frxETH', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: 'i', type: 'uint256' }], + name: 'getValidator', + outputs: [ + { internalType: 'bytes', name: 'pubKey', type: 'bytes' }, + { + internalType: 'bytes', + name: 'withdrawalCredentials', + type: 'bytes', + }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + { + internalType: 'bytes32', + name: 'depositDataRoot', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes', name: 'pubKey', type: 'bytes' }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + { + internalType: 'bytes32', + name: 'depositDataRoot', + type: 'bytes32', + }, + ], + name: 'getValidatorStruct', + outputs: [ + { + components: [ + { internalType: 'bytes', name: 'pubKey', type: 'bytes' }, + { internalType: 'bytes', name: 'signature', type: 'bytes' }, + { + internalType: 'bytes32', + name: 'depositDataRoot', + type: 'bytes32', + }, + ], + internalType: 'struct OperatorRegistry.Validator', + name: '', + type: 'tuple', + }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [ + { internalType: 'address payable', name: 'to', type: 'address' }, + { internalType: 'uint256', name: 'amount', type: 'uint256' }, + ], + name: 'moveWithheldETH', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_owner', type: 'address' }], + name: 'nominateNewOwner', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'nominatedOwner', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'numValidators', + 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: 'uint256', name: 'times', type: 'uint256' }], + name: 'popValidators', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'tokenAddress', type: 'address' }, + { internalType: 'uint256', name: 'tokenAmount', type: 'uint256' }, + ], + name: 'recoverERC20', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: 'amount', type: 'uint256' }], + name: 'recoverEther', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: 'remove_idx', type: 'uint256' }, + { + internalType: 'bool', + name: 'dont_care_about_ordering', + type: 'bool', + }, + ], + name: 'removeValidator', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_timelock_address', + type: 'address', + }, + ], + name: 'setTimelock', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes', + name: '_new_withdrawal_pubkey', + type: 'bytes', + }, + ], + name: 'setWithdrawalCredential', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: 'newRatio', type: 'uint256' }], + name: 'setWithholdRatio', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'sfrxETHToken', + outputs: [{ internalType: 'contract IsfrxETH', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'submit', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: 'recipient', type: 'address' }], + name: 'submitAndDeposit', + outputs: [{ internalType: 'uint256', name: 'shares', type: 'uint256' }], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: 'recipient', type: 'address' }], + name: 'submitAndGive', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [], + name: 'submitPaused', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: 'from_idx', type: 'uint256' }, + { internalType: 'uint256', name: 'to_idx', type: 'uint256' }, + ], + name: 'swapValidator', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'timelock_address', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'togglePauseDepositEther', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'togglePauseSubmits', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'withholdRatio', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { stateMutability: 'payable', type: 'receive' }, +] as const; diff --git a/src/abi/rETH.json b/src/abi/rETH.json deleted file mode 100644 index 9797e0db9..000000000 --- a/src/abi/rETH.json +++ /dev/null @@ -1,231 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "contract RocketStorageInterface", - "name": "_rocketStorageAddress", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "minipool", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "time", - "type": "uint256" - } - ], - "name": "DepositAssigned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "time", - "type": "uint256" - } - ], - "name": "DepositReceived", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "time", - "type": "uint256" - } - ], - "name": "DepositRecycled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "time", - "type": "uint256" - } - ], - "name": "ExcessWithdrawn", - "type": "event" - }, - { - "inputs": [], - "name": "assignDeposits", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "deposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "getBalance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getExcessBalance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMaximumDepositAmount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getNodeBalance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getUserBalance", - "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maybeAssignDeposits", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_amount", "type": "uint256" } - ], - "name": "nodeCreditWithdrawal", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_totalAmount", "type": "uint256" } - ], - "name": "nodeDeposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "receiveVaultWithdrawalETH", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "recycleDissolvedDeposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "recycleExcessCollateral", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "recycleLiquidatedStake", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "version", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_amount", "type": "uint256" } - ], - "name": "withdrawExcessBalance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/src/abi/rETH.ts b/src/abi/rETH.ts new file mode 100644 index 000000000..cb5921621 --- /dev/null +++ b/src/abi/rETH.ts @@ -0,0 +1,225 @@ +export default [ + { + inputs: [ + { + internalType: 'contract RocketStorageInterface', + name: '_rocketStorageAddress', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'minipool', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'time', + type: 'uint256', + }, + ], + name: 'DepositAssigned', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'from', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'time', + type: 'uint256', + }, + ], + name: 'DepositReceived', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'from', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'time', + type: 'uint256', + }, + ], + name: 'DepositRecycled', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'to', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'time', + type: 'uint256', + }, + ], + name: 'ExcessWithdrawn', + type: 'event', + }, + { + inputs: [], + name: 'assignDeposits', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'deposit', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [], + name: 'getBalance', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getExcessBalance', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getMaximumDepositAmount', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getNodeBalance', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getUserBalance', + outputs: [{ internalType: 'int256', name: '', type: 'int256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'maybeAssignDeposits', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_amount', type: 'uint256' }], + name: 'nodeCreditWithdrawal', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_totalAmount', type: 'uint256' }], + name: 'nodeDeposit', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [], + name: 'receiveVaultWithdrawalETH', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [], + name: 'recycleDissolvedDeposit', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [], + name: 'recycleExcessCollateral', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [], + name: 'recycleLiquidatedStake', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [], + name: 'version', + outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_amount', type: 'uint256' }], + name: 'withdrawExcessBalance', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +] as const; diff --git a/src/abi/steth.json b/src/abi/steth.json deleted file mode 100644 index 3ff38823f..000000000 --- a/src/abi/steth.json +++ /dev/null @@ -1,896 +0,0 @@ -[ - { - "constant": false, - "inputs": [], - "name": "resume", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [{ "name": "", "type": "string" }], - "payable": false, - "stateMutability": "pure", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "stop", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "hasInitialized", - "outputs": [{ "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "_spender", "type": "address" }, - { "name": "_amount", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "STAKING_CONTROL_ROLE", - "outputs": [{ "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "name": "_ethAmount", "type": "uint256" }], - "name": "getSharesByPooledEth", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "isStakingPaused", - "outputs": [{ "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "_sender", "type": "address" }, - { "name": "_recipient", "type": "address" }, - { "name": "_amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "name": "_script", "type": "bytes" }], - "name": "getEVMScriptExecutor", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "_maxStakeLimit", "type": "uint256" }, - { "name": "_stakeLimitIncreasePerBlock", "type": "uint256" } - ], - "name": "setStakingLimit", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "RESUME_ROLE", - "outputs": [{ "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "_lidoLocator", "type": "address" }, - { "name": "_eip712StETH", "type": "address" } - ], - "name": "finalizeUpgrade_v2", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [{ "name": "", "type": "uint8" }], - "payable": false, - "stateMutability": "pure", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getRecoveryVault", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [{ "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getTotalPooledEther", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "name": "_newDepositedValidators", "type": "uint256" }], - "name": "unsafeChangeDepositedValidators", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "PAUSE_ROLE", - "outputs": [{ "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "_spender", "type": "address" }, - { "name": "_addedValue", "type": "uint256" } - ], - "name": "increaseAllowance", - "outputs": [{ "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getTreasury", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "isStopped", - "outputs": [{ "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getBufferedEther", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "_lidoLocator", "type": "address" }, - { "name": "_eip712StETH", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "receiveELRewards", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getWithdrawalCredentials", - "outputs": [{ "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getCurrentStakeLimit", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getStakeLimitFullInfo", - "outputs": [ - { "name": "isStakingPaused", "type": "bool" }, - { "name": "isStakingLimitSet", "type": "bool" }, - { "name": "currentStakeLimit", "type": "uint256" }, - { "name": "maxStakeLimit", "type": "uint256" }, - { "name": "maxStakeLimitGrowthBlocks", "type": "uint256" }, - { "name": "prevStakeLimit", "type": "uint256" }, - { "name": "prevStakeBlockNumber", "type": "uint256" } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "_sender", "type": "address" }, - { "name": "_recipient", "type": "address" }, - { "name": "_sharesAmount", "type": "uint256" } - ], - "name": "transferSharesFrom", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "name": "_account", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "resumeStaking", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getFeeDistribution", - "outputs": [ - { "name": "treasuryFeeBasisPoints", "type": "uint16" }, - { "name": "insuranceFeeBasisPoints", "type": "uint16" }, - { "name": "operatorsFeeBasisPoints", "type": "uint16" } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "receiveWithdrawals", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "name": "_sharesAmount", "type": "uint256" }], - "name": "getPooledEthByShares", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "name": "token", "type": "address" }], - "name": "allowRecoverability", - "outputs": [{ "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "name": "owner", "type": "address" }], - "name": "nonces", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "appId", - "outputs": [{ "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getOracle", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "eip712Domain", - "outputs": [ - { "name": "name", "type": "string" }, - { "name": "version", "type": "string" }, - { "name": "chainId", "type": "uint256" }, - { "name": "verifyingContract", "type": "address" } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getContractVersion", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getInitializationBlock", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "_recipient", "type": "address" }, - { "name": "_sharesAmount", "type": "uint256" } - ], - "name": "transferShares", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [{ "name": "", "type": "string" }], - "payable": false, - "stateMutability": "pure", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getEIP712StETH", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "name": "", "type": "address" }], - "name": "transferToVault", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { "name": "_sender", "type": "address" }, - { "name": "_role", "type": "bytes32" }, - { "name": "_params", "type": "uint256[]" } - ], - "name": "canPerform", - "outputs": [{ "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "name": "_referral", "type": "address" }], - "name": "submit", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "_spender", "type": "address" }, - { "name": "_subtractedValue", "type": "uint256" } - ], - "name": "decreaseAllowance", - "outputs": [{ "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getEVMScriptRegistry", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "_recipient", "type": "address" }, - { "name": "_amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "_maxDepositsCount", "type": "uint256" }, - { "name": "_stakingModuleId", "type": "uint256" }, - { "name": "_depositCalldata", "type": "bytes" } - ], - "name": "deposit", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "UNSAFE_CHANGE_DEPOSITED_VALIDATORS_ROLE", - "outputs": [{ "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getBeaconStat", - "outputs": [ - { "name": "depositedValidators", "type": "uint256" }, - { "name": "beaconValidators", "type": "uint256" }, - { "name": "beaconBalance", "type": "uint256" } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "removeStakingLimit", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "_reportTimestamp", "type": "uint256" }, - { "name": "_timeElapsed", "type": "uint256" }, - { "name": "_clValidators", "type": "uint256" }, - { "name": "_clBalance", "type": "uint256" }, - { "name": "_withdrawalVaultBalance", "type": "uint256" }, - { "name": "_elRewardsVaultBalance", "type": "uint256" }, - { "name": "_sharesRequestedToBurn", "type": "uint256" }, - { "name": "_withdrawalFinalizationBatches", "type": "uint256[]" }, - { "name": "_simulatedShareRate", "type": "uint256" } - ], - "name": "handleOracleReport", - "outputs": [{ "name": "postRebaseAmounts", "type": "uint256[4]" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getFee", - "outputs": [{ "name": "totalFee", "type": "uint16" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "kernel", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getTotalShares", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "_owner", "type": "address" }, - { "name": "_spender", "type": "address" }, - { "name": "_value", "type": "uint256" }, - { "name": "_deadline", "type": "uint256" }, - { "name": "_v", "type": "uint8" }, - { "name": "_r", "type": "bytes32" }, - { "name": "_s", "type": "bytes32" } - ], - "name": "permit", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { "name": "_owner", "type": "address" }, - { "name": "_spender", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "isPetrified", - "outputs": [{ "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getLidoLocator", - "outputs": [{ "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "canDeposit", - "outputs": [{ "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "STAKING_PAUSE_ROLE", - "outputs": [{ "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getDepositableEther", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "name": "_account", "type": "address" }], - "name": "sharesOf", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "pauseStaking", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getTotalELRewardsCollected", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { "payable": true, "stateMutability": "payable", "type": "fallback" }, - { - "anonymous": false, - "inputs": [], - "name": "StakingPaused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "StakingResumed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "name": "maxStakeLimit", "type": "uint256" }, - { - "indexed": false, - "name": "stakeLimitIncreasePerBlock", - "type": "uint256" - } - ], - "name": "StakingLimitSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "StakingLimitRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "name": "reportTimestamp", "type": "uint256" }, - { "indexed": false, "name": "preCLValidators", "type": "uint256" }, - { "indexed": false, "name": "postCLValidators", "type": "uint256" } - ], - "name": "CLValidatorsUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "name": "depositedValidators", "type": "uint256" } - ], - "name": "DepositedValidatorsChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "name": "reportTimestamp", "type": "uint256" }, - { "indexed": false, "name": "preCLBalance", "type": "uint256" }, - { "indexed": false, "name": "postCLBalance", "type": "uint256" }, - { "indexed": false, "name": "withdrawalsWithdrawn", "type": "uint256" }, - { - "indexed": false, - "name": "executionLayerRewardsWithdrawn", - "type": "uint256" - }, - { "indexed": false, "name": "postBufferedEther", "type": "uint256" } - ], - "name": "ETHDistributed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "name": "reportTimestamp", "type": "uint256" }, - { "indexed": false, "name": "timeElapsed", "type": "uint256" }, - { "indexed": false, "name": "preTotalShares", "type": "uint256" }, - { "indexed": false, "name": "preTotalEther", "type": "uint256" }, - { "indexed": false, "name": "postTotalShares", "type": "uint256" }, - { "indexed": false, "name": "postTotalEther", "type": "uint256" }, - { "indexed": false, "name": "sharesMintedAsFees", "type": "uint256" } - ], - "name": "TokenRebased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "name": "lidoLocator", "type": "address" }], - "name": "LidoLocatorSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "name": "amount", "type": "uint256" }], - "name": "ELRewardsReceived", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "name": "amount", "type": "uint256" }], - "name": "WithdrawalsReceived", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "name": "sender", "type": "address" }, - { "indexed": false, "name": "amount", "type": "uint256" }, - { "indexed": false, "name": "referral", "type": "address" } - ], - "name": "Submitted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "name": "amount", "type": "uint256" }], - "name": "Unbuffered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "name": "executor", "type": "address" }, - { "indexed": false, "name": "script", "type": "bytes" }, - { "indexed": false, "name": "input", "type": "bytes" }, - { "indexed": false, "name": "returnData", "type": "bytes" } - ], - "name": "ScriptResult", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "name": "vault", "type": "address" }, - { "indexed": true, "name": "token", "type": "address" }, - { "indexed": false, "name": "amount", "type": "uint256" } - ], - "name": "RecoverToVault", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "name": "eip712StETH", "type": "address" }], - "name": "EIP712StETHInitialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "name": "from", "type": "address" }, - { "indexed": true, "name": "to", "type": "address" }, - { "indexed": false, "name": "sharesValue", "type": "uint256" } - ], - "name": "TransferShares", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "name": "account", "type": "address" }, - { "indexed": false, "name": "preRebaseTokenAmount", "type": "uint256" }, - { "indexed": false, "name": "postRebaseTokenAmount", "type": "uint256" }, - { "indexed": false, "name": "sharesAmount", "type": "uint256" } - ], - "name": "SharesBurnt", - "type": "event" - }, - { "anonymous": false, "inputs": [], "name": "Stopped", "type": "event" }, - { "anonymous": false, "inputs": [], "name": "Resumed", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "name": "from", "type": "address" }, - { "indexed": true, "name": "to", "type": "address" }, - { "indexed": false, "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "name": "owner", "type": "address" }, - { "indexed": true, "name": "spender", "type": "address" }, - { "indexed": false, "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "name": "version", "type": "uint256" }], - "name": "ContractVersionSet", - "type": "event" - } -] diff --git a/src/abi/steth.ts b/src/abi/steth.ts new file mode 100644 index 000000000..0679252b0 --- /dev/null +++ b/src/abi/steth.ts @@ -0,0 +1,894 @@ +export default [ + { + constant: false, + inputs: [], + name: 'resume', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'name', + outputs: [{ name: '', type: 'string' }], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'stop', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'hasInitialized', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_spender', type: 'address' }, + { name: '_amount', type: 'uint256' }, + ], + name: 'approve', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'STAKING_CONTROL_ROLE', + outputs: [{ name: '', type: 'bytes32' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'totalSupply', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [{ name: '_ethAmount', type: 'uint256' }], + name: 'getSharesByPooledEth', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'isStakingPaused', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_sender', type: 'address' }, + { name: '_recipient', type: 'address' }, + { name: '_amount', type: 'uint256' }, + ], + name: 'transferFrom', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [{ name: '_script', type: 'bytes' }], + name: 'getEVMScriptExecutor', + outputs: [{ name: '', type: 'address' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_maxStakeLimit', type: 'uint256' }, + { name: '_stakeLimitIncreasePerBlock', type: 'uint256' }, + ], + name: 'setStakingLimit', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'RESUME_ROLE', + outputs: [{ name: '', type: 'bytes32' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_lidoLocator', type: 'address' }, + { name: '_eip712StETH', type: 'address' }, + ], + name: 'finalizeUpgrade_v2', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'decimals', + outputs: [{ name: '', type: 'uint8' }], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getRecoveryVault', + outputs: [{ name: '', type: 'address' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'DOMAIN_SEPARATOR', + outputs: [{ name: '', type: 'bytes32' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getTotalPooledEther', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [{ name: '_newDepositedValidators', type: 'uint256' }], + name: 'unsafeChangeDepositedValidators', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'PAUSE_ROLE', + outputs: [{ name: '', type: 'bytes32' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_spender', type: 'address' }, + { name: '_addedValue', type: 'uint256' }, + ], + name: 'increaseAllowance', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getTreasury', + outputs: [{ name: '', type: 'address' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'isStopped', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getBufferedEther', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_lidoLocator', type: 'address' }, + { name: '_eip712StETH', type: 'address' }, + ], + name: 'initialize', + outputs: [], + payable: true, + stateMutability: 'payable', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'receiveELRewards', + outputs: [], + payable: true, + stateMutability: 'payable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getWithdrawalCredentials', + outputs: [{ name: '', type: 'bytes32' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getCurrentStakeLimit', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getStakeLimitFullInfo', + outputs: [ + { name: 'isStakingPaused', type: 'bool' }, + { name: 'isStakingLimitSet', type: 'bool' }, + { name: 'currentStakeLimit', type: 'uint256' }, + { name: 'maxStakeLimit', type: 'uint256' }, + { name: 'maxStakeLimitGrowthBlocks', type: 'uint256' }, + { name: 'prevStakeLimit', type: 'uint256' }, + { name: 'prevStakeBlockNumber', type: 'uint256' }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_sender', type: 'address' }, + { name: '_recipient', type: 'address' }, + { name: '_sharesAmount', type: 'uint256' }, + ], + name: 'transferSharesFrom', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [{ name: '_account', type: 'address' }], + name: 'balanceOf', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'resumeStaking', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getFeeDistribution', + outputs: [ + { name: 'treasuryFeeBasisPoints', type: 'uint16' }, + { name: 'insuranceFeeBasisPoints', type: 'uint16' }, + { name: 'operatorsFeeBasisPoints', type: 'uint16' }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'receiveWithdrawals', + outputs: [], + payable: true, + stateMutability: 'payable', + type: 'function', + }, + { + constant: true, + inputs: [{ name: '_sharesAmount', type: 'uint256' }], + name: 'getPooledEthByShares', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [{ name: 'token', type: 'address' }], + name: 'allowRecoverability', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [{ name: 'owner', type: 'address' }], + name: 'nonces', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'appId', + outputs: [{ name: '', type: 'bytes32' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getOracle', + outputs: [{ name: '', type: 'address' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'eip712Domain', + outputs: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getContractVersion', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getInitializationBlock', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_recipient', type: 'address' }, + { name: '_sharesAmount', type: 'uint256' }, + ], + name: 'transferShares', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'symbol', + outputs: [{ name: '', type: 'string' }], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getEIP712StETH', + outputs: [{ name: '', type: 'address' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [{ name: '', type: 'address' }], + name: 'transferToVault', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { name: '_sender', type: 'address' }, + { name: '_role', type: 'bytes32' }, + { name: '_params', type: 'uint256[]' }, + ], + name: 'canPerform', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [{ name: '_referral', type: 'address' }], + name: 'submit', + outputs: [{ name: '', type: 'uint256' }], + payable: true, + stateMutability: 'payable', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_spender', type: 'address' }, + { name: '_subtractedValue', type: 'uint256' }, + ], + name: 'decreaseAllowance', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getEVMScriptRegistry', + outputs: [{ name: '', type: 'address' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_recipient', type: 'address' }, + { name: '_amount', type: 'uint256' }, + ], + name: 'transfer', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_maxDepositsCount', type: 'uint256' }, + { name: '_stakingModuleId', type: 'uint256' }, + { name: '_depositCalldata', type: 'bytes' }, + ], + name: 'deposit', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'UNSAFE_CHANGE_DEPOSITED_VALIDATORS_ROLE', + outputs: [{ name: '', type: 'bytes32' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getBeaconStat', + outputs: [ + { name: 'depositedValidators', type: 'uint256' }, + { name: 'beaconValidators', type: 'uint256' }, + { name: 'beaconBalance', type: 'uint256' }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'removeStakingLimit', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_reportTimestamp', type: 'uint256' }, + { name: '_timeElapsed', type: 'uint256' }, + { name: '_clValidators', type: 'uint256' }, + { name: '_clBalance', type: 'uint256' }, + { name: '_withdrawalVaultBalance', type: 'uint256' }, + { name: '_elRewardsVaultBalance', type: 'uint256' }, + { name: '_sharesRequestedToBurn', type: 'uint256' }, + { name: '_withdrawalFinalizationBatches', type: 'uint256[]' }, + { name: '_simulatedShareRate', type: 'uint256' }, + ], + name: 'handleOracleReport', + outputs: [{ name: 'postRebaseAmounts', type: 'uint256[4]' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getFee', + outputs: [{ name: 'totalFee', type: 'uint16' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'kernel', + outputs: [{ name: '', type: 'address' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getTotalShares', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: '_owner', type: 'address' }, + { name: '_spender', type: 'address' }, + { name: '_value', type: 'uint256' }, + { name: '_deadline', type: 'uint256' }, + { name: '_v', type: 'uint8' }, + { name: '_r', type: 'bytes32' }, + { name: '_s', type: 'bytes32' }, + ], + name: 'permit', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [ + { name: '_owner', type: 'address' }, + { name: '_spender', type: 'address' }, + ], + name: 'allowance', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'isPetrified', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getLidoLocator', + outputs: [{ name: '', type: 'address' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'canDeposit', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'STAKING_PAUSE_ROLE', + outputs: [{ name: '', type: 'bytes32' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getDepositableEther', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [{ name: '_account', type: 'address' }], + name: 'sharesOf', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'pauseStaking', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'getTotalELRewardsCollected', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { payable: true, stateMutability: 'payable', type: 'fallback' }, + { + anonymous: false, + inputs: [], + name: 'StakingPaused', + type: 'event', + }, + { + anonymous: false, + inputs: [], + name: 'StakingResumed', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: false, name: 'maxStakeLimit', type: 'uint256' }, + { + indexed: false, + name: 'stakeLimitIncreasePerBlock', + type: 'uint256', + }, + ], + name: 'StakingLimitSet', + type: 'event', + }, + { + anonymous: false, + inputs: [], + name: 'StakingLimitRemoved', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'reportTimestamp', type: 'uint256' }, + { indexed: false, name: 'preCLValidators', type: 'uint256' }, + { indexed: false, name: 'postCLValidators', type: 'uint256' }, + ], + name: 'CLValidatorsUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, name: 'depositedValidators', type: 'uint256' }], + name: 'DepositedValidatorsChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'reportTimestamp', type: 'uint256' }, + { indexed: false, name: 'preCLBalance', type: 'uint256' }, + { indexed: false, name: 'postCLBalance', type: 'uint256' }, + { indexed: false, name: 'withdrawalsWithdrawn', type: 'uint256' }, + { + indexed: false, + name: 'executionLayerRewardsWithdrawn', + type: 'uint256', + }, + { indexed: false, name: 'postBufferedEther', type: 'uint256' }, + ], + name: 'ETHDistributed', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'reportTimestamp', type: 'uint256' }, + { indexed: false, name: 'timeElapsed', type: 'uint256' }, + { indexed: false, name: 'preTotalShares', type: 'uint256' }, + { indexed: false, name: 'preTotalEther', type: 'uint256' }, + { indexed: false, name: 'postTotalShares', type: 'uint256' }, + { indexed: false, name: 'postTotalEther', type: 'uint256' }, + { indexed: false, name: 'sharesMintedAsFees', type: 'uint256' }, + ], + name: 'TokenRebased', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, name: 'lidoLocator', type: 'address' }], + name: 'LidoLocatorSet', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, name: 'amount', type: 'uint256' }], + name: 'ELRewardsReceived', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, name: 'amount', type: 'uint256' }], + name: 'WithdrawalsReceived', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'sender', type: 'address' }, + { indexed: false, name: 'amount', type: 'uint256' }, + { indexed: false, name: 'referral', type: 'address' }, + ], + name: 'Submitted', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, name: 'amount', type: 'uint256' }], + name: 'Unbuffered', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'executor', type: 'address' }, + { indexed: false, name: 'script', type: 'bytes' }, + { indexed: false, name: 'input', type: 'bytes' }, + { indexed: false, name: 'returnData', type: 'bytes' }, + ], + name: 'ScriptResult', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'vault', type: 'address' }, + { indexed: true, name: 'token', type: 'address' }, + { indexed: false, name: 'amount', type: 'uint256' }, + ], + name: 'RecoverToVault', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, name: 'eip712StETH', type: 'address' }], + name: 'EIP712StETHInitialized', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'from', type: 'address' }, + { indexed: true, name: 'to', type: 'address' }, + { indexed: false, name: 'sharesValue', type: 'uint256' }, + ], + name: 'TransferShares', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'account', type: 'address' }, + { indexed: false, name: 'preRebaseTokenAmount', type: 'uint256' }, + { indexed: false, name: 'postRebaseTokenAmount', type: 'uint256' }, + { indexed: false, name: 'sharesAmount', type: 'uint256' }, + ], + name: 'SharesBurnt', + type: 'event', + }, + { anonymous: false, inputs: [], name: 'Stopped', type: 'event' }, + { anonymous: false, inputs: [], name: 'Resumed', type: 'event' }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'from', type: 'address' }, + { indexed: true, name: 'to', type: 'address' }, + { indexed: false, name: 'value', type: 'uint256' }, + ], + name: 'Transfer', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'owner', type: 'address' }, + { indexed: true, name: 'spender', type: 'address' }, + { indexed: false, name: 'value', type: 'uint256' }, + ], + name: 'Approval', + type: 'event', + }, + { + anonymous: false, + inputs: [{ indexed: false, name: 'version', type: 'uint256' }], + name: 'ContractVersionSet', + type: 'event', + }, +] as const; diff --git a/src/abi/weth.json b/src/abi/weth.json deleted file mode 100644 index 4827e8723..000000000 --- a/src/abi/weth.json +++ /dev/null @@ -1,153 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [{ "name": "", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "guy", "type": "address" }, - { "name": "wad", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "src", "type": "address" }, - { "name": "dst", "type": "address" }, - { "name": "wad", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "name": "wad", "type": "uint256" }], - "name": "withdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [{ "name": "", "type": "uint8" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "name": "", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [{ "name": "", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "name": "dst", "type": "address" }, - { "name": "wad", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "deposit", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { "name": "", "type": "address" }, - { "name": "", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { "payable": true, "stateMutability": "payable", "type": "fallback" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "name": "src", "type": "address" }, - { "indexed": true, "name": "guy", "type": "address" }, - { "indexed": false, "name": "wad", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "name": "src", "type": "address" }, - { "indexed": true, "name": "dst", "type": "address" }, - { "indexed": false, "name": "wad", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "name": "dst", "type": "address" }, - { "indexed": false, "name": "wad", "type": "uint256" } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "name": "src", "type": "address" }, - { "indexed": false, "name": "wad", "type": "uint256" } - ], - "name": "Withdrawal", - "type": "event" - } -] diff --git a/src/abi/weth.ts b/src/abi/weth.ts new file mode 100644 index 000000000..1f792c09e --- /dev/null +++ b/src/abi/weth.ts @@ -0,0 +1,153 @@ +export default [ + { + constant: true, + inputs: [], + name: 'name', + outputs: [{ name: '', type: 'string' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: 'guy', type: 'address' }, + { name: 'wad', type: 'uint256' }, + ], + name: 'approve', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'totalSupply', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: 'src', type: 'address' }, + { name: 'dst', type: 'address' }, + { name: 'wad', type: 'uint256' }, + ], + name: 'transferFrom', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [{ name: 'wad', type: 'uint256' }], + name: 'withdraw', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'decimals', + outputs: [{ name: '', type: 'uint8' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [{ name: '', type: 'address' }], + name: 'balanceOf', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'symbol', + outputs: [{ name: '', type: 'string' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: false, + inputs: [ + { name: 'dst', type: 'address' }, + { name: 'wad', type: 'uint256' }, + ], + name: 'transfer', + outputs: [{ name: '', type: 'bool' }], + payable: false, + stateMutability: 'nonpayable', + type: 'function', + }, + { + constant: false, + inputs: [], + name: 'deposit', + outputs: [], + payable: true, + stateMutability: 'payable', + type: 'function', + }, + { + constant: true, + inputs: [ + { name: '', type: 'address' }, + { name: '', type: 'address' }, + ], + name: 'allowance', + outputs: [{ name: '', type: 'uint256' }], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { payable: true, stateMutability: 'payable', type: 'fallback' }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'src', type: 'address' }, + { indexed: true, name: 'guy', type: 'address' }, + { indexed: false, name: 'wad', type: 'uint256' }, + ], + name: 'Approval', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'src', type: 'address' }, + { indexed: true, name: 'dst', type: 'address' }, + { indexed: false, name: 'wad', type: 'uint256' }, + ], + name: 'Transfer', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'dst', type: 'address' }, + { indexed: false, name: 'wad', type: 'uint256' }, + ], + name: 'Deposit', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: 'src', type: 'address' }, + { indexed: false, name: 'wad', type: 'uint256' }, + ], + name: 'Withdrawal', + type: 'event', + }, +] as const; diff --git a/src/components/cactiComponents/ActionResponse.tsx b/src/components/cactiComponents/ActionResponse.tsx index a337f6da7..0d33ed710 100644 --- a/src/components/cactiComponents/ActionResponse.tsx +++ b/src/components/cactiComponents/ActionResponse.tsx @@ -1,19 +1,16 @@ import { useEffect, useMemo, useState } from 'react'; import Skeleton from 'react-loading-skeleton'; -import { TransactionReceipt } from '@ethersproject/abstract-provider'; -import { AddressZero } from '@ethersproject/constants'; import { CheckCircleIcon, ExclamationTriangleIcon } from '@heroicons/react/24/outline'; import { ConnectButton } from '@rainbow-me/rainbowkit'; -import { BigNumber, UnsignedTransaction } from 'ethers'; -import { formatEther, formatUnits } from 'ethers/lib/utils.js'; import tw from 'tailwind-styled-components'; -import { useAccount, useNetwork, useSwitchNetwork } from 'wagmi'; +import { TransactionReceipt, TransactionRequestBase, formatUnits, zeroAddress } from 'viem'; +import { UsePrepareContractWriteConfig, useAccount, useNetwork, useSwitchNetwork } from 'wagmi'; import useToken from '@/hooks/useToken'; import { cleanValue } from '@/utils'; import { ActionStepper } from './ActionStepper'; import useApproval, { ApprovalBasicParams } from './hooks/useApproval'; import useBalance from './hooks/useBalance'; -import useSubmitTx, { TxBasicParams } from './hooks/useSubmitTx'; +import useSubmitTx from './hooks/useSubmitTx'; export enum ActionResponseState { LOADING = 'LOADING', // background async checks @@ -50,9 +47,9 @@ type Action = { }; export type ActionResponseProps = { - txParams: TxBasicParams | undefined; - approvalParams: ApprovalBasicParams | undefined; - sendParams?: UnsignedTransaction | undefined; + txParams?: UsePrepareContractWriteConfig; + approvalParams?: ApprovalBasicParams; + sendParams?: TransactionRequestBase; label?: string; // label to show on button description?: string; // tx description (for wallet ) disabled?: boolean; @@ -88,15 +85,15 @@ export const ActionResponse = ({ const _approvalParams = useMemo( () => approvalParams || { - tokenAddress: AddressZero, - spender: AddressZero, - approvalAmount: BigNumber.from(0), + tokenAddress: zeroAddress, + spender: zeroAddress, + approvalAmount: BigInt(0), skipApproval: true, // NOTE: approval is skipped if no approval params are passed in }, [approvalParams] ); const { data: token } = useToken(undefined, _approvalParams.tokenAddress); - const amountFmt = formatUnits(_approvalParams.approvalAmount, token?.decimals); + const amountFmt = formatUnits(_approvalParams.approvalAmount, token!.decimals); /** Check for the approval. If no approvalParams, hasAllowance === true and approveTx == undefined */ const { @@ -144,13 +141,11 @@ export const ActionResponse = ({ // explicitly showing approvalParams === undefined for clarity - as oppposed to !approvalParams if (_approvalParams === undefined) return setHasEnoughBalance(true); - if (BigNumber.from(sendParams?.value || '0').gt(BigNumber.from(ethBal || '0'))) - return setHasEnoughBalance(false); + if (BigInt(sendParams?.value || '0') > BigInt(ethBal || '0')) return setHasEnoughBalance(false); // check approval token balance - if (balance && _approvalParams?.approvalAmount) { - setHasEnoughBalance(balance.gte(_approvalParams.approvalAmount)); - } + if (balance && _approvalParams?.approvalAmount) + setHasEnoughBalance(balance >= _approvalParams?.approvalAmount); }, [_approvalParams, balance, ethBal, sendParams?.value, skipBalanceCheck]); /** diff --git a/src/components/cactiComponents/hooks/useAllowance.tsx b/src/components/cactiComponents/hooks/useAllowance.tsx index 5609050a9..73cbc79a9 100644 --- a/src/components/cactiComponents/hooks/useAllowance.tsx +++ b/src/components/cactiComponents/hooks/useAllowance.tsx @@ -1,5 +1,5 @@ import { useQuery } from 'react-query'; -import { Address, erc20ABI, useAccount, useContract } from 'wagmi'; +import { Address, erc20ABI, useAccount } from 'wagmi'; import { readContract } from 'wagmi/actions'; import useChainId from '@/hooks/useChainId'; diff --git a/src/components/cactiComponents/hooks/useApproval.tsx b/src/components/cactiComponents/hooks/useApproval.tsx index 127bb46a5..8fb8b81d3 100644 --- a/src/components/cactiComponents/hooks/useApproval.tsx +++ b/src/components/cactiComponents/hooks/useApproval.tsx @@ -1,8 +1,7 @@ import { useMemo } from 'react'; import { useQuery } from 'react-query'; -import { AddressZero } from '@ethersproject/constants'; -import { BigNumber } from 'ethers'; -import { erc20ABI, useContractWrite, useWaitForTransaction } from 'wagmi'; +import { zeroAddress } from 'viem'; +import { erc20ABI, useContractWrite, usePrepareContractWrite, useWaitForTransaction } from 'wagmi'; import { prepareWriteContract } from 'wagmi/actions'; import useChainId from '@/hooks/useChainId'; import useToken from '@/hooks/useToken'; @@ -10,25 +9,27 @@ import { cleanValue } from '@/utils'; import useAllowance from './useAllowance'; export type ApprovalBasicParams = { - approvalAmount: BigNumber; + approvalAmount: bigint; tokenAddress: `0x${string}`; spender: `0x${string}`; skipApproval?: boolean; }; const validateAddress = (addr: `0x${string}`): `0x${string}` | undefined => - addr === AddressZero ? undefined : addr; + addr === zeroAddress ? undefined : addr; const useApproval = (params: ApprovalBasicParams) => { const chainId = useChainId(); const { approvalAmount, tokenAddress: _tokenAddress, spender: _spender } = params; + const tokenAddress = validateAddress(_tokenAddress); const spender = validateAddress(_spender); + const { data: token } = useToken(undefined, tokenAddress); // get token data from address (zero address === ETH) // cleanup the bignumber and convert back to a bignumber to avoid underlow errors; const amountToUse = useMemo( - () => BigNumber.from(cleanValue(approvalAmount.toString(), token?.decimals)), + () => BigInt(cleanValue(approvalAmount.toString(), token?.decimals)!), [approvalAmount, token?.decimals] ); @@ -41,17 +42,18 @@ const useApproval = (params: ApprovalBasicParams) => { const { data: config, isError: isPrepareError } = useQuery({ queryKey: ['prepareApprove', tokenAddress, spender, chainId], queryFn: async () => { + // case: invalid spender if (!spender) { - console.error(`Spender not found for approval`); + console.warn(`Spender not found for approval`); return; } - - // is eth + // case: Is eth ( null token address ) if (!tokenAddress) { + console.warn(`Null token address - no approval needed`); return; } - const config = await prepareWriteContract({ + const { request } = await prepareWriteContract({ address: tokenAddress, abi: erc20ABI, functionName: 'approve', @@ -59,12 +61,12 @@ const useApproval = (params: ApprovalBasicParams) => { chainId, }); - return config; + return request; }, refetchOnWindowFocus: false, }); - const { write: approveTx, data, isLoading: isWaitingOnUser } = useContractWrite(config); + const { write: approveTx, data, isLoading: isWaitingOnUser } = useContractWrite(config || {}); const { isError, @@ -78,7 +80,7 @@ const useApproval = (params: ApprovalBasicParams) => { const hasAllowance = useMemo(() => { if (!!params.skipApproval) return true; if (!allowanceAmount) return false; - return allowanceAmount.gte(amountToUse); + return allowanceAmount >= amountToUse; }, [allowanceAmount, amountToUse, params.skipApproval]); return { diff --git a/src/components/cactiComponents/hooks/useBalance.ts b/src/components/cactiComponents/hooks/useBalance.ts index d9390beed..45cdfaed5 100644 --- a/src/components/cactiComponents/hooks/useBalance.ts +++ b/src/components/cactiComponents/hooks/useBalance.ts @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react'; import { useQuery } from 'react-query'; -import { BigNumber } from 'ethers'; +import { zeroAddress } from 'viem'; import { useAccount } from 'wagmi'; import { fetchBalance, readContract } from 'wagmi/actions'; import erc1155ABI from '@/abi/erc1155ABI'; @@ -12,7 +12,7 @@ import useChainId from '@/hooks/useChainId'; */ const useBalance = ( tokenAddress?: `0x${string}`, - compareAmount?: BigNumber, + compareAmount?: bigint, erc1155TokenId?: string ) => { const chainId = useChainId(); @@ -26,8 +26,8 @@ const useBalance = ( return; } - // fetch native balance - if (!tokenAddress) { + // fetch native balsance + if (!tokenAddress || tokenAddress === zeroAddress) { return ( await fetchBalance({ address: account, @@ -42,7 +42,7 @@ const useBalance = ( chainId, abi: erc1155ABI, functionName: 'balanceOf', - args: [account, BigNumber.from(erc1155TokenId)], + args: [account, BigInt(erc1155TokenId)], }); return erc1155Bal; } @@ -64,10 +64,10 @@ const useBalance = ( useEffect(() => { if (compareAmount && data) { setComparisons({ - isZero: data.isZero(), - isGTEcompared: data.gte(compareAmount), - isEQcompared: data.eq(compareAmount), - isLTcompared: data.lt(compareAmount), + isZero: data === BigInt(0), + isGTEcompared: data >= compareAmount, + isEQcompared: data === compareAmount, + isLTcompared: data < compareAmount, }); } }, [compareAmount, data, erc1155TokenId]); diff --git a/src/components/cactiComponents/hooks/useEnsAvatar.tsx b/src/components/cactiComponents/hooks/useEnsAvatar.tsx index 1f4e13a27..c51d0de0a 100644 --- a/src/components/cactiComponents/hooks/useEnsAvatar.tsx +++ b/src/components/cactiComponents/hooks/useEnsAvatar.tsx @@ -12,7 +12,7 @@ const useEnsAvatar = () => { queryFn: async () => address && (await fetchEnsAvatar({ - address, + name: address, // TODO check this! ? chainId, })), refetchOnWindowFocus: false, diff --git a/src/components/cactiComponents/hooks/useSubmitTx.tsx b/src/components/cactiComponents/hooks/useSubmitTx.tsx index 2f44f5377..b4e894ee3 100644 --- a/src/components/cactiComponents/hooks/useSubmitTx.tsx +++ b/src/components/cactiComponents/hooks/useSubmitTx.tsx @@ -1,9 +1,9 @@ -import { useEffect, useState } from 'react'; +import { useEffect } from 'react'; import { toast } from 'react-toastify'; -import { TransactionReceipt } from '@ethersproject/abstract-provider'; import { useAddRecentTransaction } from '@rainbow-me/rainbowkit'; -import { CallOverrides, Overrides, PayableOverrides, UnsignedTransaction } from 'ethers'; +import { TransactionReceipt, TransactionRequestBase, encodeFunctionData } from 'viem'; import { + UsePrepareContractWriteConfig, usePrepareContractWrite, usePrepareSendTransaction, useSendTransaction, @@ -11,15 +11,6 @@ import { } from 'wagmi'; import useBalance from './useBalance'; -export type TxBasicParams = { - address?: `0x${string}`; - abi?: any; - functionName?: string; - args?: any[]; - overrides?: PayableOverrides | Overrides | CallOverrides; - enabled?: boolean; -}; - /** * random UUID for any send transactions -(it is a random UUID so that it is unlikely to clash with any other contract fnName). * TODO: consider security implications of this @@ -36,8 +27,8 @@ export const SEND_ETH_FNNAME = '8bb05f0e-05ed-11ee-be56-0242ac120002'; * @param description description of tx for wallet */ const useSubmitTx = ( - params?: TxBasicParams, - sendParams?: UnsignedTransaction, + params?: UsePrepareContractWriteConfig, + sendParams?: TransactionRequestBase, onSuccess?: (receipt?: TransactionReceipt) => void, onError?: (receipt?: TransactionReceipt) => void, description?: string @@ -52,14 +43,21 @@ const useSubmitTx = ( /* prepare a write transaction */ const { config: writeConfig } = usePrepareContractWrite({ ...params, - onError: (e) => console.log('prepare contract write error', e), + onError: (e) => console.log('Prepare contract write error', e), }); /* prepare a send transaction if the fnName matches the SEND_TRANSACTION unique id */ const { config: sendConfig, isError: isPrepareError } = usePrepareSendTransaction({ - request: { ...(writeConfig.request ?? sendParams), gasLimit: sendParams?.gasLimit || 500000 }, - enabled: true, - onError: (e) => console.log('prepare send error', e), + ...(writeConfig.request + ? { + to: writeConfig.request.address, + data: encodeFunctionData({ + ...writeConfig.request, + }), + value: writeConfig.request.value, + } + : sendParams), + onError: (e) => console.log('Prepare send error', e), }); /* usePrepped data to run write or send transactions */ diff --git a/src/components/current/CustomConnectButton.tsx b/src/components/current/CustomConnectButton.tsx index 6affce287..5881e9acb 100644 --- a/src/components/current/CustomConnectButton.tsx +++ b/src/components/current/CustomConnectButton.tsx @@ -1,6 +1,6 @@ import { PowerIcon } from '@heroicons/react/24/outline'; import { ConnectButton } from '@rainbow-me/rainbowkit'; -import { formatEther } from 'ethers/lib/utils.js'; +import { formatEther } from 'viem'; import { abbreviateHash, cleanValue } from '@/utils'; import useBalance from '../cactiComponents/hooks/useBalance'; import useEnsName from '../cactiComponents/hooks/useEnsName'; diff --git a/src/components/current/containers/MultiStepContainer.tsx b/src/components/current/containers/MultiStepContainer.tsx index 32a0f53c4..d71b5a1d3 100644 --- a/src/components/current/containers/MultiStepContainer.tsx +++ b/src/components/current/containers/MultiStepContainer.tsx @@ -1,6 +1,5 @@ import { useEffect } from 'react'; -import { TransactionReceipt } from '@ethersproject/abstract-provider'; -import { UnsignedTransaction } from 'ethers'; +import { Address, TransactionReceipt, TransactionRequestBase } from 'viem'; import { useChatContext } from '@/contexts/ChatContext'; import { ActionResponse, HeaderResponse } from '../../cactiComponents'; import { WidgetError } from '../widgets/helpers'; @@ -123,11 +122,12 @@ export const UserActionTxType = ({ sendStepResult('error', `Transaction failed`, receipt?.transactionHash || ''); }; - const unsignedTx: UnsignedTransaction = { - to: tx?.to, - data: tx?.data, - value: tx?.value, - gasLimit: tx?.gas, + const unsignedTx: TransactionRequestBase = { + from: tx?.from as Address, + to: tx?.to as Address, + data: tx?.data as Address, + value: BigInt(tx?.value || 0), + gas: BigInt(tx?.gas || 0), }; const stepDescription = diff --git a/src/components/current/containers/SingleStepContainer.tsx b/src/components/current/containers/SingleStepContainer.tsx index 52de20d45..90b1b0055 100644 --- a/src/components/current/containers/SingleStepContainer.tsx +++ b/src/components/current/containers/SingleStepContainer.tsx @@ -1,4 +1,4 @@ -import { UnsignedTransaction } from 'ethers'; +import { Address, TransactionRequestBase } from 'viem'; import useEnsAvatar from '@/components/cactiComponents/hooks/useEnsAvatar'; import useEnsName from '@/components/cactiComponents/hooks/useEnsName'; import { ActionResponse, HeaderResponse } from '../../cactiComponents'; @@ -27,11 +27,12 @@ export const SingleStepContainer = ({ return {errorMsg}; } - const unsignedTx: UnsignedTransaction = { - to: tx?.to, - data: tx?.data, - value: tx?.value, - gasLimit: tx?.gas, + const unsignedTx: TransactionRequestBase = { + from: tx?.from as Address, + to: tx?.to as Address, + data: tx?.data as Address, + value: BigInt(tx?.value || 0), + gas: BigInt(tx?.gas || 0), }; return ( diff --git a/src/components/current/widgets/4626vault/DepositIntoVault.tsx b/src/components/current/widgets/4626vault/DepositIntoVault.tsx index a0092d055..c893443cc 100644 --- a/src/components/current/widgets/4626vault/DepositIntoVault.tsx +++ b/src/components/current/widgets/4626vault/DepositIntoVault.tsx @@ -1,11 +1,9 @@ import { useMemo } from 'react'; -import { BigNumber } from 'ethers'; -import { parseUnits } from 'ethers/lib/utils.js'; -import { Address, useAccount } from 'wagmi'; -import ERC4626Abi from '@/abi/erc4626ABI.json'; +import { parseUnits } from 'viem'; +import { Address, UsePrepareContractWriteConfig, useAccount } from 'wagmi'; +import ERC4626Abi from '@/abi/erc4626ABI'; import { ActionResponse, HeaderResponse, TextResponse } from '@/components/cactiComponents'; import { ApprovalBasicParams } from '@/components/cactiComponents/hooks/useApproval'; -import { TxBasicParams } from '@/components/cactiComponents/hooks/useSubmitTx'; import useChainId from '@/hooks/useChainId'; import useToken from '@/hooks/useToken'; import { cleanValue } from '@/utils'; @@ -52,12 +50,15 @@ export const DepositVault = ({ depositToken, amount, vault }: DepositVaultProps) //TODO: Get the vault address const inputCleaned = cleanValue(amount.toString(), tokenIn?.decimals); - const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals); + const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals!); - const params: DepositVaultParams = { - assets: amountIn.toString(), - receiver: receiver!, - }; + const params = useMemo( + (): DepositVaultParams => ({ + assets: amountIn.toString(), + receiver: receiver!, + }), + [amountIn, receiver] + ); const vaultAddresss = getVaultAddress(vault, depositToken) as `0x${string}`; @@ -68,17 +69,17 @@ export const DepositVault = ({ depositToken, amount, vault }: DepositVaultProps) approvalAmount: amountIn, spender: vaultAddresss, }), - [amountIn, chainId, tokenIn] + [amountIn, tokenIn?.address, vaultAddresss] ); const tx = useMemo( - (): TxBasicParams => ({ + (): UsePrepareContractWriteConfig => ({ address: vaultAddresss, abi: ERC4626Abi, functionName: 'deposit', args: Object.values(params), }), - [amountIn, chainId, params, tokenOut?.address] + [params, vaultAddresss] ); if (amount === '*' || amount === '{amount}') @@ -94,7 +95,6 @@ export const DepositVault = ({ depositToken, amount, vault }: DepositVaultProps) label={`Deposit ${inputCleaned || ''} ${tokenInSymbol || ''} on vault`} txParams={tx} approvalParams={approval} - // disabled={true} /> ); diff --git a/src/components/current/widgets/4626vault/WithdrawFromVault.tsx b/src/components/current/widgets/4626vault/WithdrawFromVault.tsx index 6cdd29deb..4c5847c13 100644 --- a/src/components/current/widgets/4626vault/WithdrawFromVault.tsx +++ b/src/components/current/widgets/4626vault/WithdrawFromVault.tsx @@ -1,11 +1,9 @@ import { useMemo } from 'react'; -import { BigNumber } from 'ethers'; -import { parseUnits } from 'ethers/lib/utils.js'; -import { Address, useAccount } from 'wagmi'; -import ERC4626Abi from '@/abi/erc4626ABI.json'; +import { parseUnits } from 'viem'; +import { Address, UsePrepareContractWriteConfig, useAccount } from 'wagmi'; +import ERC4626Abi from '@/abi/erc4626ABI'; import { ActionResponse, HeaderResponse, TextResponse } from '@/components/cactiComponents'; import { ApprovalBasicParams } from '@/components/cactiComponents/hooks/useApproval'; -import { TxBasicParams } from '@/components/cactiComponents/hooks/useSubmitTx'; import useChainId from '@/hooks/useChainId'; import useToken from '@/hooks/useToken'; import { cleanValue } from '@/utils'; @@ -52,12 +50,15 @@ export const WithdrawVault = ({ withdrawToken, amount, vault }: WithdrawVaultPro //TODO: Get the vault address const inputCleaned = cleanValue(amount.toString(), tokenIn?.decimals); - const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals); + const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals!); - const params: WithdrawVaultParams = { - assets: amountIn.toString(), - receiver: receiver!, - }; + const params = useMemo( + (): WithdrawVaultParams => ({ + assets: amountIn.toString(), + receiver: receiver!, + }), + [amountIn, receiver] + ); const vaultAddresss = getVaultAddress(vault, withdrawToken) as `0x${string}`; @@ -68,17 +69,17 @@ export const WithdrawVault = ({ withdrawToken, amount, vault }: WithdrawVaultPro approvalAmount: amountIn, spender: vaultAddresss, }), - [amountIn, chainId, tokenIn] + [amountIn, tokenIn?.address, vaultAddresss] ); const tx = useMemo( - (): TxBasicParams => ({ + (): UsePrepareContractWriteConfig => ({ address: vaultAddresss, abi: ERC4626Abi, functionName: 'withdraw', args: Object.values(params), }), - [amountIn, chainId, params, tokenOut?.address] + [params, vaultAddresss] ); if (amount === '*' || amount === '{amount}') @@ -94,7 +95,6 @@ export const WithdrawVault = ({ withdrawToken, amount, vault }: WithdrawVaultPro label={`Withdraw ${inputCleaned || ''} ${tokenInSymbol || ''} on vault`} txParams={tx} approvalParams={approval} - // disabled={true} /> ); diff --git a/src/components/current/widgets/dsr/DepositDSR.tsx b/src/components/current/widgets/dsr/DepositDSR.tsx index bd40c1057..81a90bb84 100644 --- a/src/components/current/widgets/dsr/DepositDSR.tsx +++ b/src/components/current/widgets/dsr/DepositDSR.tsx @@ -1,12 +1,9 @@ import { useMemo } from 'react'; -import { BigNumber } from 'ethers'; -import { parseUnits } from 'ethers/lib/utils.js'; -import { useAccount } from 'wagmi'; -import ERC4626Abi from '@/abi/erc4626ABI.json'; +import { parseUnits } from 'viem'; +import { UsePrepareContractWriteConfig, useAccount } from 'wagmi'; +import ERC4626Abi from '@/abi/erc4626ABI'; import { ActionResponse, HeaderResponse, TextResponse } from '@/components/cactiComponents'; import { ApprovalBasicParams } from '@/components/cactiComponents/hooks/useApproval'; -import { TxBasicParams } from '@/components/cactiComponents/hooks/useSubmitTx'; -import useChainId from '@/hooks/useChainId'; import useToken from '@/hooks/useToken'; import { cleanValue } from '@/utils'; import { ConnectFirst } from '../helpers/ConnectFirst'; @@ -22,7 +19,6 @@ interface DepositDSRParams { // SavingsDAI: https://etherscan.io/address/0x83F20F44975D03b1b09e64809B757c47f942BEeA#code export const DepositDSR = ({ depositAmount }: DepositDSRProps) => { - const chainId = useChainId(); const { address: receiver } = useAccount(); // Here we use DAI as the tokenIn and SavingsDAI as tokenOut @@ -32,12 +28,15 @@ export const DepositDSR = ({ depositAmount }: DepositDSRProps) => { const { data: tokenOut } = useToken(tokenOutSymbol); const inputCleaned = cleanValue(depositAmount.toString(), tokenIn?.decimals); - const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals); + const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals!); - const params: DepositDSRParams = { - assets: amountIn.toString(), - receiver: receiver!, - }; + const params = useMemo( + (): DepositDSRParams => ({ + assets: amountIn.toString(), + receiver: receiver!, + }), + [amountIn, receiver] + ); // Use DAI signatures for approval const approval = useMemo( @@ -46,17 +45,17 @@ export const DepositDSR = ({ depositAmount }: DepositDSRProps) => { approvalAmount: amountIn, spender: tokenOut?.address as `0x${string}`, }), - [amountIn, chainId, tokenIn] + [amountIn, tokenIn, tokenOut] ); const tx = useMemo( - (): TxBasicParams => ({ + (): UsePrepareContractWriteConfig => ({ address: tokenOut?.address as `0x${string}`, abi: ERC4626Abi, functionName: 'deposit', args: Object.values(params), }), - [amountIn, chainId, params, tokenOut?.address] + [params, tokenOut] ); if (depositAmount === '*' || depositAmount === '{amount}') @@ -74,7 +73,6 @@ export const DepositDSR = ({ depositAmount }: DepositDSRProps) => { label={`Deposit ${inputCleaned || ''} ${tokenInSymbol || ''} on MakerDAO DSR`} txParams={tx} approvalParams={approval} - // disabled={true} /> ); diff --git a/src/components/current/widgets/dsr/RedeemDSR.tsx b/src/components/current/widgets/dsr/RedeemDSR.tsx index 44b8dd491..d6e85bd50 100644 --- a/src/components/current/widgets/dsr/RedeemDSR.tsx +++ b/src/components/current/widgets/dsr/RedeemDSR.tsx @@ -1,11 +1,9 @@ import { useMemo } from 'react'; -import { BigNumber } from 'ethers'; -import { parseUnits } from 'ethers/lib/utils.js'; -import { useAccount } from 'wagmi'; -import ERC4626Abi from '@/abi/erc4626ABI.json'; +import { parseUnits } from 'viem'; +import { UsePrepareContractWriteConfig, useAccount } from 'wagmi'; +import ERC4626Abi from '@/abi/erc4626ABI'; import { ActionResponse, HeaderResponse, TextResponse } from '@/components/cactiComponents'; import { ApprovalBasicParams } from '@/components/cactiComponents/hooks/useApproval'; -import { TxBasicParams } from '@/components/cactiComponents/hooks/useSubmitTx'; import useChainId from '@/hooks/useChainId'; import useToken from '@/hooks/useToken'; import { cleanValue } from '@/utils'; @@ -25,7 +23,6 @@ interface RedeemDSRParams { // SavingsDAI: https://etherscan.io/address/0x83F20F44975D03b1b09e64809B757c47f942BEeA#code export const RedeemDSR = ({ shares }: RedeemDSRProps) => { - const chainId = useChainId(); const { address: receiver } = useAccount(); // Here we use DAI as the tokenIn and SavingsDAI as tokenOut @@ -35,13 +32,16 @@ export const RedeemDSR = ({ shares }: RedeemDSRProps) => { const { data: tokenOut } = useToken(tokenOutSymbol); const inputCleaned = cleanValue(shares.toString(), tokenIn?.decimals); - const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals); + const amountIn = parseUnits(inputCleaned!, tokenIn?.decimals!); - const params: RedeemDSRParams = { - assets: amountIn.toString(), - receiver: receiver!, - owner: receiver!, - }; + const params = useMemo( + (): RedeemDSRParams => ({ + assets: amountIn.toString(), + receiver: receiver!, + owner: receiver!, + }), + [amountIn, receiver] + ); // Use DAI signatures for approval const approval = useMemo( @@ -50,17 +50,17 @@ export const RedeemDSR = ({ shares }: RedeemDSRProps) => { approvalAmount: amountIn, spender: tokenOut?.address as `0x${string}`, }), - [amountIn, chainId, tokenIn] + [amountIn, tokenIn, tokenOut] ); const tx = useMemo( - (): TxBasicParams => ({ + (): UsePrepareContractWriteConfig => ({ address: tokenIn?.address as `0x${string}`, abi: ERC4626Abi, functionName: 'redeem', args: Object.values(params), }), - [amountIn, chainId, params, tokenOut?.address] + [params, tokenIn] ); if (shares === '*' || shares === '{amount}') diff --git a/src/components/current/widgets/frax/StakeSfrxETH.tsx b/src/components/current/widgets/frax/StakeSfrxETH.tsx index 32b61c053..68ca77a20 100644 --- a/src/components/current/widgets/frax/StakeSfrxETH.tsx +++ b/src/components/current/widgets/frax/StakeSfrxETH.tsx @@ -1,8 +1,7 @@ -import { parseUnits } from 'ethers/lib/utils.js'; -import { useAccount } from 'wagmi'; -import frxEthMinterAbi from '@/abi/frxETHMinter.json'; +import { parseEther } from 'viem'; +import { UsePrepareContractWriteConfig, useAccount } from 'wagmi'; +import frxEthMinterAbi from '@/abi/frxETHMinter'; import { ActionResponse, HeaderResponse } from '@/components/cactiComponents'; -import { TxBasicParams } from '@/components/cactiComponents/hooks/useSubmitTx'; import { ConnectFirst } from '../helpers/ConnectFirst'; interface StakedFraxEtherProps { @@ -11,16 +10,16 @@ interface StakedFraxEtherProps { } const StakeSfrxEth = ({ receiver, value }: StakedFraxEtherProps) => { - const amount = parseUnits(value, 18); + const amount = parseEther(value); const { address: account } = useAccount(); - const tx: TxBasicParams = { + const tx: UsePrepareContractWriteConfig = { address: '0xbAFA44EFE7901E04E39Dad13167D089C559c1138', // frxETHMinter address abi: frxEthMinterAbi, // frxETHMinter abi functionName: 'submitAndDeposit', args: [receiver ?? account], - overrides: { value: amount }, + value: amount, }; return ( diff --git a/src/components/current/widgets/hop/HopBridge.tsx b/src/components/current/widgets/hop/HopBridge.tsx index 80d67cc43..330792220 100644 --- a/src/components/current/widgets/hop/HopBridge.tsx +++ b/src/components/current/widgets/hop/HopBridge.tsx @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'; import { Hop } from '@hop-protocol/sdk'; import { config } from '@hop-protocol/sdk/dist/src/config'; import { CanonicalToken, ChainSlug } from '@hop-protocol/sdk/dist/src/constants'; -import { Interface, UnsignedTransaction } from 'ethers/lib/utils'; +import { TransactionRequestBase, decodeFunctionData } from 'viem'; import { erc20ABI } from 'wagmi'; import { ActionResponse, @@ -12,8 +12,8 @@ import { } from '@/components/cactiComponents'; import { ApprovalBasicParams } from '@/components/cactiComponents/hooks/useApproval'; import useInput from '@/hooks/useInput'; -import useSigner from '@/hooks/useSigner'; import useToken from '@/hooks/useToken'; +import { useEthersSigner } from '@/utils/ethersAdapter'; interface HopBridgeProps { inputString: string; @@ -26,11 +26,11 @@ const HopBridge = ({ inputString, tokenSymbol, toChain, fromChain }: HopBridgePr const _fromChain = fromChain === 'ethereum-mainnet' ? 'mainnet' : fromChain.toLowerCase(); const _toChain = toChain === 'ethereum-mainnet' ? 'mainnet' : toChain.toLowerCase(); - const signer = useSigner(); + const signer = useEthersSigner(); const { data: tokenIn } = useToken(tokenSymbol); const input = useInput(inputString, tokenIn?.symbol!); const [approvalParams, setApprovalParams] = useState(); - const [sendParams, setSendParams] = useState(); + const [sendParams, setSendParams] = useState(); const [error, setError] = useState(null); // TODO simple check to see if the chain is potentially supported; not all chains with chain slugs are supported within hop though (i.e.: zksync is unsupported) @@ -79,11 +79,8 @@ const HopBridge = ({ inputString, tokenSymbol, toChain, fromChain }: HopBridgePr if (needsApproval) { const { data } = await bridge.populateSendApprovalTx(input.value, _fromChain); - - const erc20Interface = new Interface(erc20ABI); - - const parsed = erc20Interface.parseTransaction({ data }); - const spender = parsed.args[0]; + const { args } = decodeFunctionData({ abi: erc20ABI, data }); + const spender = args?.[0]!; setApprovalParams({ approvalAmount: input.value, @@ -93,7 +90,7 @@ const HopBridge = ({ inputString, tokenSymbol, toChain, fromChain }: HopBridgePr } const req = await bridge.populateSendTx(input.value, _fromChain, _toChain); - setSendParams({ ...req, gasLimit: 10_000_000 }); // TODO figure out a better way to handle gas limits on forks + setSendParams({ ...req, gas: BigInt(10_000_000) }); // TODO figure out a better way to handle gas limits on forks } catch (e) { setError((e as Error).message); console.error(e); diff --git a/src/components/current/widgets/lido/LidoDeposit.tsx b/src/components/current/widgets/lido/LidoDeposit.tsx index d3d22b772..4fe71697e 100644 --- a/src/components/current/widgets/lido/LidoDeposit.tsx +++ b/src/components/current/widgets/lido/LidoDeposit.tsx @@ -1,57 +1,49 @@ import { useMemo } from 'react'; -import { parseUnits } from 'ethers/lib/utils.js'; -import { Address } from 'wagmi'; -import stethAbi from '@/abi/steth.json'; +import { zeroAddress } from 'viem'; +import { Address, UsePrepareContractWriteConfig } from 'wagmi'; +import stethAbi from '@/abi/steth'; import { ActionResponse, + ErrorResponse, HeaderResponse, IconResponse, SingleLineResponse, } from '@/components/cactiComponents'; import { ResponseRow } from '@/components/cactiComponents/helpers/layout'; -import { TxBasicParams } from '@/components/cactiComponents/hooks/useSubmitTx'; +import useInput from '@/hooks/useInput'; import useToken from '@/hooks/useToken'; -import { cleanValue } from '@/utils'; interface LidoProps { - inputString: string; + inputString: number; } const LidoDeposit = ({ inputString }: LidoProps) => { const { data: tokenIn } = useToken('ETH'); const { data: tokenOut } = useToken('STETH'); + const input = useInput(inputString.toString(), tokenIn?.symbol!); - const inputCleaned = useMemo( - () => cleanValue(inputString.toString(), tokenIn?.decimals), - [inputString, tokenIn?.decimals] - ); - const value = useMemo(() => { - return parseUnits(inputCleaned!, tokenIn?.decimals); - }, [inputCleaned, tokenIn?.decimals]); - - const tx: TxBasicParams = useMemo( + const tx = useMemo( () => ({ address: tokenOut?.address as Address | undefined, abi: stethAbi, functionName: 'submit', - args: ['0x0000000000000000000000000000000000000000'], - overrides: { - value, - }, + args: [zeroAddress], + value: input?.value, }), - [tokenOut?.address, value] + [input?.value, tokenOut?.address] ); return ( <> + {!input && } - + diff --git a/src/components/current/widgets/lido/LidoWithdraw.tsx b/src/components/current/widgets/lido/LidoWithdraw.tsx index c57c2ea28..3e7168d33 100644 --- a/src/components/current/widgets/lido/LidoWithdraw.tsx +++ b/src/components/current/widgets/lido/LidoWithdraw.tsx @@ -1,15 +1,16 @@ import { useMemo } from 'react'; -import { parseUnits } from 'ethers/lib/utils.js'; -import { Address } from 'wagmi'; -import stethAbi from '@/abi/steth.json'; +import { parseEther, zeroAddress } from 'viem'; +import { Address, UsePrepareContractWriteConfig } from 'wagmi'; +import stethAbi from '@/abi/steth'; import { ActionResponse, + ErrorResponse, HeaderResponse, IconResponse, SingleLineResponse, } from '@/components/cactiComponents'; import { ResponseRow } from '@/components/cactiComponents/helpers/layout'; -import { TxBasicParams } from '@/components/cactiComponents/hooks/useSubmitTx'; +import useInput from '@/hooks/useInput'; import useToken from '@/hooks/useToken'; import { cleanValue } from '@/utils'; @@ -19,37 +20,30 @@ interface LidoProps { const LidoWithdraw = ({ inputString }: LidoProps) => { const { data: tokenIn } = useToken('STETH'); - console.log('🦄 ~ file: LidoWithdraw.tsx:22 ~ LidoWithdraw ~ tokenIn:', tokenIn); - const { data: tokenOut } = useToken('ETH'); + const input = useInput(inputString, tokenIn?.symbol!); - const inputCleaned = useMemo( - () => cleanValue(inputString.toString(), tokenIn?.decimals), - [inputString, tokenIn?.decimals] - ); - const value = useMemo(() => { - return parseUnits(inputCleaned!, tokenIn?.decimals); - }, [inputCleaned, tokenIn?.decimals]); - - const tx: TxBasicParams = useMemo( + const tx = useMemo( () => ({ - address: tokenOut?.address as Address | undefined, + address: tokenIn?.address, abi: stethAbi, - functionName: 'submit', - args: ['0x0000000000000000000000000000000000000000'], + functionName: 'submit', // TODO figure out withdraw function + args: [zeroAddress], + value: input?.value, }), - [tokenOut?.address] + [input?.value, tokenIn?.address] ); return ( <> + {!input && } - + diff --git a/src/components/current/widgets/liquity/borrow/LiquityBorrow.tsx b/src/components/current/widgets/liquity/borrow/LiquityBorrow.tsx index 1120d311f..95c45c78d 100644 --- a/src/components/current/widgets/liquity/borrow/LiquityBorrow.tsx +++ b/src/components/current/widgets/liquity/borrow/LiquityBorrow.tsx @@ -1,15 +1,15 @@ import { useEffect, useState } from 'react'; import { EthersLiquity } from '@liquity/lib-ethers'; -import { UnsignedTransaction } from 'ethers/lib/utils.js'; +import { Address, TransactionRequestBase } from 'viem'; import { ActionResponse, HeaderResponse, ListResponse, SingleLineResponse, } from '@/components/cactiComponents'; -import useSigner from '@/hooks/useSigner'; import useToken from '@/hooks/useToken'; import { cleanValue } from '@/utils'; +import { useEthersSigner } from '@/utils/ethersAdapter'; interface BorrowProps { borrowAmount: string; @@ -17,7 +17,7 @@ interface BorrowProps { } const LiquityBorrow = ({ borrowAmount, collateralAmount }: BorrowProps) => { - const signer = useSigner(); + const signer = useEthersSigner(); const { data: borrowToken } = useToken('LUSD'); const { data: collateralToken } = useToken('ETH'); const borrowCleaned = cleanValue(borrowAmount, borrowToken?.decimals); @@ -25,7 +25,7 @@ const LiquityBorrow = ({ borrowAmount, collateralAmount }: BorrowProps) => { const borrowLUSD = isNaN(+borrowCleaned!) ? 0 : +borrowCleaned!; const depositCollateral = isNaN(+collateralCleaned!) ? 0 : +collateralCleaned!; - const [sendParams, setSendParams] = useState(); + const [sendParams, setSendParams] = useState(); useEffect(() => { (async () => { @@ -35,7 +35,18 @@ const LiquityBorrow = ({ borrowAmount, collateralAmount }: BorrowProps) => { borrowLUSD, depositCollateral, }); - setSendParams(params); + + if (!params.from) { + console.error('No connected address found'); + return; + } + + setSendParams({ + to: params.to as Address | undefined, + data: params.data as Address | undefined, + from: params.from as Address, + value: BigInt(params.value?.toString() || 0), + }); })(); }, [signer, borrowLUSD, depositCollateral]); diff --git a/src/components/current/widgets/liquity/close/LiquityClose.tsx b/src/components/current/widgets/liquity/close/LiquityClose.tsx index 83dba7bc5..91d00fff7 100644 --- a/src/components/current/widgets/liquity/close/LiquityClose.tsx +++ b/src/components/current/widgets/liquity/close/LiquityClose.tsx @@ -1,14 +1,14 @@ import { useEffect, useState } from 'react'; import { EthersLiquity } from '@liquity/lib-ethers'; -import { UnsignedTransaction, formatUnits } from 'ethers/lib/utils.js'; -import { useAccount } from 'wagmi'; +import { Address, TransactionRequestBase, formatEther, formatUnits } from 'viem'; +import { useAccount, useWalletClient } from 'wagmi'; import { ActionResponse, HeaderResponse, ListResponse, SingleLineResponse, } from '@/components/cactiComponents'; -import useSigner from '@/hooks/useSigner'; +import { walletClientToSigner } from '@/utils/ethersAdapter'; interface LiquityCloseData { collateral: string; @@ -17,8 +17,9 @@ interface LiquityCloseData { const LiquityClose = () => { const { address: account } = useAccount(); - const signer = useSigner(); - const [sendParams, setSendParams] = useState(); + const { data: walletClient } = useWalletClient(); + const signer = walletClient ? walletClientToSigner(walletClient) : undefined; + const [sendParams, setSendParams] = useState(); const [data, setData] = useState(); useEffect(() => { @@ -27,11 +28,22 @@ const LiquityClose = () => { const liquity = await EthersLiquity.connect(signer); const trove = await liquity.getTrove(account); const collateral = trove.collateral.bigNumber; - const collateral_ = formatUnits(collateral, 18); // ether decimals + const collateral_ = formatEther(BigInt(collateral.toString())); // ether decimals const debt = trove.debt.bigNumber; - const debt_ = formatUnits(debt, 18); // LUSD decimals + const debt_ = formatUnits(BigInt(debt.toString()), 18); // LUSD decimals const { rawPopulatedTransaction: params } = await liquity.populate.closeTrove(); - setSendParams(params); + if (!params.from) { + console.error('No connected address found'); + return; + } + + setSendParams({ + to: params.to as Address | undefined, + data: params.data as Address | undefined, + from: params.from as Address, + value: BigInt(params.value?.toString() || 0), + }); + setData({ collateral: collateral_, debt: debt_ }); })(); }, [signer, account]); diff --git a/src/components/current/widgets/nft/BuyNft.tsx b/src/components/current/widgets/nft/BuyNft.tsx index 027438a3c..893735546 100644 --- a/src/components/current/widgets/nft/BuyNft.tsx +++ b/src/components/current/widgets/nft/BuyNft.tsx @@ -1,6 +1,5 @@ -import { BigNumber } from 'ethers'; -import { usePrepareContractWrite } from 'wagmi'; -import SeaportAbi from '@/abi/SeaportAbi.json'; +import { UsePrepareContractWriteConfig, usePrepareContractWrite } from 'wagmi'; +import SeaportAbi from '@/abi/SeaportAbi'; import { ActionResponse, HeaderResponse } from '@/components/cactiComponents'; import { ImageVariant } from '@/components/cactiComponents/ImageResponse'; import { ConnectFirst } from '../helpers/ConnectFirst'; @@ -24,7 +23,7 @@ export const BuyNft = ({ protocolAddress, asset, }: BuyNftProps) => { - const tx = { + const tx: UsePrepareContractWriteConfig = { address: protocolAddress as `0x${string}`, abi: SeaportAbi, functionName: 'fulfillOrder', @@ -35,19 +34,13 @@ export const BuyNft = ({ }, '0x0000000000000000000000000000000000000000000000000000000000000000', // fulfillerConduitKey ], - overrides: { - value: BigNumber.from(orderValue || 0), - gasLimit: 500000, - }, + value: BigInt(orderValue), + gas: BigInt(500_000), }; // Simulate tx to re-verify if the NFT is for sale const { isError } = usePrepareContractWrite({ ...tx, - overrides: { - ...tx.overrides, - gasLimit: undefined, - }, }); const notForSale = !isForSale || isError; @@ -55,15 +48,7 @@ export const BuyNft = ({ return ( - + { () => cleanValue(inputString.toString(), tokenIn?.decimals), [inputString, tokenIn?.decimals] ); - const value = useMemo(() => { - return parseUnits(inputCleaned!, tokenIn?.decimals); - }, [inputCleaned, tokenIn?.decimals]); - const tx: TxBasicParams = useMemo( + const tx: UsePrepareContractWriteConfig = useMemo( () => ({ address: '0xDD3f50F8A6CafbE9b31a427582963f465E745AF8', abi: rETHAbi, functionName: 'deposit', args: [], - overrides: { - value, - }, + value: parseEther(inputCleaned!), }), - [value] + [inputCleaned] ); return ( diff --git a/src/components/current/widgets/rocketPool/rocketPoolWithdraw.tsx b/src/components/current/widgets/rocketPool/rocketPoolWithdraw.tsx index e9dc46140..cd2bb8055 100644 --- a/src/components/current/widgets/rocketPool/rocketPoolWithdraw.tsx +++ b/src/components/current/widgets/rocketPool/rocketPoolWithdraw.tsx @@ -1,7 +1,6 @@ import { useMemo } from 'react'; -import { parseUnits } from 'ethers/lib/utils.js'; -import { Address } from 'wagmi'; -import stethAbi from '@/abi/steth.json'; +import { Address, UsePrepareContractWriteConfig } from 'wagmi'; +import rETHAbi from '@/abi/rETH'; import { ActionResponse, HeaderResponse, @@ -9,7 +8,6 @@ import { SingleLineResponse, } from '@/components/cactiComponents'; import { ResponseRow } from '@/components/cactiComponents/helpers/layout'; -import { TxBasicParams } from '@/components/cactiComponents/hooks/useSubmitTx'; import useToken from '@/hooks/useToken'; import { cleanValue } from '@/utils'; @@ -25,16 +23,13 @@ const RethWithdraw = ({ inputString }: RethProps) => { () => cleanValue(inputString.toString(), tokenIn?.decimals), [inputString, tokenIn?.decimals] ); - const value = useMemo(() => { - return parseUnits(inputCleaned!, tokenIn?.decimals); - }, [inputCleaned, tokenIn?.decimals]); - const tx: TxBasicParams = useMemo( + const tx: UsePrepareContractWriteConfig = useMemo( () => ({ - address: tokenOut?.address as Address | undefined, - abi: stethAbi, - functionName: 'submit', - args: ['0x0000000000000000000000000000000000000000'], + address: '0xDD3f50F8A6CafbE9b31a427582963f465E745AF8', + abi: rETHAbi, + functionName: 'burn', + args: [], }), [tokenOut?.address] ); diff --git a/src/components/current/widgets/transfer/Transfer.tsx b/src/components/current/widgets/transfer/Transfer.tsx index b804b27a5..b354301b9 100644 --- a/src/components/current/widgets/transfer/Transfer.tsx +++ b/src/components/current/widgets/transfer/Transfer.tsx @@ -1,8 +1,7 @@ -import { AddressZero } from '@ethersproject/constants'; -import { parseUnits } from 'ethers/lib/utils.js'; +import { useMemo } from 'react'; +import { parseUnits } from 'viem'; import { erc20ABI, useAccount, useEnsAddress } from 'wagmi'; import { ActionResponse, HeaderResponse } from '@/components/cactiComponents'; -import { SEND_ETH_FNNAME } from '@/components/cactiComponents/hooks/useSubmitTx'; import useToken from '@/hooks/useToken'; import { ConnectFirst } from '../helpers/ConnectFirst'; @@ -13,38 +12,29 @@ interface TransferWidgetProps { } const Transfer = ({ tokenSymbol, amtString, receiver }: TransferWidgetProps) => { + const { address: account } = useAccount(); const { isETH, data: token } = useToken(tokenSymbol); - const amount = parseUnits(amtString, token?.decimals); + const amount = parseUnits(amtString, token?.decimals!); - // Resolve ENS name - const { data: receiverAddress } = useEnsAddress({ - name: receiver, + // Resolve ENS name, if needed + const { data: addressFromName } = useEnsAddress({ + name: receiver.trimStart().slice(2) === '0x' ? undefined : receiver, // only run if string doesnt start with 0x }); - if (!isETH && !token) return null; // if not eth, and there is no token - abort. + const receiverAddress = useMemo(() => { + if (addressFromName) return addressFromName; + return receiver as `0x${string}`; + }, [addressFromName, receiver]); - const approval = { - approvalAmount: amount, - tokenAddress: token!.address as `0x${string}`, - spender: AddressZero as `0x${string}`, - skipApproval: true, - }; + if (!isETH && !token) return null; // if not eth, and there is no token - abort. /* tx parameters to transfer ETH */ - const tx = isETH - ? { - address: undefined, - abi: undefined, - functionName: SEND_ETH_FNNAME, - args: [receiverAddress ? receiverAddress : (receiver as `0x${string}`), amount], - } - : /* tx parameters to transfer an ERC20 token */ - { - address: token!.address as `0x${string}`, - abi: erc20ABI, - functionName: 'transfer', - args: [receiverAddress ? receiverAddress : (receiver as `0x${string}`), amount], - }; + const tx = { + address: token!.address as `0x${string}`, + abi: erc20ABI, + functionName: 'transfer', + args: [receiverAddress, amount], + }; /* TODO Transfer NFT */ /* TODO Transfer ERC721 */ @@ -57,9 +47,9 @@ const Transfer = ({ tokenSymbol, amtString, receiver }: TransferWidgetProps) => /> ); diff --git a/src/components/current/widgets/tx-replay/TransactionReplay.tsx b/src/components/current/widgets/tx-replay/TransactionReplay.tsx index 25ce2120e..4dd67a160 100644 --- a/src/components/current/widgets/tx-replay/TransactionReplay.tsx +++ b/src/components/current/widgets/tx-replay/TransactionReplay.tsx @@ -1,7 +1,6 @@ import React, { useCallback, useEffect, useState } from 'react'; -import { BigNumber, UnsignedTransaction, ethers } from 'ethers'; -import { decodeFunctionData } from 'viem'; -import { Address, useTransaction } from 'wagmi'; +import { TransactionRequestBase, decodeFunctionData, encodeFunctionData, getAddress } from 'viem'; +import { Address, useAccount, useTransaction } from 'wagmi'; import { ActionResponse, HeaderResponse, SingleLineResponse } from '@/components/cactiComponents'; import SkeletonWrap from '@/components/shared/SkeletonWrap'; import useAbi from '@/hooks/useAbi'; @@ -12,16 +11,17 @@ interface TransactionReplayProps { } const TransactionReplay = ({ txHash }: TransactionReplayProps) => { + const { address: account } = useAccount(); const { data, isLoading } = useTransaction({ hash: txHash }); - const { data: abi } = useAbi(data?.to as Address | undefined); - const [sendParams, setSendParams] = useState(); + const { data: abi } = useAbi(data?.to); + const [sendParams, setSendParams] = useState(); const [isError, setIsError] = useState(false); const explorerUrl = `https://etherscan.io/tx/${txHash}`; // State to hold editable fields, stored as strings for simplicity const [decoded, setDecoded] = useState<{ - to?: string; + to: Address; value: string; functionName?: string; args?: { @@ -33,7 +33,7 @@ const TransactionReplay = ({ txHash }: TransactionReplayProps) => { // handle decoding the transaction data const handleDecode = useCallback(() => { - if (!data) return console.log('no data'); + if (!data?.input || !data.to) return console.log('no data'); if (!abi) { console.log('no abi, is possibly an eth/native currency transfer'); return setDecoded({ @@ -48,7 +48,7 @@ const TransactionReplay = ({ txHash }: TransactionReplayProps) => { let functionName: string; try { - const decoded = decodeFunctionData({ abi, data: data.data as Address }); + const decoded = decodeFunctionData({ abi, data: data.input }); args = decoded.args as string[]; functionName = decoded.functionName; } catch (e) { @@ -110,7 +110,7 @@ const TransactionReplay = ({ txHash }: TransactionReplayProps) => { } // handle changing the to param if (name === 'to') { - setDecoded((d) => d && { ...d, to: value }); + setDecoded((d) => d && { ...d, to: getAddress(value) }); return; } @@ -126,16 +126,16 @@ const TransactionReplay = ({ txHash }: TransactionReplayProps) => { }); }; - const getSendParams = useCallback((): UnsignedTransaction | undefined => { + const getSendParams = useCallback((): TransactionRequestBase | undefined => { if (!decoded) { console.error('Decoded data is missing'); return; } // Initialize a transaction object - let transaction: Partial = { + let transaction: Partial = { to: decoded.to, - value: BigNumber.from(decoded.value), + value: BigInt(decoded.value), }; // If it's a simple transfer @@ -155,15 +155,13 @@ const TransactionReplay = ({ txHash }: TransactionReplayProps) => { return arg.value; }) || []; - // Create the function signature - const functionTypes = decoded.args.map((arg) => arg.type).join(','); - const functionSignature = `${decoded.functionName}(${functionTypes})`; - - // Create the encoded data field for contract interaction - const iface = new ethers.utils.Interface(abi); try { // Encode the function data - const data = iface.encodeFunctionData(functionSignature, convertedArgs); + const data = encodeFunctionData({ + abi, + functionName: decoded.functionName, + args: convertedArgs, + }); transaction.data = data; // Now, you can populate the transaction object and pass it to ActionResponse } catch (e) { @@ -171,8 +169,8 @@ const TransactionReplay = ({ txHash }: TransactionReplayProps) => { } } - setSendParams(transaction); - }, [abi, decoded]); + setSendParams({ from: account!, ...transaction }); + }, [abi, account, decoded]); useEffect(() => { getSendParams(); @@ -205,7 +203,7 @@ const TransactionReplay = ({ txHash }: TransactionReplayProps) => { /> ))} - {BigNumber.from(decoded.value)?.gt(ethers.constants.Zero) && decoded.to && ( + {BigInt(decoded.value) > BigInt(0) && decoded.to && ( <>