diff --git a/Cargo.toml b/Cargo.toml index 68fa68b..87a177e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = [ "crates/*" ] resolver = "2" [workspace.package] -version = "0.3.0" +version = "0.4.0" edition = "2021" rust-version = "1.76" authors = ["Zenith Contributors"] diff --git a/README.md b/README.md index 308c5d4..d2458bb 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Rust utilites for working with [Zenith](https://github.com/init4tech/zenith). ## Development -This crate contains an exmaple block builder in the Signet ecosystem. +This crate contains an example block builder in the Signet ecosystem. ### Requirements diff --git a/crates/types/abi/HostOrders.json b/crates/types/abi/HostOrders.json new file mode 100644 index 0000000..6e9c47a --- /dev/null +++ b/crates/types/abi/HostOrders.json @@ -0,0 +1,168 @@ +[ + { + "type": "constructor", + "inputs": [ + { "name": "_permit2", "type": "address", "internalType": "address" } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "fill", + "inputs": [ + { + "name": "outputs", + "type": "tuple[]", + "internalType": "struct IOrders.Output[]", + "components": [ + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "recipient", "type": "address", "internalType": "address" }, + { "name": "chainId", "type": "uint32", "internalType": "uint32" } + ] + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "fillPermit2", + "inputs": [ + { + "name": "outputs", + "type": "tuple[]", + "internalType": "struct IOrders.Output[]", + "components": [ + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "recipient", "type": "address", "internalType": "address" }, + { "name": "chainId", "type": "uint32", "internalType": "uint32" } + ] + }, + { + "name": "permit2", + "type": "tuple", + "internalType": "struct UsesPermit2.Permit2Batch", + "components": [ + { + "name": "permit", + "type": "tuple", + "internalType": "struct ISignatureTransfer.PermitBatchTransferFrom", + "components": [ + { + "name": "permitted", + "type": "tuple[]", + "internalType": "struct ISignatureTransfer.TokenPermissions[]", + "components": [ + { + "name": "token", + "type": "address", + "internalType": "address" + }, + { + "name": "amount", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { "name": "nonce", "type": "uint256", "internalType": "uint256" }, + { + "name": "deadline", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { "name": "owner", "type": "address", "internalType": "address" }, + { "name": "signature", "type": "bytes", "internalType": "bytes" } + ] + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "outputWitness", + "inputs": [ + { + "name": "outputs", + "type": "tuple[]", + "internalType": "struct IOrders.Output[]", + "components": [ + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "recipient", "type": "address", "internalType": "address" }, + { "name": "chainId", "type": "uint32", "internalType": "uint32" } + ] + } + ], + "outputs": [ + { + "name": "_witness", + "type": "tuple", + "internalType": "struct UsesPermit2.Witness", + "components": [ + { + "name": "witnessHash", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "witnessTypeString", + "type": "string", + "internalType": "string" + } + ] + } + ], + "stateMutability": "pure" + }, + { + "type": "event", + "name": "Filled", + "inputs": [ + { + "name": "outputs", + "type": "tuple[]", + "indexed": false, + "internalType": "struct IOrders.Output[]", + "components": [ + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "recipient", "type": "address", "internalType": "address" }, + { "name": "chainId", "type": "uint32", "internalType": "uint32" } + ] + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AddressEmptyCode", + "inputs": [ + { "name": "target", "type": "address", "internalType": "address" } + ] + }, + { "type": "error", "name": "FailedCall", "inputs": [] }, + { + "type": "error", + "name": "InsufficientBalance", + "inputs": [ + { "name": "balance", "type": "uint256", "internalType": "uint256" }, + { "name": "needed", "type": "uint256", "internalType": "uint256" } + ] + }, + { "type": "error", "name": "LengthMismatch", "inputs": [] }, + { "type": "error", "name": "OutputMismatch", "inputs": [] }, + { "type": "error", "name": "ReentrancyGuardReentrantCall", "inputs": [] }, + { + "type": "error", + "name": "SafeERC20FailedOperation", + "inputs": [ + { "name": "token", "type": "address", "internalType": "address" } + ] + } +] diff --git a/crates/types/abi/Passage.json b/crates/types/abi/Passage.json index a08452b..10c44ed 100644 --- a/crates/types/abi/Passage.json +++ b/crates/types/abi/Passage.json @@ -7,65 +7,31 @@ "type": "uint256", "internalType": "uint256" }, - { - "name": "_tokenAdmin", - "type": "address", - "internalType": "address" - }, + { "name": "_tokenAdmin", "type": "address", "internalType": "address" }, { "name": "initialEnterTokens", "type": "address[]", "internalType": "address[]" }, - { - "name": "_permit2", - "type": "address", - "internalType": "address" - } + { "name": "_permit2", "type": "address", "internalType": "address" } ], "stateMutability": "nonpayable" }, - { - "type": "fallback", - "stateMutability": "payable" - }, - { - "type": "receive", - "stateMutability": "payable" - }, + { "type": "fallback", "stateMutability": "payable" }, + { "type": "receive", "stateMutability": "payable" }, { "type": "function", "name": "canEnter", - "inputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "bool", - "internalType": "bool" - } - ], + "inputs": [{ "name": "", "type": "address", "internalType": "address" }], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "configureEnter", "inputs": [ - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "_canEnter", - "type": "bool", - "internalType": "bool" - } + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "_canEnter", "type": "bool", "internalType": "bool" } ], "outputs": [], "stateMutability": "nonpayable" @@ -74,13 +40,7 @@ "type": "function", "name": "defaultRollupChainId", "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { @@ -100,11 +60,7 @@ "type": "function", "name": "enter", "inputs": [ - { - "name": "rollupChainId", - "type": "uint256", - "internalType": "uint256" - }, + { "name": "rollupChainId", "type": "uint256", "internalType": "uint256" }, { "name": "rollupRecipient", "type": "address", @@ -118,26 +74,14 @@ "type": "function", "name": "enterToken", "inputs": [ - { - "name": "rollupChainId", - "type": "uint256", - "internalType": "uint256" - }, + { "name": "rollupChainId", "type": "uint256", "internalType": "uint256" }, { "name": "rollupRecipient", "type": "address", "internalType": "address" }, - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - } + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } ], "outputs": [], "stateMutability": "nonpayable" @@ -151,16 +95,8 @@ "type": "address", "internalType": "address" }, - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - } + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } ], "outputs": [], "stateMutability": "nonpayable" @@ -169,11 +105,7 @@ "type": "function", "name": "enterTokenPermit2", "inputs": [ - { - "name": "rollupChainId", - "type": "uint256", - "internalType": "uint256" - }, + { "name": "rollupChainId", "type": "uint256", "internalType": "uint256" }, { "name": "rollupRecipient", "type": "address", @@ -206,11 +138,7 @@ } ] }, - { - "name": "nonce", - "type": "uint256", - "internalType": "uint256" - }, + { "name": "nonce", "type": "uint256", "internalType": "uint256" }, { "name": "deadline", "type": "uint256", @@ -218,16 +146,8 @@ } ] }, - { - "name": "owner", - "type": "address", - "internalType": "address" - }, - { - "name": "signature", - "type": "bytes", - "internalType": "bytes" - } + { "name": "owner", "type": "address", "internalType": "address" }, + { "name": "signature", "type": "bytes", "internalType": "bytes" } ] } ], @@ -238,11 +158,7 @@ "type": "function", "name": "enterWitness", "inputs": [ - { - "name": "rollupChainId", - "type": "uint256", - "internalType": "uint256" - }, + { "name": "rollupChainId", "type": "uint256", "internalType": "uint256" }, { "name": "rollupRecipient", "type": "address", @@ -274,11 +190,7 @@ "type": "function", "name": "exitWitness", "inputs": [ - { - "name": "hostRecipient", - "type": "address", - "internalType": "address" - } + { "name": "hostRecipient", "type": "address", "internalType": "address" } ], "outputs": [ { @@ -305,34 +217,16 @@ "type": "function", "name": "tokenAdmin", "inputs": [], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "withdraw", "inputs": [ - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "recipient", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - } + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "recipient", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } ], "outputs": [], "stateMutability": "nonpayable" @@ -437,20 +331,36 @@ ], "anonymous": false }, + { + "type": "error", + "name": "AddressEmptyCode", + "inputs": [ + { "name": "target", "type": "address", "internalType": "address" } + ] + }, { "type": "error", "name": "DisallowedEnter", "inputs": [ - { - "name": "token", - "type": "address", - "internalType": "address" - } + { "name": "token", "type": "address", "internalType": "address" } + ] + }, + { "type": "error", "name": "FailedCall", "inputs": [] }, + { + "type": "error", + "name": "InsufficientBalance", + "inputs": [ + { "name": "balance", "type": "uint256", "internalType": "uint256" }, + { "name": "needed", "type": "uint256", "internalType": "uint256" } ] }, + { "type": "error", "name": "OnlyTokenAdmin", "inputs": [] }, + { "type": "error", "name": "ReentrancyGuardReentrantCall", "inputs": [] }, { "type": "error", - "name": "OnlyTokenAdmin", - "inputs": [] + "name": "SafeERC20FailedOperation", + "inputs": [ + { "name": "token", "type": "address", "internalType": "address" } + ] } ] diff --git a/crates/types/abi/RollupOrders.json b/crates/types/abi/RollupOrders.json index d38aab7..67acc43 100644 --- a/crates/types/abi/RollupOrders.json +++ b/crates/types/abi/RollupOrders.json @@ -2,11 +2,7 @@ { "type": "constructor", "inputs": [ - { - "name": "_permit2", - "type": "address", - "internalType": "address" - } + { "name": "_permit2", "type": "address", "internalType": "address" } ], "stateMutability": "nonpayable" }, @@ -19,26 +15,10 @@ "type": "tuple[]", "internalType": "struct IOrders.Output[]", "components": [ - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "recipient", - "type": "address", - "internalType": "address" - }, - { - "name": "chainId", - "type": "uint32", - "internalType": "uint32" - } + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "recipient", "type": "address", "internalType": "address" }, + { "name": "chainId", "type": "uint32", "internalType": "uint32" } ] } ], @@ -54,26 +34,10 @@ "type": "tuple[]", "internalType": "struct IOrders.Output[]", "components": [ - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "recipient", - "type": "address", - "internalType": "address" - }, - { - "name": "chainId", - "type": "uint32", - "internalType": "uint32" - } + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "recipient", "type": "address", "internalType": "address" }, + { "name": "chainId", "type": "uint32", "internalType": "uint32" } ] }, { @@ -103,11 +67,7 @@ } ] }, - { - "name": "nonce", - "type": "uint256", - "internalType": "uint256" - }, + { "name": "nonce", "type": "uint256", "internalType": "uint256" }, { "name": "deadline", "type": "uint256", @@ -115,16 +75,8 @@ } ] }, - { - "name": "owner", - "type": "address", - "internalType": "address" - }, - { - "name": "signature", - "type": "bytes", - "internalType": "bytes" - } + { "name": "owner", "type": "address", "internalType": "address" }, + { "name": "signature", "type": "bytes", "internalType": "bytes" } ] } ], @@ -135,26 +87,14 @@ "type": "function", "name": "initiate", "inputs": [ - { - "name": "deadline", - "type": "uint256", - "internalType": "uint256" - }, + { "name": "deadline", "type": "uint256", "internalType": "uint256" }, { "name": "inputs", "type": "tuple[]", "internalType": "struct IOrders.Input[]", "components": [ - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - } + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } ] }, { @@ -162,26 +102,10 @@ "type": "tuple[]", "internalType": "struct IOrders.Output[]", "components": [ - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "recipient", - "type": "address", - "internalType": "address" - }, - { - "name": "chainId", - "type": "uint32", - "internalType": "uint32" - } + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "recipient", "type": "address", "internalType": "address" }, + { "name": "chainId", "type": "uint32", "internalType": "uint32" } ] } ], @@ -202,26 +126,10 @@ "type": "tuple[]", "internalType": "struct IOrders.Output[]", "components": [ - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "recipient", - "type": "address", - "internalType": "address" - }, - { - "name": "chainId", - "type": "uint32", - "internalType": "uint32" - } + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "recipient", "type": "address", "internalType": "address" }, + { "name": "chainId", "type": "uint32", "internalType": "uint32" } ] }, { @@ -251,11 +159,7 @@ } ] }, - { - "name": "nonce", - "type": "uint256", - "internalType": "uint256" - }, + { "name": "nonce", "type": "uint256", "internalType": "uint256" }, { "name": "deadline", "type": "uint256", @@ -263,16 +167,8 @@ } ] }, - { - "name": "owner", - "type": "address", - "internalType": "address" - }, - { - "name": "signature", - "type": "bytes", - "internalType": "bytes" - } + { "name": "owner", "type": "address", "internalType": "address" }, + { "name": "signature", "type": "bytes", "internalType": "bytes" } ] } ], @@ -288,26 +184,10 @@ "type": "tuple[]", "internalType": "struct IOrders.Output[]", "components": [ - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "recipient", - "type": "address", - "internalType": "address" - }, - { - "name": "chainId", - "type": "uint32", - "internalType": "uint32" - } + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "recipient", "type": "address", "internalType": "address" }, + { "name": "chainId", "type": "uint32", "internalType": "uint32" } ] } ], @@ -336,16 +216,9 @@ "type": "function", "name": "sweep", "inputs": [ - { - "name": "recipient", - "type": "address", - "internalType": "address" - }, - { - "name": "token", - "type": "address", - "internalType": "address" - } + { "name": "recipient", "type": "address", "internalType": "address" }, + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } ], "outputs": [], "stateMutability": "nonpayable" @@ -360,26 +233,10 @@ "indexed": false, "internalType": "struct IOrders.Output[]", "components": [ - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "recipient", - "type": "address", - "internalType": "address" - }, - { - "name": "chainId", - "type": "uint32", - "internalType": "uint32" - } + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "recipient", "type": "address", "internalType": "address" }, + { "name": "chainId", "type": "uint32", "internalType": "uint32" } ] } ], @@ -401,16 +258,8 @@ "indexed": false, "internalType": "struct IOrders.Input[]", "components": [ - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - } + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } ] }, { @@ -419,26 +268,10 @@ "indexed": false, "internalType": "struct IOrders.Output[]", "components": [ - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "recipient", - "type": "address", - "internalType": "address" - }, - { - "name": "chainId", - "type": "uint32", - "internalType": "uint32" - } + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" }, + { "name": "recipient", "type": "address", "internalType": "address" }, + { "name": "chainId", "type": "uint32", "internalType": "uint32" } ] } ], @@ -471,17 +304,29 @@ }, { "type": "error", - "name": "LengthMismatch", - "inputs": [] + "name": "AddressEmptyCode", + "inputs": [ + { "name": "target", "type": "address", "internalType": "address" } + ] }, + { "type": "error", "name": "FailedCall", "inputs": [] }, { "type": "error", - "name": "OrderExpired", - "inputs": [] + "name": "InsufficientBalance", + "inputs": [ + { "name": "balance", "type": "uint256", "internalType": "uint256" }, + { "name": "needed", "type": "uint256", "internalType": "uint256" } + ] }, + { "type": "error", "name": "LengthMismatch", "inputs": [] }, + { "type": "error", "name": "OrderExpired", "inputs": [] }, + { "type": "error", "name": "OutputMismatch", "inputs": [] }, + { "type": "error", "name": "ReentrancyGuardReentrantCall", "inputs": [] }, { "type": "error", - "name": "OutputMismatch", - "inputs": [] + "name": "SafeERC20FailedOperation", + "inputs": [ + { "name": "token", "type": "address", "internalType": "address" } + ] } ] diff --git a/crates/types/abi/RollupPassage.json b/crates/types/abi/RollupPassage.json index 9c446a8..75db5b7 100644 --- a/crates/types/abi/RollupPassage.json +++ b/crates/types/abi/RollupPassage.json @@ -2,31 +2,17 @@ { "type": "constructor", "inputs": [ - { - "name": "_permit2", - "type": "address", - "internalType": "address" - } + { "name": "_permit2", "type": "address", "internalType": "address" } ], "stateMutability": "nonpayable" }, - { - "type": "fallback", - "stateMutability": "payable" - }, - { - "type": "receive", - "stateMutability": "payable" - }, + { "type": "fallback", "stateMutability": "payable" }, + { "type": "receive", "stateMutability": "payable" }, { "type": "function", "name": "enterWitness", "inputs": [ - { - "name": "rollupChainId", - "type": "uint256", - "internalType": "uint256" - }, + { "name": "rollupChainId", "type": "uint256", "internalType": "uint256" }, { "name": "rollupRecipient", "type": "address", @@ -58,11 +44,7 @@ "type": "function", "name": "exit", "inputs": [ - { - "name": "hostRecipient", - "type": "address", - "internalType": "address" - } + { "name": "hostRecipient", "type": "address", "internalType": "address" } ], "outputs": [], "stateMutability": "payable" @@ -71,21 +53,9 @@ "type": "function", "name": "exitToken", "inputs": [ - { - "name": "hostRecipient", - "type": "address", - "internalType": "address" - }, - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - } + { "name": "hostRecipient", "type": "address", "internalType": "address" }, + { "name": "token", "type": "address", "internalType": "address" }, + { "name": "amount", "type": "uint256", "internalType": "uint256" } ], "outputs": [], "stateMutability": "nonpayable" @@ -94,11 +64,7 @@ "type": "function", "name": "exitTokenPermit2", "inputs": [ - { - "name": "hostRecipient", - "type": "address", - "internalType": "address" - }, + { "name": "hostRecipient", "type": "address", "internalType": "address" }, { "name": "permit2", "type": "tuple", @@ -126,11 +92,7 @@ } ] }, - { - "name": "nonce", - "type": "uint256", - "internalType": "uint256" - }, + { "name": "nonce", "type": "uint256", "internalType": "uint256" }, { "name": "deadline", "type": "uint256", @@ -138,16 +100,8 @@ } ] }, - { - "name": "owner", - "type": "address", - "internalType": "address" - }, - { - "name": "signature", - "type": "bytes", - "internalType": "bytes" - } + { "name": "owner", "type": "address", "internalType": "address" }, + { "name": "signature", "type": "bytes", "internalType": "bytes" } ] } ], @@ -158,11 +112,7 @@ "type": "function", "name": "exitWitness", "inputs": [ - { - "name": "hostRecipient", - "type": "address", - "internalType": "address" - } + { "name": "hostRecipient", "type": "address", "internalType": "address" } ], "outputs": [ { @@ -228,5 +178,29 @@ } ], "anonymous": false + }, + { + "type": "error", + "name": "AddressEmptyCode", + "inputs": [ + { "name": "target", "type": "address", "internalType": "address" } + ] + }, + { "type": "error", "name": "FailedCall", "inputs": [] }, + { + "type": "error", + "name": "InsufficientBalance", + "inputs": [ + { "name": "balance", "type": "uint256", "internalType": "uint256" }, + { "name": "needed", "type": "uint256", "internalType": "uint256" } + ] + }, + { "type": "error", "name": "ReentrancyGuardReentrantCall", "inputs": [] }, + { + "type": "error", + "name": "SafeERC20FailedOperation", + "inputs": [ + { "name": "token", "type": "address", "internalType": "address" } + ] } ] diff --git a/crates/types/abi/Transactor.json b/crates/types/abi/Transactor.json index f89d3d8..5234e31 100644 --- a/crates/types/abi/Transactor.json +++ b/crates/types/abi/Transactor.json @@ -7,11 +7,7 @@ "type": "uint256", "internalType": "uint256" }, - { - "name": "_gasAdmin", - "type": "address", - "internalType": "address" - }, + { "name": "_gasAdmin", "type": "address", "internalType": "address" }, { "name": "_passage", "type": "address", @@ -34,16 +30,8 @@ "type": "function", "name": "configureGas", "inputs": [ - { - "name": "perBlock", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "perTransact", - "type": "uint256", - "internalType": "uint256" - } + { "name": "perBlock", "type": "uint256", "internalType": "uint256" }, + { "name": "perTransact", "type": "uint256", "internalType": "uint256" } ], "outputs": [], "stateMutability": "nonpayable" @@ -52,54 +40,24 @@ "type": "function", "name": "defaultRollupChainId", "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "enterTransact", "inputs": [ - { - "name": "rollupChainId", - "type": "uint256", - "internalType": "uint256" - }, + { "name": "rollupChainId", "type": "uint256", "internalType": "uint256" }, { "name": "etherRecipient", "type": "address", "internalType": "address" }, - { - "name": "to", - "type": "address", - "internalType": "address" - }, - { - "name": "data", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "value", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "gas", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "maxFeePerGas", - "type": "uint256", - "internalType": "uint256" - } + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "data", "type": "bytes", "internalType": "bytes" }, + { "name": "value", "type": "uint256", "internalType": "uint256" }, + { "name": "gas", "type": "uint256", "internalType": "uint256" }, + { "name": "maxFeePerGas", "type": "uint256", "internalType": "uint256" } ], "outputs": [], "stateMutability": "payable" @@ -108,13 +66,7 @@ "type": "function", "name": "gasAdmin", "inputs": [], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { @@ -122,11 +74,7 @@ "name": "passage", "inputs": [], "outputs": [ - { - "name": "", - "type": "address", - "internalType": "contract Passage" - } + { "name": "", "type": "address", "internalType": "contract Passage" } ], "stateMutability": "view" }, @@ -134,57 +82,25 @@ "type": "function", "name": "perBlockGasLimit", "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "perTransactGasLimit", "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "transact", "inputs": [ - { - "name": "to", - "type": "address", - "internalType": "address" - }, - { - "name": "data", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "value", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "gas", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "maxFeePerGas", - "type": "uint256", - "internalType": "uint256" - } + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "data", "type": "bytes", "internalType": "bytes" }, + { "name": "value", "type": "uint256", "internalType": "uint256" }, + { "name": "gas", "type": "uint256", "internalType": "uint256" }, + { "name": "maxFeePerGas", "type": "uint256", "internalType": "uint256" } ], "outputs": [], "stateMutability": "payable" @@ -193,36 +109,12 @@ "type": "function", "name": "transact", "inputs": [ - { - "name": "rollupChainId", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "to", - "type": "address", - "internalType": "address" - }, - { - "name": "data", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "value", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "gas", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "maxFeePerGas", - "type": "uint256", - "internalType": "uint256" - } + { "name": "rollupChainId", "type": "uint256", "internalType": "uint256" }, + { "name": "to", "type": "address", "internalType": "address" }, + { "name": "data", "type": "bytes", "internalType": "bytes" }, + { "name": "value", "type": "uint256", "internalType": "uint256" }, + { "name": "gas", "type": "uint256", "internalType": "uint256" }, + { "name": "maxFeePerGas", "type": "uint256", "internalType": "uint256" } ], "outputs": [], "stateMutability": "payable" @@ -231,24 +123,10 @@ "type": "function", "name": "transactGasUsed", "inputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } + { "name": "", "type": "uint256", "internalType": "uint256" }, + { "name": "", "type": "uint256", "internalType": "uint256" } ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { @@ -319,19 +197,7 @@ ], "anonymous": false }, - { - "type": "error", - "name": "OnlyGasAdmin", - "inputs": [] - }, - { - "type": "error", - "name": "PerBlockTransactGasLimit", - "inputs": [] - }, - { - "type": "error", - "name": "PerTransactGasLimit", - "inputs": [] - } + { "type": "error", "name": "OnlyGasAdmin", "inputs": [] }, + { "type": "error", "name": "PerBlockTransactGasLimit", "inputs": [] }, + { "type": "error", "name": "PerTransactGasLimit", "inputs": [] } ] diff --git a/crates/types/abi/Zenith.json b/crates/types/abi/Zenith.json index 167843a..818c7a4 100644 --- a/crates/types/abi/Zenith.json +++ b/crates/types/abi/Zenith.json @@ -14,11 +14,7 @@ "type": "function", "name": "addSequencer", "inputs": [ - { - "name": "sequencer", - "type": "address", - "internalType": "address" - } + { "name": "sequencer", "type": "address", "internalType": "address" } ], "outputs": [], "stateMutability": "nonpayable" @@ -42,11 +38,7 @@ "type": "uint256", "internalType": "uint256" }, - { - "name": "gasLimit", - "type": "uint256", - "internalType": "uint256" - }, + { "name": "gasLimit", "type": "uint256", "internalType": "uint256" }, { "name": "rewardAddress", "type": "address", @@ -61,11 +53,7 @@ } ], "outputs": [ - { - "name": "commit", - "type": "bytes32", - "internalType": "bytes32" - } + { "name": "commit", "type": "bytes32", "internalType": "bytes32" } ], "stateMutability": "view" }, @@ -73,62 +61,28 @@ "type": "function", "name": "deployBlockNumber", "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "isSequencer", - "inputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "bool", - "internalType": "bool" - } - ], + "inputs": [{ "name": "", "type": "address", "internalType": "address" }], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "lastSubmittedAtBlock", - "inputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], + "inputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "removeSequencer", "inputs": [ - { - "name": "sequencer", - "type": "address", - "internalType": "address" - } + { "name": "sequencer", "type": "address", "internalType": "address" } ], "outputs": [], "stateMutability": "nonpayable" @@ -137,13 +91,7 @@ "type": "function", "name": "sequencerAdmin", "inputs": [], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { @@ -165,11 +113,7 @@ "type": "uint256", "internalType": "uint256" }, - { - "name": "gasLimit", - "type": "uint256", - "internalType": "uint256" - }, + { "name": "gasLimit", "type": "uint256", "internalType": "uint256" }, { "name": "rewardAddress", "type": "address", @@ -182,26 +126,10 @@ } ] }, - { - "name": "v", - "type": "uint8", - "internalType": "uint8" - }, - { - "name": "r", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "s", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "", - "type": "bytes", - "internalType": "bytes" - } + { "name": "v", "type": "uint8", "internalType": "uint8" }, + { "name": "r", "type": "bytes32", "internalType": "bytes32" }, + { "name": "s", "type": "bytes32", "internalType": "bytes32" }, + { "name": "", "type": "bytes", "internalType": "bytes" } ], "outputs": [], "stateMutability": "nonpayable" @@ -273,19 +201,7 @@ } ] }, - { - "type": "error", - "name": "IncorrectHostBlock", - "inputs": [] - }, - { - "type": "error", - "name": "OneRollupBlockPerHostBlock", - "inputs": [] - }, - { - "type": "error", - "name": "OnlySequencerAdmin", - "inputs": [] - } + { "type": "error", "name": "IncorrectHostBlock", "inputs": [] }, + { "type": "error", "name": "OneRollupBlockPerHostBlock", "inputs": [] }, + { "type": "error", "name": "OnlySequencerAdmin", "inputs": [] } ] diff --git a/crates/types/src/bindings.rs b/crates/types/src/bindings.rs index 4e6246e..1e747de 100644 --- a/crates/types/src/bindings.rs +++ b/crates/types/src/bindings.rs @@ -2,6 +2,7 @@ #![allow(missing_docs)] use alloy_primitives::{Address, Bytes, FixedBytes, U256}; use alloy_sol_types::sol; +use HostOrders::TokenPermissions; sol!( #[sol(rpc)] @@ -17,6 +18,13 @@ sol!( "abi/Passage.json" ); +sol!( + #[sol(rpc)] + #[derive(Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)] + HostOrders, + "abi/HostOrders.json" +); + sol!( #[sol(rpc)] #[derive(Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)] @@ -128,6 +136,11 @@ impl Copy for Passage::Withdrawal {} impl Copy for Passage::OnlyTokenAdmin {} impl Copy for Passage::Enter {} impl Copy for Passage::EnterToken {} +impl Copy for Passage::DisallowedEnter {} +impl Copy for Passage::FailedCall {} +impl Copy for Passage::InsufficientBalance {} +impl Copy for Passage::SafeERC20FailedOperation {} +impl Copy for Passage::AddressEmptyCode {} impl Copy for Passage::PassageEvents {} @@ -195,11 +208,138 @@ impl Passage::Withdrawal { } } +impl Passage::EnterConfigured { + /// Get the token address of the event. + pub const fn token(&self) -> Address { + self.token + } + + /// Get if the token has been configured to allow or disallow enters. + pub const fn can_enter(&self) -> bool { + self.canEnter + } +} + +// HostOrders types + +impl Copy for HostOrders::Output {} +impl Copy for HostOrders::TokenPermissions {} +impl Copy for HostOrders::AddressEmptyCode {} +impl Copy for HostOrders::FailedCall {} +impl Copy for HostOrders::InsufficientBalance {} +impl Copy for HostOrders::ReentrancyGuardReentrantCall {} +impl Copy for HostOrders::LengthMismatch {} +impl Copy for HostOrders::OutputMismatch {} +impl Copy for HostOrders::SafeERC20FailedOperation {} + +impl Clone for HostOrders::HostOrdersEvents { + fn clone(&self) -> Self { + match self { + HostOrders::HostOrdersEvents::Filled(event) => { + HostOrders::HostOrdersEvents::Filled(event.clone()) + } + } + } +} + +impl HostOrders::Output { + /// Get the token address of the output. + pub const fn token(&self) -> Address { + self.token + } + + /// Get the recipient of the output. + pub const fn recipient(&self) -> Address { + self.recipient + } + + /// Get the amount of the output. + pub const fn amount(&self) -> U256 { + self.amount + } + + /// Get the chain ID of the output. + pub const fn chain_id(&self) -> u32 { + self.chainId + } +} + +impl HostOrders::TokenPermissions { + /// Get the token address of the output. + pub const fn token(&self) -> Address { + self.token + } + + /// Get the amount of the output. + pub const fn amount(&self) -> U256 { + self.amount + } +} + +impl HostOrders::Witness { + /// Get the witness hash of the witness. + pub const fn witness_hash(&self) -> FixedBytes<32> { + self.witnessHash + } + + /// Get the witness type string. + pub fn witness_type(&self) -> String { + self.witnessTypeString.clone() + } +} + +impl HostOrders::Filled { + /// Get the outputs of the filled order. + pub fn outputs(&self) -> &[HostOrders::Output] { + &self.outputs + } +} + +impl HostOrders::PermitBatchTransferFrom { + /// Get the permitted tokens of the batch transfer permit. + pub fn permitted(&self) -> &[TokenPermissions] { + &self.permitted + } + + /// Get the nonce of the batch transfer permit. + pub const fn nonce(&self) -> U256 { + self.nonce + } + + /// Get the deadline of the batch transfer permit. + pub const fn deadline(&self) -> U256 { + self.deadline + } +} + +impl HostOrders::Permit2Batch { + /// Get the permitted tokens of the batch transfer permit. + pub const fn permit(&self) -> &HostOrders::PermitBatchTransferFrom { + &self.permit + } + + /// Get the owner of the permit. + pub const fn owner(&self) -> Address { + self.owner + } + + /// Get the signature of the permit. + pub fn signature(&self) -> Bytes { + self.signature.clone() + } +} + // RollupOrders types impl Copy for RollupOrders::Input {} impl Copy for RollupOrders::Output {} impl Copy for RollupOrders::Sweep {} +impl Copy for RollupOrders::InsufficientBalance {} +impl Copy for RollupOrders::AddressEmptyCode {} +impl Copy for RollupOrders::LengthMismatch {} +impl Copy for RollupOrders::OrderExpired {} +impl Copy for RollupOrders::OutputMismatch {} +impl Copy for RollupOrders::SafeERC20FailedOperation {} impl Clone for RollupOrders::RollupOrdersEvents { fn clone(&self) -> Self { @@ -331,6 +471,9 @@ impl Transactor::Transact { // RollupPassage impl Copy for RollupPassage::Exit {} impl Copy for RollupPassage::ExitToken {} +impl Copy for RollupPassage::AddressEmptyCode {} +impl Copy for RollupPassage::InsufficientBalance {} +impl Copy for RollupPassage::SafeERC20FailedOperation {} impl Copy for RollupPassage::RollupPassageEvents {}