├── src ├── constants.rs ├── lib.rs ├── schema_registry.rs └── eas.rs ├── eas-contracts ├── README.md ├── Cargo.toml └── src │ ├── lib.rs │ ├── common.rs │ ├── eip712.rs │ ├── context.rs │ ├── math.rs │ ├── ecdsa.rs │ ├── address.rs │ ├── strings.rs │ ├── safe_erc20.rs │ ├── shared_types.rs │ ├── semver.rs │ ├── ownable.rs │ ├── i_schema_registry.rs │ ├── ierc20_permit.rs │ ├── eip712_verifier.rs │ └── i_schema_resolver.rs ├── .gitignore ├── Cargo.toml ├── LICENSE └── README.md /src/constants.rs: -------------------------------------------------------------------------------- 1 | pub const EAS_SEPOLIA: &'static str = "0xC2679fBD37d54388Ce493F1DB75320D236e1815e"; 2 | -------------------------------------------------------------------------------- /eas-contracts/README.md: -------------------------------------------------------------------------------- 1 | # Auto Generated Bindings 2 | 3 | These files have been generated using foundry tools in the [EAS contracts](https://github.com/ethereum-attestation-service/eas-contracts) repository. 4 | -------------------------------------------------------------------------------- /eas-contracts/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "eas-contracts" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | ethers = { version = "2", default-features = false, features = ["abigen"] } 10 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | //! # Ethereum Attestation Service Rust Library 2 | //! 3 | //! This library aims to provide a convenient interface for interacting with the 4 | //! Ethereum Attestation Service. 5 | 6 | // Re-exporting the eas_contracts crate for public use. 7 | pub use eas_contracts; 8 | 9 | pub mod constants; 10 | pub mod eas; 11 | pub mod schema_registry; 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | debug/ 4 | target/ 5 | 6 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 7 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 8 | Cargo.lock 9 | 10 | # These are backup files generated by rustfmt 11 | **/*.rs.bk 12 | 13 | # MSVC Windows builds of rustc generate these, which store debugging information 14 | *.pdb 15 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "eas" 3 | version = "0.1.0" 4 | edition = "2021" 5 | description = "Library for interacting with the Ethereum Attestation Service" 6 | repository = "https://github.com/brech1/eas-rs" 7 | license = "MIT" 8 | 9 | [dependencies] 10 | alloy-sol-types = "0.2.0" 11 | ethers = { version = "2.0.8" } 12 | log = { version = "0.4.19" } 13 | tokio = { version = "1.29.1", features = ["time", "macros", "rt-multi-thread", "net"] } 14 | 15 | eas-contracts = { path = "./eas-contracts" } 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Brechy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /eas-contracts/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![allow(clippy::all)] 2 | //! This lib contains abigen! generated bindings for solidity contracts. 3 | //! This is autogenerated code. 4 | //! Do not manually edit these files. 5 | //! These files may be overwritten by the codegen system at any time. 6 | pub mod address; 7 | pub mod attestation_resolver; 8 | pub mod attester_resolver; 9 | pub mod common; 10 | pub mod context; 11 | pub mod data_resolver; 12 | pub mod eas; 13 | pub mod ecdsa; 14 | pub mod eip712; 15 | pub mod eip712_proxy; 16 | pub mod eip712_verifier; 17 | pub mod erc20; 18 | pub mod expiration_time_resolver; 19 | pub mod i_schema_registry; 20 | pub mod i_schema_resolver; 21 | pub mod ieas; 22 | pub mod ierc20; 23 | pub mod ierc20_metadata; 24 | pub mod ierc20_permit; 25 | pub mod math; 26 | pub mod ownable; 27 | pub mod paying_resolver; 28 | pub mod permissioned_eip712_proxy; 29 | pub mod recipient_resolver; 30 | pub mod revocation_resolver; 31 | pub mod safe_erc20; 32 | pub mod schema_registry; 33 | pub mod schema_resolver; 34 | pub mod semver; 35 | pub mod shared_types; 36 | pub mod strings; 37 | pub mod token_resolver; 38 | pub mod value_resolver; 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EAS-RS 2 | 3 | Rust utilities for the ethereum attestation service. 4 | 5 | # Repository Structure 6 | 7 | - `eas-contracts`: Foundry generated bindings for the current version of the EAS contracts. 8 | - `src`: EAS-RS library. 9 | 10 | # How To Use 11 | 12 | Add this to your crate dependencies: 13 | 14 | ``` 15 | eas-rs = { git = "https://github.com/brech1/eas-rs" } 16 | ``` 17 | 18 | Then you can import: 19 | 20 | ```rust 21 | use eas::{ 22 | eas::*, 23 | eas_contracts::{ 24 | eas::AttestedFilter, 25 | value_resolver::{Attestation, AttestationRequest, AttestationRequestData}, 26 | }, 27 | schema_registry::SchemaRegistryContract, 28 | }; 29 | ``` 30 | 31 | You should then instantiate a local signer with a wallet: 32 | 33 | ```rust 34 | let wallet = MnemonicBuilder::::default() 35 | .phrase(mnemonic) 36 | .build(); 37 | 38 | let signer = SignerMiddleware::new(provider, wallet.with_chain_id(CHAIN_ID)); 39 | ``` 40 | 41 | You can then attest: 42 | 43 | ```rust 44 | let eas = Eas::new( 45 | signer.clone(), 46 | Some(Address::from_str(EAS_CONTRACT_ADDRESS).unwrap()), 47 | ); 48 | 49 | let att_data: Bytes = Bytes::from(data_bytes); 50 | 51 | let att_object = AttestationRequestData { 52 | recipient: Address::zero(), 53 | expiration_time: 0, 54 | revocable: false, 55 | ref_uid: [0u8; 32], 56 | data: att_data, 57 | value: U256::zero(), 58 | }; 59 | 60 | let att = AttestationRequest { 61 | schema: SCHEMA_ID, 62 | data: att_object, 63 | }; 64 | 65 | eas.attest(att).await.unwrap(); 66 | ``` 67 | 68 | Keep in mind the above snippets are just illustrative, for a full implementation you should check out [this example project](https://github.com/brech1/zk-attestation) which includes: 69 | 70 | - Deploying on a local testnet. 71 | - Submitting schema. 72 | - Attesting. 73 | - Fetching attestations with filter. 74 | 75 | ## Contributing 76 | 77 | Contributions are welcome! 78 | 79 | ## License 80 | 81 | This project is licensed under the MIT License - see the LICENSE file for details. 82 | -------------------------------------------------------------------------------- /eas-contracts/src/common.rs: -------------------------------------------------------------------------------- 1 | pub use common::*; 2 | /// This module was auto-generated with ethers-rs Abigen. 3 | /// More information at: 4 | #[allow( 5 | clippy::enum_variant_names, 6 | clippy::too_many_arguments, 7 | clippy::upper_case_acronyms, 8 | clippy::type_complexity, 9 | dead_code, 10 | non_camel_case_types, 11 | )] 12 | pub mod common { 13 | #[allow(deprecated)] 14 | fn __abi() -> ::ethers::core::abi::Abi { 15 | ::ethers::core::abi::ethabi::Contract { 16 | constructor: ::core::option::Option::None, 17 | functions: ::std::collections::BTreeMap::new(), 18 | events: ::std::collections::BTreeMap::new(), 19 | errors: ::std::collections::BTreeMap::new(), 20 | receive: false, 21 | fallback: false, 22 | } 23 | } 24 | ///The parsed JSON ABI of the contract. 25 | pub static COMMON_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( 26 | __abi, 27 | ); 28 | pub struct Common(::ethers::contract::Contract); 29 | impl ::core::clone::Clone for Common { 30 | fn clone(&self) -> Self { 31 | Self(::core::clone::Clone::clone(&self.0)) 32 | } 33 | } 34 | impl ::core::ops::Deref for Common { 35 | type Target = ::ethers::contract::Contract; 36 | fn deref(&self) -> &Self::Target { 37 | &self.0 38 | } 39 | } 40 | impl ::core::ops::DerefMut for Common { 41 | fn deref_mut(&mut self) -> &mut Self::Target { 42 | &mut self.0 43 | } 44 | } 45 | impl ::core::fmt::Debug for Common { 46 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 47 | f.debug_tuple(::core::stringify!(Common)).field(&self.address()).finish() 48 | } 49 | } 50 | impl Common { 51 | /// Creates a new contract instance with the specified `ethers` client at 52 | /// `address`. The contract derefs to a `ethers::Contract` object. 53 | pub fn new>( 54 | address: T, 55 | client: ::std::sync::Arc, 56 | ) -> Self { 57 | Self( 58 | ::ethers::contract::Contract::new( 59 | address.into(), 60 | COMMON_ABI.clone(), 61 | client, 62 | ), 63 | ) 64 | } 65 | } 66 | impl From<::ethers::contract::Contract> 67 | for Common { 68 | fn from(contract: ::ethers::contract::Contract) -> Self { 69 | Self::new(contract.address(), contract.client()) 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /eas-contracts/src/eip712.rs: -------------------------------------------------------------------------------- 1 | pub use eip712::*; 2 | /// This module was auto-generated with ethers-rs Abigen. 3 | /// More information at: 4 | #[allow( 5 | clippy::enum_variant_names, 6 | clippy::too_many_arguments, 7 | clippy::upper_case_acronyms, 8 | clippy::type_complexity, 9 | dead_code, 10 | non_camel_case_types, 11 | )] 12 | pub mod eip712 { 13 | #[allow(deprecated)] 14 | fn __abi() -> ::ethers::core::abi::Abi { 15 | ::ethers::core::abi::ethabi::Contract { 16 | constructor: ::core::option::Option::None, 17 | functions: ::std::collections::BTreeMap::new(), 18 | events: ::std::collections::BTreeMap::new(), 19 | errors: ::std::collections::BTreeMap::new(), 20 | receive: false, 21 | fallback: false, 22 | } 23 | } 24 | ///The parsed JSON ABI of the contract. 25 | pub static EIP712_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( 26 | __abi, 27 | ); 28 | pub struct EIP712(::ethers::contract::Contract); 29 | impl ::core::clone::Clone for EIP712 { 30 | fn clone(&self) -> Self { 31 | Self(::core::clone::Clone::clone(&self.0)) 32 | } 33 | } 34 | impl ::core::ops::Deref for EIP712 { 35 | type Target = ::ethers::contract::Contract; 36 | fn deref(&self) -> &Self::Target { 37 | &self.0 38 | } 39 | } 40 | impl ::core::ops::DerefMut for EIP712 { 41 | fn deref_mut(&mut self) -> &mut Self::Target { 42 | &mut self.0 43 | } 44 | } 45 | impl ::core::fmt::Debug for EIP712 { 46 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 47 | f.debug_tuple(::core::stringify!(EIP712)).field(&self.address()).finish() 48 | } 49 | } 50 | impl EIP712 { 51 | /// Creates a new contract instance with the specified `ethers` client at 52 | /// `address`. The contract derefs to a `ethers::Contract` object. 53 | pub fn new>( 54 | address: T, 55 | client: ::std::sync::Arc, 56 | ) -> Self { 57 | Self( 58 | ::ethers::contract::Contract::new( 59 | address.into(), 60 | EIP712_ABI.clone(), 61 | client, 62 | ), 63 | ) 64 | } 65 | } 66 | impl From<::ethers::contract::Contract> 67 | for EIP712 { 68 | fn from(contract: ::ethers::contract::Contract) -> Self { 69 | Self::new(contract.address(), contract.client()) 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /eas-contracts/src/context.rs: -------------------------------------------------------------------------------- 1 | pub use context::*; 2 | /// This module was auto-generated with ethers-rs Abigen. 3 | /// More information at: 4 | #[allow( 5 | clippy::enum_variant_names, 6 | clippy::too_many_arguments, 7 | clippy::upper_case_acronyms, 8 | clippy::type_complexity, 9 | dead_code, 10 | non_camel_case_types, 11 | )] 12 | pub mod context { 13 | #[allow(deprecated)] 14 | fn __abi() -> ::ethers::core::abi::Abi { 15 | ::ethers::core::abi::ethabi::Contract { 16 | constructor: ::core::option::Option::None, 17 | functions: ::std::collections::BTreeMap::new(), 18 | events: ::std::collections::BTreeMap::new(), 19 | errors: ::std::collections::BTreeMap::new(), 20 | receive: false, 21 | fallback: false, 22 | } 23 | } 24 | ///The parsed JSON ABI of the contract. 25 | pub static CONTEXT_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( 26 | __abi, 27 | ); 28 | pub struct Context(::ethers::contract::Contract); 29 | impl ::core::clone::Clone for Context { 30 | fn clone(&self) -> Self { 31 | Self(::core::clone::Clone::clone(&self.0)) 32 | } 33 | } 34 | impl ::core::ops::Deref for Context { 35 | type Target = ::ethers::contract::Contract; 36 | fn deref(&self) -> &Self::Target { 37 | &self.0 38 | } 39 | } 40 | impl ::core::ops::DerefMut for Context { 41 | fn deref_mut(&mut self) -> &mut Self::Target { 42 | &mut self.0 43 | } 44 | } 45 | impl ::core::fmt::Debug for Context { 46 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 47 | f.debug_tuple(::core::stringify!(Context)).field(&self.address()).finish() 48 | } 49 | } 50 | impl Context { 51 | /// Creates a new contract instance with the specified `ethers` client at 52 | /// `address`. The contract derefs to a `ethers::Contract` object. 53 | pub fn new>( 54 | address: T, 55 | client: ::std::sync::Arc, 56 | ) -> Self { 57 | Self( 58 | ::ethers::contract::Contract::new( 59 | address.into(), 60 | CONTEXT_ABI.clone(), 61 | client, 62 | ), 63 | ) 64 | } 65 | } 66 | impl From<::ethers::contract::Contract> 67 | for Context { 68 | fn from(contract: ::ethers::contract::Contract) -> Self { 69 | Self::new(contract.address(), contract.client()) 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /eas-contracts/src/math.rs: -------------------------------------------------------------------------------- 1 | pub use math::*; 2 | /// This module was auto-generated with ethers-rs Abigen. 3 | /// More information at: 4 | #[allow( 5 | clippy::enum_variant_names, 6 | clippy::too_many_arguments, 7 | clippy::upper_case_acronyms, 8 | clippy::type_complexity, 9 | dead_code, 10 | non_camel_case_types, 11 | )] 12 | pub mod math { 13 | #[allow(deprecated)] 14 | fn __abi() -> ::ethers::core::abi::Abi { 15 | ::ethers::core::abi::ethabi::Contract { 16 | constructor: ::core::option::Option::None, 17 | functions: ::std::collections::BTreeMap::new(), 18 | events: ::std::collections::BTreeMap::new(), 19 | errors: ::std::collections::BTreeMap::new(), 20 | receive: false, 21 | fallback: false, 22 | } 23 | } 24 | ///The parsed JSON ABI of the contract. 25 | pub static MATH_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( 26 | __abi, 27 | ); 28 | #[rustfmt::skip] 29 | const __BYTECODE: &[u8] = b"`-`7`\x0B\x82\x82\x829\x80Q`\0\x1A`s\x14`*WcNH{q`\xE0\x1B`\0R`\0`\x04R`$`\0\xFD[0`\0R`s\x81S\x82\x81\xF3\xFEs\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x000\x14`\x80`@R`\0\x80\xFD\xFE\xA1dsolcC\0\x08\x13\0\n"; 30 | /// The bytecode of the contract. 31 | pub static MATH_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( 32 | __BYTECODE, 33 | ); 34 | #[rustfmt::skip] 35 | const __DEPLOYED_BYTECODE: &[u8] = b"s\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x000\x14`\x80`@R`\0\x80\xFD\xFE\xA1dsolcC\0\x08\x13\0\n"; 36 | /// The deployed bytecode of the contract. 37 | pub static MATH_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( 38 | __DEPLOYED_BYTECODE, 39 | ); 40 | pub struct Math(::ethers::contract::Contract); 41 | impl ::core::clone::Clone for Math { 42 | fn clone(&self) -> Self { 43 | Self(::core::clone::Clone::clone(&self.0)) 44 | } 45 | } 46 | impl ::core::ops::Deref for Math { 47 | type Target = ::ethers::contract::Contract; 48 | fn deref(&self) -> &Self::Target { 49 | &self.0 50 | } 51 | } 52 | impl ::core::ops::DerefMut for Math { 53 | fn deref_mut(&mut self) -> &mut Self::Target { 54 | &mut self.0 55 | } 56 | } 57 | impl ::core::fmt::Debug for Math { 58 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 59 | f.debug_tuple(::core::stringify!(Math)).field(&self.address()).finish() 60 | } 61 | } 62 | impl Math { 63 | /// Creates a new contract instance with the specified `ethers` client at 64 | /// `address`. The contract derefs to a `ethers::Contract` object. 65 | pub fn new>( 66 | address: T, 67 | client: ::std::sync::Arc, 68 | ) -> Self { 69 | Self( 70 | ::ethers::contract::Contract::new( 71 | address.into(), 72 | MATH_ABI.clone(), 73 | client, 74 | ), 75 | ) 76 | } 77 | /// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it. 78 | /// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction 79 | /// 80 | /// Notes: 81 | /// - If there are no constructor arguments, you should pass `()` as the argument. 82 | /// - The default poll duration is 7 seconds. 83 | /// - The default number of confirmations is 1 block. 84 | /// 85 | /// 86 | /// # Example 87 | /// 88 | /// Generate contract bindings with `abigen!` and deploy a new contract instance. 89 | /// 90 | /// *Note*: this requires a `bytecode` and `abi` object in the `greeter.json` artifact. 91 | /// 92 | /// ```ignore 93 | /// # async fn deploy(client: ::std::sync::Arc) { 94 | /// abigen!(Greeter, "../greeter.json"); 95 | /// 96 | /// let greeter_contract = Greeter::deploy(client, "Hello world!".to_string()).unwrap().send().await.unwrap(); 97 | /// let msg = greeter_contract.greet().call().await.unwrap(); 98 | /// # } 99 | /// ``` 100 | pub fn deploy( 101 | client: ::std::sync::Arc, 102 | constructor_args: T, 103 | ) -> ::core::result::Result< 104 | ::ethers::contract::builders::ContractDeployer, 105 | ::ethers::contract::ContractError, 106 | > { 107 | let factory = ::ethers::contract::ContractFactory::new( 108 | MATH_ABI.clone(), 109 | MATH_BYTECODE.clone().into(), 110 | client, 111 | ); 112 | let deployer = factory.deploy(constructor_args)?; 113 | let deployer = ::ethers::contract::ContractDeployer::new(deployer); 114 | Ok(deployer) 115 | } 116 | } 117 | impl From<::ethers::contract::Contract> 118 | for Math { 119 | fn from(contract: ::ethers::contract::Contract) -> Self { 120 | Self::new(contract.address(), contract.client()) 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /eas-contracts/src/ecdsa.rs: -------------------------------------------------------------------------------- 1 | pub use ecdsa::*; 2 | /// This module was auto-generated with ethers-rs Abigen. 3 | /// More information at: 4 | #[allow( 5 | clippy::enum_variant_names, 6 | clippy::too_many_arguments, 7 | clippy::upper_case_acronyms, 8 | clippy::type_complexity, 9 | dead_code, 10 | non_camel_case_types, 11 | )] 12 | pub mod ecdsa { 13 | #[allow(deprecated)] 14 | fn __abi() -> ::ethers::core::abi::Abi { 15 | ::ethers::core::abi::ethabi::Contract { 16 | constructor: ::core::option::Option::None, 17 | functions: ::std::collections::BTreeMap::new(), 18 | events: ::std::collections::BTreeMap::new(), 19 | errors: ::std::collections::BTreeMap::new(), 20 | receive: false, 21 | fallback: false, 22 | } 23 | } 24 | ///The parsed JSON ABI of the contract. 25 | pub static ECDSA_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( 26 | __abi, 27 | ); 28 | #[rustfmt::skip] 29 | const __BYTECODE: &[u8] = b"`-`7`\x0B\x82\x82\x829\x80Q`\0\x1A`s\x14`*WcNH{q`\xE0\x1B`\0R`\0`\x04R`$`\0\xFD[0`\0R`s\x81S\x82\x81\xF3\xFEs\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x000\x14`\x80`@R`\0\x80\xFD\xFE\xA1dsolcC\0\x08\x13\0\n"; 30 | /// The bytecode of the contract. 31 | pub static ECDSA_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( 32 | __BYTECODE, 33 | ); 34 | #[rustfmt::skip] 35 | const __DEPLOYED_BYTECODE: &[u8] = b"s\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x000\x14`\x80`@R`\0\x80\xFD\xFE\xA1dsolcC\0\x08\x13\0\n"; 36 | /// The deployed bytecode of the contract. 37 | pub static ECDSA_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( 38 | __DEPLOYED_BYTECODE, 39 | ); 40 | pub struct ECDSA(::ethers::contract::Contract); 41 | impl ::core::clone::Clone for ECDSA { 42 | fn clone(&self) -> Self { 43 | Self(::core::clone::Clone::clone(&self.0)) 44 | } 45 | } 46 | impl ::core::ops::Deref for ECDSA { 47 | type Target = ::ethers::contract::Contract; 48 | fn deref(&self) -> &Self::Target { 49 | &self.0 50 | } 51 | } 52 | impl ::core::ops::DerefMut for ECDSA { 53 | fn deref_mut(&mut self) -> &mut Self::Target { 54 | &mut self.0 55 | } 56 | } 57 | impl ::core::fmt::Debug for ECDSA { 58 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 59 | f.debug_tuple(::core::stringify!(ECDSA)).field(&self.address()).finish() 60 | } 61 | } 62 | impl ECDSA { 63 | /// Creates a new contract instance with the specified `ethers` client at 64 | /// `address`. The contract derefs to a `ethers::Contract` object. 65 | pub fn new>( 66 | address: T, 67 | client: ::std::sync::Arc, 68 | ) -> Self { 69 | Self( 70 | ::ethers::contract::Contract::new( 71 | address.into(), 72 | ECDSA_ABI.clone(), 73 | client, 74 | ), 75 | ) 76 | } 77 | /// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it. 78 | /// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction 79 | /// 80 | /// Notes: 81 | /// - If there are no constructor arguments, you should pass `()` as the argument. 82 | /// - The default poll duration is 7 seconds. 83 | /// - The default number of confirmations is 1 block. 84 | /// 85 | /// 86 | /// # Example 87 | /// 88 | /// Generate contract bindings with `abigen!` and deploy a new contract instance. 89 | /// 90 | /// *Note*: this requires a `bytecode` and `abi` object in the `greeter.json` artifact. 91 | /// 92 | /// ```ignore 93 | /// # async fn deploy(client: ::std::sync::Arc) { 94 | /// abigen!(Greeter, "../greeter.json"); 95 | /// 96 | /// let greeter_contract = Greeter::deploy(client, "Hello world!".to_string()).unwrap().send().await.unwrap(); 97 | /// let msg = greeter_contract.greet().call().await.unwrap(); 98 | /// # } 99 | /// ``` 100 | pub fn deploy( 101 | client: ::std::sync::Arc, 102 | constructor_args: T, 103 | ) -> ::core::result::Result< 104 | ::ethers::contract::builders::ContractDeployer, 105 | ::ethers::contract::ContractError, 106 | > { 107 | let factory = ::ethers::contract::ContractFactory::new( 108 | ECDSA_ABI.clone(), 109 | ECDSA_BYTECODE.clone().into(), 110 | client, 111 | ); 112 | let deployer = factory.deploy(constructor_args)?; 113 | let deployer = ::ethers::contract::ContractDeployer::new(deployer); 114 | Ok(deployer) 115 | } 116 | } 117 | impl From<::ethers::contract::Contract> 118 | for ECDSA { 119 | fn from(contract: ::ethers::contract::Contract) -> Self { 120 | Self::new(contract.address(), contract.client()) 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /eas-contracts/src/address.rs: -------------------------------------------------------------------------------- 1 | pub use address::*; 2 | /// This module was auto-generated with ethers-rs Abigen. 3 | /// More information at: 4 | #[allow( 5 | clippy::enum_variant_names, 6 | clippy::too_many_arguments, 7 | clippy::upper_case_acronyms, 8 | clippy::type_complexity, 9 | dead_code, 10 | non_camel_case_types, 11 | )] 12 | pub mod address { 13 | #[allow(deprecated)] 14 | fn __abi() -> ::ethers::core::abi::Abi { 15 | ::ethers::core::abi::ethabi::Contract { 16 | constructor: ::core::option::Option::None, 17 | functions: ::std::collections::BTreeMap::new(), 18 | events: ::std::collections::BTreeMap::new(), 19 | errors: ::std::collections::BTreeMap::new(), 20 | receive: false, 21 | fallback: false, 22 | } 23 | } 24 | ///The parsed JSON ABI of the contract. 25 | pub static ADDRESS_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( 26 | __abi, 27 | ); 28 | #[rustfmt::skip] 29 | const __BYTECODE: &[u8] = b"`-`7`\x0B\x82\x82\x829\x80Q`\0\x1A`s\x14`*WcNH{q`\xE0\x1B`\0R`\0`\x04R`$`\0\xFD[0`\0R`s\x81S\x82\x81\xF3\xFEs\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x000\x14`\x80`@R`\0\x80\xFD\xFE\xA1dsolcC\0\x08\x13\0\n"; 30 | /// The bytecode of the contract. 31 | pub static ADDRESS_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( 32 | __BYTECODE, 33 | ); 34 | #[rustfmt::skip] 35 | const __DEPLOYED_BYTECODE: &[u8] = b"s\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x000\x14`\x80`@R`\0\x80\xFD\xFE\xA1dsolcC\0\x08\x13\0\n"; 36 | /// The deployed bytecode of the contract. 37 | pub static ADDRESS_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( 38 | __DEPLOYED_BYTECODE, 39 | ); 40 | pub struct Address(::ethers::contract::Contract); 41 | impl ::core::clone::Clone for Address { 42 | fn clone(&self) -> Self { 43 | Self(::core::clone::Clone::clone(&self.0)) 44 | } 45 | } 46 | impl ::core::ops::Deref for Address { 47 | type Target = ::ethers::contract::Contract; 48 | fn deref(&self) -> &Self::Target { 49 | &self.0 50 | } 51 | } 52 | impl ::core::ops::DerefMut for Address { 53 | fn deref_mut(&mut self) -> &mut Self::Target { 54 | &mut self.0 55 | } 56 | } 57 | impl ::core::fmt::Debug for Address { 58 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 59 | f.debug_tuple(::core::stringify!(Address)).field(&self.address()).finish() 60 | } 61 | } 62 | impl Address { 63 | /// Creates a new contract instance with the specified `ethers` client at 64 | /// `address`. The contract derefs to a `ethers::Contract` object. 65 | pub fn new>( 66 | address: T, 67 | client: ::std::sync::Arc, 68 | ) -> Self { 69 | Self( 70 | ::ethers::contract::Contract::new( 71 | address.into(), 72 | ADDRESS_ABI.clone(), 73 | client, 74 | ), 75 | ) 76 | } 77 | /// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it. 78 | /// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction 79 | /// 80 | /// Notes: 81 | /// - If there are no constructor arguments, you should pass `()` as the argument. 82 | /// - The default poll duration is 7 seconds. 83 | /// - The default number of confirmations is 1 block. 84 | /// 85 | /// 86 | /// # Example 87 | /// 88 | /// Generate contract bindings with `abigen!` and deploy a new contract instance. 89 | /// 90 | /// *Note*: this requires a `bytecode` and `abi` object in the `greeter.json` artifact. 91 | /// 92 | /// ```ignore 93 | /// # async fn deploy(client: ::std::sync::Arc) { 94 | /// abigen!(Greeter, "../greeter.json"); 95 | /// 96 | /// let greeter_contract = Greeter::deploy(client, "Hello world!".to_string()).unwrap().send().await.unwrap(); 97 | /// let msg = greeter_contract.greet().call().await.unwrap(); 98 | /// # } 99 | /// ``` 100 | pub fn deploy( 101 | client: ::std::sync::Arc, 102 | constructor_args: T, 103 | ) -> ::core::result::Result< 104 | ::ethers::contract::builders::ContractDeployer, 105 | ::ethers::contract::ContractError, 106 | > { 107 | let factory = ::ethers::contract::ContractFactory::new( 108 | ADDRESS_ABI.clone(), 109 | ADDRESS_BYTECODE.clone().into(), 110 | client, 111 | ); 112 | let deployer = factory.deploy(constructor_args)?; 113 | let deployer = ::ethers::contract::ContractDeployer::new(deployer); 114 | Ok(deployer) 115 | } 116 | } 117 | impl From<::ethers::contract::Contract> 118 | for Address { 119 | fn from(contract: ::ethers::contract::Contract) -> Self { 120 | Self::new(contract.address(), contract.client()) 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /eas-contracts/src/strings.rs: -------------------------------------------------------------------------------- 1 | pub use strings::*; 2 | /// This module was auto-generated with ethers-rs Abigen. 3 | /// More information at: 4 | #[allow( 5 | clippy::enum_variant_names, 6 | clippy::too_many_arguments, 7 | clippy::upper_case_acronyms, 8 | clippy::type_complexity, 9 | dead_code, 10 | non_camel_case_types, 11 | )] 12 | pub mod strings { 13 | #[allow(deprecated)] 14 | fn __abi() -> ::ethers::core::abi::Abi { 15 | ::ethers::core::abi::ethabi::Contract { 16 | constructor: ::core::option::Option::None, 17 | functions: ::std::collections::BTreeMap::new(), 18 | events: ::std::collections::BTreeMap::new(), 19 | errors: ::std::collections::BTreeMap::new(), 20 | receive: false, 21 | fallback: false, 22 | } 23 | } 24 | ///The parsed JSON ABI of the contract. 25 | pub static STRINGS_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( 26 | __abi, 27 | ); 28 | #[rustfmt::skip] 29 | const __BYTECODE: &[u8] = b"`-`7`\x0B\x82\x82\x829\x80Q`\0\x1A`s\x14`*WcNH{q`\xE0\x1B`\0R`\0`\x04R`$`\0\xFD[0`\0R`s\x81S\x82\x81\xF3\xFEs\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x000\x14`\x80`@R`\0\x80\xFD\xFE\xA1dsolcC\0\x08\x13\0\n"; 30 | /// The bytecode of the contract. 31 | pub static STRINGS_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( 32 | __BYTECODE, 33 | ); 34 | #[rustfmt::skip] 35 | const __DEPLOYED_BYTECODE: &[u8] = b"s\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x000\x14`\x80`@R`\0\x80\xFD\xFE\xA1dsolcC\0\x08\x13\0\n"; 36 | /// The deployed bytecode of the contract. 37 | pub static STRINGS_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( 38 | __DEPLOYED_BYTECODE, 39 | ); 40 | pub struct Strings(::ethers::contract::Contract); 41 | impl ::core::clone::Clone for Strings { 42 | fn clone(&self) -> Self { 43 | Self(::core::clone::Clone::clone(&self.0)) 44 | } 45 | } 46 | impl ::core::ops::Deref for Strings { 47 | type Target = ::ethers::contract::Contract; 48 | fn deref(&self) -> &Self::Target { 49 | &self.0 50 | } 51 | } 52 | impl ::core::ops::DerefMut for Strings { 53 | fn deref_mut(&mut self) -> &mut Self::Target { 54 | &mut self.0 55 | } 56 | } 57 | impl ::core::fmt::Debug for Strings { 58 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 59 | f.debug_tuple(::core::stringify!(Strings)).field(&self.address()).finish() 60 | } 61 | } 62 | impl Strings { 63 | /// Creates a new contract instance with the specified `ethers` client at 64 | /// `address`. The contract derefs to a `ethers::Contract` object. 65 | pub fn new>( 66 | address: T, 67 | client: ::std::sync::Arc, 68 | ) -> Self { 69 | Self( 70 | ::ethers::contract::Contract::new( 71 | address.into(), 72 | STRINGS_ABI.clone(), 73 | client, 74 | ), 75 | ) 76 | } 77 | /// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it. 78 | /// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction 79 | /// 80 | /// Notes: 81 | /// - If there are no constructor arguments, you should pass `()` as the argument. 82 | /// - The default poll duration is 7 seconds. 83 | /// - The default number of confirmations is 1 block. 84 | /// 85 | /// 86 | /// # Example 87 | /// 88 | /// Generate contract bindings with `abigen!` and deploy a new contract instance. 89 | /// 90 | /// *Note*: this requires a `bytecode` and `abi` object in the `greeter.json` artifact. 91 | /// 92 | /// ```ignore 93 | /// # async fn deploy(client: ::std::sync::Arc) { 94 | /// abigen!(Greeter, "../greeter.json"); 95 | /// 96 | /// let greeter_contract = Greeter::deploy(client, "Hello world!".to_string()).unwrap().send().await.unwrap(); 97 | /// let msg = greeter_contract.greet().call().await.unwrap(); 98 | /// # } 99 | /// ``` 100 | pub fn deploy( 101 | client: ::std::sync::Arc, 102 | constructor_args: T, 103 | ) -> ::core::result::Result< 104 | ::ethers::contract::builders::ContractDeployer, 105 | ::ethers::contract::ContractError, 106 | > { 107 | let factory = ::ethers::contract::ContractFactory::new( 108 | STRINGS_ABI.clone(), 109 | STRINGS_BYTECODE.clone().into(), 110 | client, 111 | ); 112 | let deployer = factory.deploy(constructor_args)?; 113 | let deployer = ::ethers::contract::ContractDeployer::new(deployer); 114 | Ok(deployer) 115 | } 116 | } 117 | impl From<::ethers::contract::Contract> 118 | for Strings { 119 | fn from(contract: ::ethers::contract::Contract) -> Self { 120 | Self::new(contract.address(), contract.client()) 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/schema_registry.rs: -------------------------------------------------------------------------------- 1 | use crate::eas::Signer; 2 | use alloy_sol_types::SolType; 3 | use eas_contracts::{schema_registry::SchemaRegistry, value_resolver::SchemaRecord}; 4 | use ethers::{prelude::ContractError, providers::ProviderError, types::Address}; 5 | use std::sync::Arc; 6 | 7 | pub struct SchemaField { 8 | _name: String, 9 | _sol_type: T, 10 | } 11 | 12 | /// The SchemaRegistryContract struct encapsulates a signer and an instance of a Schema Registry. 13 | pub struct SchemaRegistryContract { 14 | /// The signer used by the SchemaRegistryContract instance. 15 | signer: Arc, 16 | /// The Schema Registry contract. 17 | schema_registry: SchemaRegistry, 18 | } 19 | 20 | /// Implementation block for the SchemaRegistry 21 | impl SchemaRegistryContract { 22 | /// Constructs a new SchemaRegistryContract instance. 23 | /// If no contract address is provided, the zero address is used. 24 | /// The address will be updated when the SchemaRegistry is deployed. 25 | /// 26 | /// # Parameters 27 | /// 28 | /// * `signer`: An instance of the Signer. 29 | /// * `sr_address`: The address of the SchemaRegistry contract. 30 | /// 31 | /// # Returns 32 | /// 33 | /// A new SchemaRegistryContract instance. 34 | pub fn new(signer: Signer, sr_address: Option
) -> Self { 35 | let signer_arc = Arc::new(signer); 36 | 37 | Self { 38 | signer: signer_arc.clone(), 39 | schema_registry: SchemaRegistry::new(sr_address.unwrap_or(Address::zero()), signer_arc), 40 | } 41 | } 42 | 43 | /// Returns the signer used by the SchemaRegistry instance. 44 | /// 45 | /// # Returns 46 | /// 47 | /// An Arc pointing to the Signer instance. 48 | pub fn signer(&self) -> Arc { 49 | self.signer.clone() 50 | } 51 | 52 | /// Returns the SchemaRegistryContract instance. 53 | /// 54 | /// # Returns 55 | /// 56 | /// An instance of SchemaRegistryContract. 57 | pub fn contract(&self) -> SchemaRegistry { 58 | self.schema_registry.clone() 59 | } 60 | 61 | /// Deploys the Schema Registry. 62 | /// This function will update the SchemaRegistryContract instance with the deployed contract address. 63 | /// 64 | /// # Returns 65 | /// 66 | /// A Result which is an Ok if the registry was successfully deployed, else an Err. 67 | pub async fn deploy(&mut self) -> Result> { 68 | let deployment = SchemaRegistry::deploy(self.signer.clone(), ())?; 69 | let address = deployment.send().await?.address(); 70 | 71 | // Update the Schema Registry instance with the deployed contract address. 72 | self.schema_registry = SchemaRegistry::new(address, self.signer.clone()); 73 | 74 | Ok(address) 75 | } 76 | 77 | /// Registers a new schema on the Schema Registry. 78 | /// 79 | /// # Parameters 80 | /// 81 | /// * `schema`: The definition or representation of the schema. 82 | /// * `resolver`: The address of the resolver contract. 83 | /// * `revocable`: A flag indicating whether the schema can be revoked. 84 | /// 85 | /// # Returns 86 | /// 87 | /// A Result containing the unique identifier (ID) of the registered schema if successful, or a ContractError if the operation fails. 88 | pub async fn register_schema( 89 | &self, 90 | schema: String, 91 | resolver: Address, 92 | revocable: bool, 93 | ) -> Result<[u8; 32], ContractError> { 94 | let register_call = self.schema_registry.register(schema, resolver, revocable); 95 | let tx = register_call.send().await?; 96 | 97 | match tx.await? { 98 | Some(receipt) => { 99 | if receipt.status == Some(1.into()) { 100 | let schema_id = receipt 101 | .logs 102 | .first() 103 | .ok_or(ContractError::ProviderError { 104 | e: ProviderError::CustomError( 105 | "No logs found in the receipt".to_string(), 106 | ), 107 | })? 108 | .topics 109 | .get(1) 110 | .ok_or(ContractError::ProviderError { 111 | e: ProviderError::CustomError("Missing expected log topic".to_string()), 112 | })? 113 | .as_fixed_bytes(); 114 | 115 | Ok(*schema_id) 116 | } else { 117 | Err(ContractError::ProviderError { 118 | e: ProviderError::CustomError("Transaction failed".to_string()), 119 | }) 120 | } 121 | } 122 | None => Err(ContractError::ProviderError { 123 | e: ProviderError::CustomError("No receipt found for the transaction".to_string()), 124 | }), 125 | } 126 | } 127 | 128 | /// Retrieves the details of a schema given its unique identifier. 129 | /// 130 | /// # Parameters 131 | /// 132 | /// * `schema_id`: The unique identifier of the schema to be retrieved. 133 | /// 134 | /// # Returns 135 | /// 136 | /// A Result containing the details of the requested schema if found, or a ContractError if the operation fails. 137 | pub async fn get_schema( 138 | &self, 139 | schema_id: [u8; 32], 140 | ) -> Result> { 141 | self.schema_registry.get_schema(schema_id).call().await 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /eas-contracts/src/safe_erc20.rs: -------------------------------------------------------------------------------- 1 | pub use safe_erc20::*; 2 | /// This module was auto-generated with ethers-rs Abigen. 3 | /// More information at: 4 | #[allow( 5 | clippy::enum_variant_names, 6 | clippy::too_many_arguments, 7 | clippy::upper_case_acronyms, 8 | clippy::type_complexity, 9 | dead_code, 10 | non_camel_case_types, 11 | )] 12 | pub mod safe_erc20 { 13 | #[allow(deprecated)] 14 | fn __abi() -> ::ethers::core::abi::Abi { 15 | ::ethers::core::abi::ethabi::Contract { 16 | constructor: ::core::option::Option::None, 17 | functions: ::std::collections::BTreeMap::new(), 18 | events: ::std::collections::BTreeMap::new(), 19 | errors: ::std::collections::BTreeMap::new(), 20 | receive: false, 21 | fallback: false, 22 | } 23 | } 24 | ///The parsed JSON ABI of the contract. 25 | pub static SAFEERC20_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( 26 | __abi, 27 | ); 28 | #[rustfmt::skip] 29 | const __BYTECODE: &[u8] = b"`-`7`\x0B\x82\x82\x829\x80Q`\0\x1A`s\x14`*WcNH{q`\xE0\x1B`\0R`\0`\x04R`$`\0\xFD[0`\0R`s\x81S\x82\x81\xF3\xFEs\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x000\x14`\x80`@R`\0\x80\xFD\xFE\xA1dsolcC\0\x08\x13\0\n"; 30 | /// The bytecode of the contract. 31 | pub static SAFEERC20_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( 32 | __BYTECODE, 33 | ); 34 | #[rustfmt::skip] 35 | const __DEPLOYED_BYTECODE: &[u8] = b"s\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x000\x14`\x80`@R`\0\x80\xFD\xFE\xA1dsolcC\0\x08\x13\0\n"; 36 | /// The deployed bytecode of the contract. 37 | pub static SAFEERC20_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( 38 | __DEPLOYED_BYTECODE, 39 | ); 40 | pub struct SafeERC20(::ethers::contract::Contract); 41 | impl ::core::clone::Clone for SafeERC20 { 42 | fn clone(&self) -> Self { 43 | Self(::core::clone::Clone::clone(&self.0)) 44 | } 45 | } 46 | impl ::core::ops::Deref for SafeERC20 { 47 | type Target = ::ethers::contract::Contract; 48 | fn deref(&self) -> &Self::Target { 49 | &self.0 50 | } 51 | } 52 | impl ::core::ops::DerefMut for SafeERC20 { 53 | fn deref_mut(&mut self) -> &mut Self::Target { 54 | &mut self.0 55 | } 56 | } 57 | impl ::core::fmt::Debug for SafeERC20 { 58 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 59 | f.debug_tuple(::core::stringify!(SafeERC20)).field(&self.address()).finish() 60 | } 61 | } 62 | impl SafeERC20 { 63 | /// Creates a new contract instance with the specified `ethers` client at 64 | /// `address`. The contract derefs to a `ethers::Contract` object. 65 | pub fn new>( 66 | address: T, 67 | client: ::std::sync::Arc, 68 | ) -> Self { 69 | Self( 70 | ::ethers::contract::Contract::new( 71 | address.into(), 72 | SAFEERC20_ABI.clone(), 73 | client, 74 | ), 75 | ) 76 | } 77 | /// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it. 78 | /// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction 79 | /// 80 | /// Notes: 81 | /// - If there are no constructor arguments, you should pass `()` as the argument. 82 | /// - The default poll duration is 7 seconds. 83 | /// - The default number of confirmations is 1 block. 84 | /// 85 | /// 86 | /// # Example 87 | /// 88 | /// Generate contract bindings with `abigen!` and deploy a new contract instance. 89 | /// 90 | /// *Note*: this requires a `bytecode` and `abi` object in the `greeter.json` artifact. 91 | /// 92 | /// ```ignore 93 | /// # async fn deploy(client: ::std::sync::Arc) { 94 | /// abigen!(Greeter, "../greeter.json"); 95 | /// 96 | /// let greeter_contract = Greeter::deploy(client, "Hello world!".to_string()).unwrap().send().await.unwrap(); 97 | /// let msg = greeter_contract.greet().call().await.unwrap(); 98 | /// # } 99 | /// ``` 100 | pub fn deploy( 101 | client: ::std::sync::Arc, 102 | constructor_args: T, 103 | ) -> ::core::result::Result< 104 | ::ethers::contract::builders::ContractDeployer, 105 | ::ethers::contract::ContractError, 106 | > { 107 | let factory = ::ethers::contract::ContractFactory::new( 108 | SAFEERC20_ABI.clone(), 109 | SAFEERC20_BYTECODE.clone().into(), 110 | client, 111 | ); 112 | let deployer = factory.deploy(constructor_args)?; 113 | let deployer = ::ethers::contract::ContractDeployer::new(deployer); 114 | Ok(deployer) 115 | } 116 | } 117 | impl From<::ethers::contract::Contract> 118 | for SafeERC20 { 119 | fn from(contract: ::ethers::contract::Contract) -> Self { 120 | Self::new(contract.address(), contract.client()) 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /eas-contracts/src/shared_types.rs: -------------------------------------------------------------------------------- 1 | ///`Attestation(bytes32,bytes32,uint64,uint64,uint64,bytes32,address,address,bool,bytes)` 2 | #[derive( 3 | Clone, 4 | ::ethers::contract::EthAbiType, 5 | ::ethers::contract::EthAbiCodec, 6 | Default, 7 | Debug, 8 | PartialEq, 9 | Eq, 10 | Hash 11 | )] 12 | pub struct Attestation { 13 | pub uid: [u8; 32], 14 | pub schema: [u8; 32], 15 | pub time: u64, 16 | pub expiration_time: u64, 17 | pub revocation_time: u64, 18 | pub ref_uid: [u8; 32], 19 | pub recipient: ::ethers::core::types::Address, 20 | pub attester: ::ethers::core::types::Address, 21 | pub revocable: bool, 22 | pub data: ::ethers::core::types::Bytes, 23 | } 24 | ///`AttestationRequest(bytes32,(address,uint64,bool,bytes32,bytes,uint256))` 25 | #[derive( 26 | Clone, 27 | ::ethers::contract::EthAbiType, 28 | ::ethers::contract::EthAbiCodec, 29 | Default, 30 | Debug, 31 | PartialEq, 32 | Eq, 33 | Hash 34 | )] 35 | pub struct AttestationRequest { 36 | pub schema: [u8; 32], 37 | pub data: AttestationRequestData, 38 | } 39 | ///`AttestationRequestData(address,uint64,bool,bytes32,bytes,uint256)` 40 | #[derive( 41 | Clone, 42 | ::ethers::contract::EthAbiType, 43 | ::ethers::contract::EthAbiCodec, 44 | Default, 45 | Debug, 46 | PartialEq, 47 | Eq, 48 | Hash 49 | )] 50 | pub struct AttestationRequestData { 51 | pub recipient: ::ethers::core::types::Address, 52 | pub expiration_time: u64, 53 | pub revocable: bool, 54 | pub ref_uid: [u8; 32], 55 | pub data: ::ethers::core::types::Bytes, 56 | pub value: ::ethers::core::types::U256, 57 | } 58 | ///`DelegatedAttestationRequest(bytes32,(address,uint64,bool,bytes32,bytes,uint256),(uint8,bytes32,bytes32),address)` 59 | #[derive( 60 | Clone, 61 | ::ethers::contract::EthAbiType, 62 | ::ethers::contract::EthAbiCodec, 63 | Default, 64 | Debug, 65 | PartialEq, 66 | Eq, 67 | Hash 68 | )] 69 | pub struct DelegatedAttestationRequest { 70 | pub schema: [u8; 32], 71 | pub data: AttestationRequestData, 72 | pub signature: Eip712Signature, 73 | pub attester: ::ethers::core::types::Address, 74 | } 75 | ///`DelegatedProxyAttestationRequest(bytes32,(address,uint64,bool,bytes32,bytes,uint256),(uint8,bytes32,bytes32),address,uint64)` 76 | #[derive( 77 | Clone, 78 | ::ethers::contract::EthAbiType, 79 | ::ethers::contract::EthAbiCodec, 80 | Default, 81 | Debug, 82 | PartialEq, 83 | Eq, 84 | Hash 85 | )] 86 | pub struct DelegatedProxyAttestationRequest { 87 | pub schema: [u8; 32], 88 | pub data: AttestationRequestData, 89 | pub signature: Eip712Signature, 90 | pub attester: ::ethers::core::types::Address, 91 | pub deadline: u64, 92 | } 93 | ///`DelegatedProxyRevocationRequest(bytes32,(bytes32,uint256),(uint8,bytes32,bytes32),address,uint64)` 94 | #[derive( 95 | Clone, 96 | ::ethers::contract::EthAbiType, 97 | ::ethers::contract::EthAbiCodec, 98 | Default, 99 | Debug, 100 | PartialEq, 101 | Eq, 102 | Hash 103 | )] 104 | pub struct DelegatedProxyRevocationRequest { 105 | pub schema: [u8; 32], 106 | pub data: RevocationRequestData, 107 | pub signature: Eip712Signature, 108 | pub revoker: ::ethers::core::types::Address, 109 | pub deadline: u64, 110 | } 111 | ///`DelegatedRevocationRequest(bytes32,(bytes32,uint256),(uint8,bytes32,bytes32),address)` 112 | #[derive( 113 | Clone, 114 | ::ethers::contract::EthAbiType, 115 | ::ethers::contract::EthAbiCodec, 116 | Default, 117 | Debug, 118 | PartialEq, 119 | Eq, 120 | Hash 121 | )] 122 | pub struct DelegatedRevocationRequest { 123 | pub schema: [u8; 32], 124 | pub data: RevocationRequestData, 125 | pub signature: Eip712Signature, 126 | pub revoker: ::ethers::core::types::Address, 127 | } 128 | ///`Eip712Signature(uint8,bytes32,bytes32)` 129 | #[derive( 130 | Clone, 131 | ::ethers::contract::EthAbiType, 132 | ::ethers::contract::EthAbiCodec, 133 | Default, 134 | Debug, 135 | PartialEq, 136 | Eq, 137 | Hash 138 | )] 139 | pub struct Eip712Signature { 140 | pub v: u8, 141 | pub r: [u8; 32], 142 | pub s: [u8; 32], 143 | } 144 | ///`MultiAttestationRequest(bytes32,(address,uint64,bool,bytes32,bytes,uint256)[])` 145 | #[derive( 146 | Clone, 147 | ::ethers::contract::EthAbiType, 148 | ::ethers::contract::EthAbiCodec, 149 | Default, 150 | Debug, 151 | PartialEq, 152 | Eq, 153 | Hash 154 | )] 155 | pub struct MultiAttestationRequest { 156 | pub schema: [u8; 32], 157 | pub data: ::std::vec::Vec, 158 | } 159 | ///`MultiDelegatedAttestationRequest(bytes32,(address,uint64,bool,bytes32,bytes,uint256)[],(uint8,bytes32,bytes32)[],address)` 160 | #[derive( 161 | Clone, 162 | ::ethers::contract::EthAbiType, 163 | ::ethers::contract::EthAbiCodec, 164 | Default, 165 | Debug, 166 | PartialEq, 167 | Eq, 168 | Hash 169 | )] 170 | pub struct MultiDelegatedAttestationRequest { 171 | pub schema: [u8; 32], 172 | pub data: ::std::vec::Vec, 173 | pub signatures: ::std::vec::Vec, 174 | pub attester: ::ethers::core::types::Address, 175 | } 176 | ///`MultiDelegatedProxyAttestationRequest(bytes32,(address,uint64,bool,bytes32,bytes,uint256)[],(uint8,bytes32,bytes32)[],address,uint64)` 177 | #[derive( 178 | Clone, 179 | ::ethers::contract::EthAbiType, 180 | ::ethers::contract::EthAbiCodec, 181 | Default, 182 | Debug, 183 | PartialEq, 184 | Eq, 185 | Hash 186 | )] 187 | pub struct MultiDelegatedProxyAttestationRequest { 188 | pub schema: [u8; 32], 189 | pub data: ::std::vec::Vec, 190 | pub signatures: ::std::vec::Vec, 191 | pub attester: ::ethers::core::types::Address, 192 | pub deadline: u64, 193 | } 194 | ///`MultiDelegatedProxyRevocationRequest(bytes32,(bytes32,uint256)[],(uint8,bytes32,bytes32)[],address,uint64)` 195 | #[derive( 196 | Clone, 197 | ::ethers::contract::EthAbiType, 198 | ::ethers::contract::EthAbiCodec, 199 | Default, 200 | Debug, 201 | PartialEq, 202 | Eq, 203 | Hash 204 | )] 205 | pub struct MultiDelegatedProxyRevocationRequest { 206 | pub schema: [u8; 32], 207 | pub data: ::std::vec::Vec, 208 | pub signatures: ::std::vec::Vec, 209 | pub revoker: ::ethers::core::types::Address, 210 | pub deadline: u64, 211 | } 212 | ///`MultiDelegatedRevocationRequest(bytes32,(bytes32,uint256)[],(uint8,bytes32,bytes32)[],address)` 213 | #[derive( 214 | Clone, 215 | ::ethers::contract::EthAbiType, 216 | ::ethers::contract::EthAbiCodec, 217 | Default, 218 | Debug, 219 | PartialEq, 220 | Eq, 221 | Hash 222 | )] 223 | pub struct MultiDelegatedRevocationRequest { 224 | pub schema: [u8; 32], 225 | pub data: ::std::vec::Vec, 226 | pub signatures: ::std::vec::Vec, 227 | pub revoker: ::ethers::core::types::Address, 228 | } 229 | ///`MultiRevocationRequest(bytes32,(bytes32,uint256)[])` 230 | #[derive( 231 | Clone, 232 | ::ethers::contract::EthAbiType, 233 | ::ethers::contract::EthAbiCodec, 234 | Default, 235 | Debug, 236 | PartialEq, 237 | Eq, 238 | Hash 239 | )] 240 | pub struct MultiRevocationRequest { 241 | pub schema: [u8; 32], 242 | pub data: ::std::vec::Vec, 243 | } 244 | ///`RevocationRequest(bytes32,(bytes32,uint256))` 245 | #[derive( 246 | Clone, 247 | ::ethers::contract::EthAbiType, 248 | ::ethers::contract::EthAbiCodec, 249 | Default, 250 | Debug, 251 | PartialEq, 252 | Eq, 253 | Hash 254 | )] 255 | pub struct RevocationRequest { 256 | pub schema: [u8; 32], 257 | pub data: RevocationRequestData, 258 | } 259 | ///`RevocationRequestData(bytes32,uint256)` 260 | #[derive( 261 | Clone, 262 | ::ethers::contract::EthAbiType, 263 | ::ethers::contract::EthAbiCodec, 264 | Default, 265 | Debug, 266 | PartialEq, 267 | Eq, 268 | Hash 269 | )] 270 | pub struct RevocationRequestData { 271 | pub uid: [u8; 32], 272 | pub value: ::ethers::core::types::U256, 273 | } 274 | ///`SchemaRecord(bytes32,address,bool,string)` 275 | #[derive( 276 | Clone, 277 | ::ethers::contract::EthAbiType, 278 | ::ethers::contract::EthAbiCodec, 279 | Default, 280 | Debug, 281 | PartialEq, 282 | Eq, 283 | Hash 284 | )] 285 | pub struct SchemaRecord { 286 | pub uid: [u8; 32], 287 | pub resolver: ::ethers::core::types::Address, 288 | pub revocable: bool, 289 | pub schema: ::std::string::String, 290 | } 291 | -------------------------------------------------------------------------------- /eas-contracts/src/semver.rs: -------------------------------------------------------------------------------- 1 | pub use semver::*; 2 | /// This module was auto-generated with ethers-rs Abigen. 3 | /// More information at: 4 | #[allow( 5 | clippy::enum_variant_names, 6 | clippy::too_many_arguments, 7 | clippy::upper_case_acronyms, 8 | clippy::type_complexity, 9 | dead_code, 10 | non_camel_case_types, 11 | )] 12 | pub mod semver { 13 | #[allow(deprecated)] 14 | fn __abi() -> ::ethers::core::abi::Abi { 15 | ::ethers::core::abi::ethabi::Contract { 16 | constructor: ::core::option::Option::Some(::ethers::core::abi::ethabi::Constructor { 17 | inputs: ::std::vec![ 18 | ::ethers::core::abi::ethabi::Param { 19 | name: ::std::borrow::ToOwned::to_owned("major"), 20 | kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize), 21 | internal_type: ::core::option::Option::Some( 22 | ::std::borrow::ToOwned::to_owned("uint256"), 23 | ), 24 | }, 25 | ::ethers::core::abi::ethabi::Param { 26 | name: ::std::borrow::ToOwned::to_owned("minor"), 27 | kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize), 28 | internal_type: ::core::option::Option::Some( 29 | ::std::borrow::ToOwned::to_owned("uint256"), 30 | ), 31 | }, 32 | ::ethers::core::abi::ethabi::Param { 33 | name: ::std::borrow::ToOwned::to_owned("patch"), 34 | kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize), 35 | internal_type: ::core::option::Option::Some( 36 | ::std::borrow::ToOwned::to_owned("uint256"), 37 | ), 38 | }, 39 | ], 40 | }), 41 | functions: ::core::convert::From::from([ 42 | ( 43 | ::std::borrow::ToOwned::to_owned("version"), 44 | ::std::vec![ 45 | ::ethers::core::abi::ethabi::Function { 46 | name: ::std::borrow::ToOwned::to_owned("version"), 47 | inputs: ::std::vec![], 48 | outputs: ::std::vec![ 49 | ::ethers::core::abi::ethabi::Param { 50 | name: ::std::string::String::new(), 51 | kind: ::ethers::core::abi::ethabi::ParamType::String, 52 | internal_type: ::core::option::Option::Some( 53 | ::std::borrow::ToOwned::to_owned("string"), 54 | ), 55 | }, 56 | ], 57 | constant: ::core::option::Option::None, 58 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, 59 | }, 60 | ], 61 | ), 62 | ]), 63 | events: ::std::collections::BTreeMap::new(), 64 | errors: ::std::collections::BTreeMap::new(), 65 | receive: false, 66 | fallback: false, 67 | } 68 | } 69 | ///The parsed JSON ABI of the contract. 70 | pub static SEMVER_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( 71 | __abi, 72 | ); 73 | #[rustfmt::skip] 74 | const __BYTECODE: &[u8] = b"`\xE0`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`@Qa\x04S8\x03\x80a\x04S\x839\x81\x01`@\x81\x90Ra\0/\x91a\0@V[`\x80\x92\x90\x92R`\xA0R`\xC0Ra\0nV[`\0\x80`\0``\x84\x86\x03\x12\x15a\0UW`\0\x80\xFD[\x83Q\x92P` \x84\x01Q\x91P`@\x84\x01Q\x90P\x92P\x92P\x92V[`\x80Q`\xA0Q`\xC0Qa\x03\xB9a\0\x9A`\09`\0`\xA7\x01R`\0`~\x01R`\0`U\x01Ra\x03\xB9`\0\xF3\xFE`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`\x046\x10a\0+W`\x005`\xE0\x1C\x80cT\xFDMP\x14a\x000W[`\0\x80\xFD[a\08a\0NV[`@Qa\0E\x91\x90a\x02\xB6V[`@Q\x80\x91\x03\x90\xF3[``a\0y\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0a\0\xF1V[a\0\xA2\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0a\0\xF1V[a\0\xCB\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0a\0\xF1V[`@Q` \x01a\0\xDD\x93\x92\x91\x90a\x03\x07V[`@Q` \x81\x83\x03\x03\x81R\x90`@R\x90P\x90V[```\0a\0\xFE\x83a\x01\xAFV[`\x01\x01\x90P`\0\x81g\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x81\x11\x15a\x01\x1EWa\x01\x1Ea\x03}V[`@Q\x90\x80\x82R\x80`\x1F\x01`\x1F\x19\x16` \x01\x82\x01`@R\x80\x15a\x01HW` \x82\x01\x81\x806\x837\x01\x90P[P\x90P\x81\x81\x01` \x01[\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01\x7F0123456789abcdef\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0`\n\x86\x06\x1A\x81S`\n\x85\x04\x94P\x84a\x01RWP\x93\x92PPPV[`\0\x80z\x18O\x03\xE9?\xF9\xF4\xDA\xA7\x97\xEDn8\xEDd\xBFj\x1F\x01\0\0\0\0\0\0\0\0\x83\x10a\x01\xF8Wz\x18O\x03\xE9?\xF9\xF4\xDA\xA7\x97\xEDn8\xEDd\xBFj\x1F\x01\0\0\0\0\0\0\0\0\x83\x04\x92P`@\x01[m\x04\xEE-mA[\x85\xAC\xEF\x81\0\0\0\0\x83\x10a\x02$Wm\x04\xEE-mA[\x85\xAC\xEF\x81\0\0\0\0\x83\x04\x92P` \x01[f#\x86\xF2o\xC1\0\0\x83\x10a\x02BWf#\x86\xF2o\xC1\0\0\x83\x04\x92P`\x10\x01[c\x05\xF5\xE1\0\x83\x10a\x02ZWc\x05\xF5\xE1\0\x83\x04\x92P`\x08\x01[a'\x10\x83\x10a\x02nWa'\x10\x83\x04\x92P`\x04\x01[`d\x83\x10a\x02\x80W`d\x83\x04\x92P`\x02\x01[`\n\x83\x10a\x02\x8CW`\x01\x01[\x92\x91PPV[`\0[\x83\x81\x10\x15a\x02\xADW\x81\x81\x01Q\x83\x82\x01R` \x01a\x02\x95V[PP`\0\x91\x01RV[` \x81R`\0\x82Q\x80` \x84\x01Ra\x02\xD5\x81`@\x85\x01` \x87\x01a\x02\x92V[`\x1F\x01\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xE0\x16\x91\x90\x91\x01`@\x01\x92\x91PPV[`\0\x84Qa\x03\x19\x81\x84` \x89\x01a\x02\x92V[\x80\x83\x01\x90P\x7F.\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x80\x82R\x85Qa\x03U\x81`\x01\x85\x01` \x8A\x01a\x02\x92V[`\x01\x92\x01\x91\x82\x01R\x83Qa\x03p\x81`\x02\x84\x01` \x88\x01a\x02\x92V[\x01`\x02\x01\x95\x94PPPPPV[\x7FNH{q\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0`\0R`A`\x04R`$`\0\xFD\xFE\xA1dsolcC\0\x08\x13\0\n"; 75 | /// The bytecode of the contract. 76 | pub static SEMVER_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( 77 | __BYTECODE, 78 | ); 79 | #[rustfmt::skip] 80 | const __DEPLOYED_BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`\x046\x10a\0+W`\x005`\xE0\x1C\x80cT\xFDMP\x14a\x000W[`\0\x80\xFD[a\08a\0NV[`@Qa\0E\x91\x90a\x02\xB6V[`@Q\x80\x91\x03\x90\xF3[``a\0y\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0a\0\xF1V[a\0\xA2\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0a\0\xF1V[a\0\xCB\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0a\0\xF1V[`@Q` \x01a\0\xDD\x93\x92\x91\x90a\x03\x07V[`@Q` \x81\x83\x03\x03\x81R\x90`@R\x90P\x90V[```\0a\0\xFE\x83a\x01\xAFV[`\x01\x01\x90P`\0\x81g\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x81\x11\x15a\x01\x1EWa\x01\x1Ea\x03}V[`@Q\x90\x80\x82R\x80`\x1F\x01`\x1F\x19\x16` \x01\x82\x01`@R\x80\x15a\x01HW` \x82\x01\x81\x806\x837\x01\x90P[P\x90P\x81\x81\x01` \x01[\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01\x7F0123456789abcdef\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0`\n\x86\x06\x1A\x81S`\n\x85\x04\x94P\x84a\x01RWP\x93\x92PPPV[`\0\x80z\x18O\x03\xE9?\xF9\xF4\xDA\xA7\x97\xEDn8\xEDd\xBFj\x1F\x01\0\0\0\0\0\0\0\0\x83\x10a\x01\xF8Wz\x18O\x03\xE9?\xF9\xF4\xDA\xA7\x97\xEDn8\xEDd\xBFj\x1F\x01\0\0\0\0\0\0\0\0\x83\x04\x92P`@\x01[m\x04\xEE-mA[\x85\xAC\xEF\x81\0\0\0\0\x83\x10a\x02$Wm\x04\xEE-mA[\x85\xAC\xEF\x81\0\0\0\0\x83\x04\x92P` \x01[f#\x86\xF2o\xC1\0\0\x83\x10a\x02BWf#\x86\xF2o\xC1\0\0\x83\x04\x92P`\x10\x01[c\x05\xF5\xE1\0\x83\x10a\x02ZWc\x05\xF5\xE1\0\x83\x04\x92P`\x08\x01[a'\x10\x83\x10a\x02nWa'\x10\x83\x04\x92P`\x04\x01[`d\x83\x10a\x02\x80W`d\x83\x04\x92P`\x02\x01[`\n\x83\x10a\x02\x8CW`\x01\x01[\x92\x91PPV[`\0[\x83\x81\x10\x15a\x02\xADW\x81\x81\x01Q\x83\x82\x01R` \x01a\x02\x95V[PP`\0\x91\x01RV[` \x81R`\0\x82Q\x80` \x84\x01Ra\x02\xD5\x81`@\x85\x01` \x87\x01a\x02\x92V[`\x1F\x01\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xE0\x16\x91\x90\x91\x01`@\x01\x92\x91PPV[`\0\x84Qa\x03\x19\x81\x84` \x89\x01a\x02\x92V[\x80\x83\x01\x90P\x7F.\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x80\x82R\x85Qa\x03U\x81`\x01\x85\x01` \x8A\x01a\x02\x92V[`\x01\x92\x01\x91\x82\x01R\x83Qa\x03p\x81`\x02\x84\x01` \x88\x01a\x02\x92V[\x01`\x02\x01\x95\x94PPPPPV[\x7FNH{q\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0`\0R`A`\x04R`$`\0\xFD\xFE\xA1dsolcC\0\x08\x13\0\n"; 81 | /// The deployed bytecode of the contract. 82 | pub static SEMVER_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( 83 | __DEPLOYED_BYTECODE, 84 | ); 85 | pub struct Semver(::ethers::contract::Contract); 86 | impl ::core::clone::Clone for Semver { 87 | fn clone(&self) -> Self { 88 | Self(::core::clone::Clone::clone(&self.0)) 89 | } 90 | } 91 | impl ::core::ops::Deref for Semver { 92 | type Target = ::ethers::contract::Contract; 93 | fn deref(&self) -> &Self::Target { 94 | &self.0 95 | } 96 | } 97 | impl ::core::ops::DerefMut for Semver { 98 | fn deref_mut(&mut self) -> &mut Self::Target { 99 | &mut self.0 100 | } 101 | } 102 | impl ::core::fmt::Debug for Semver { 103 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 104 | f.debug_tuple(::core::stringify!(Semver)).field(&self.address()).finish() 105 | } 106 | } 107 | impl Semver { 108 | /// Creates a new contract instance with the specified `ethers` client at 109 | /// `address`. The contract derefs to a `ethers::Contract` object. 110 | pub fn new>( 111 | address: T, 112 | client: ::std::sync::Arc, 113 | ) -> Self { 114 | Self( 115 | ::ethers::contract::Contract::new( 116 | address.into(), 117 | SEMVER_ABI.clone(), 118 | client, 119 | ), 120 | ) 121 | } 122 | /// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it. 123 | /// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction 124 | /// 125 | /// Notes: 126 | /// - If there are no constructor arguments, you should pass `()` as the argument. 127 | /// - The default poll duration is 7 seconds. 128 | /// - The default number of confirmations is 1 block. 129 | /// 130 | /// 131 | /// # Example 132 | /// 133 | /// Generate contract bindings with `abigen!` and deploy a new contract instance. 134 | /// 135 | /// *Note*: this requires a `bytecode` and `abi` object in the `greeter.json` artifact. 136 | /// 137 | /// ```ignore 138 | /// # async fn deploy(client: ::std::sync::Arc) { 139 | /// abigen!(Greeter, "../greeter.json"); 140 | /// 141 | /// let greeter_contract = Greeter::deploy(client, "Hello world!".to_string()).unwrap().send().await.unwrap(); 142 | /// let msg = greeter_contract.greet().call().await.unwrap(); 143 | /// # } 144 | /// ``` 145 | pub fn deploy( 146 | client: ::std::sync::Arc, 147 | constructor_args: T, 148 | ) -> ::core::result::Result< 149 | ::ethers::contract::builders::ContractDeployer, 150 | ::ethers::contract::ContractError, 151 | > { 152 | let factory = ::ethers::contract::ContractFactory::new( 153 | SEMVER_ABI.clone(), 154 | SEMVER_BYTECODE.clone().into(), 155 | client, 156 | ); 157 | let deployer = factory.deploy(constructor_args)?; 158 | let deployer = ::ethers::contract::ContractDeployer::new(deployer); 159 | Ok(deployer) 160 | } 161 | ///Calls the contract's `version` (0x54fd4d50) function 162 | pub fn version( 163 | &self, 164 | ) -> ::ethers::contract::builders::ContractCall { 165 | self.0 166 | .method_hash([84, 253, 77, 80], ()) 167 | .expect("method not found (this should never happen)") 168 | } 169 | } 170 | impl From<::ethers::contract::Contract> 171 | for Semver { 172 | fn from(contract: ::ethers::contract::Contract) -> Self { 173 | Self::new(contract.address(), contract.client()) 174 | } 175 | } 176 | ///Container type for all input parameters for the `version` function with signature `version()` and selector `0x54fd4d50` 177 | #[derive( 178 | Clone, 179 | ::ethers::contract::EthCall, 180 | ::ethers::contract::EthDisplay, 181 | Default, 182 | Debug, 183 | PartialEq, 184 | Eq, 185 | Hash 186 | )] 187 | #[ethcall(name = "version", abi = "version()")] 188 | pub struct VersionCall; 189 | ///Container type for all return fields from the `version` function with signature `version()` and selector `0x54fd4d50` 190 | #[derive( 191 | Clone, 192 | ::ethers::contract::EthAbiType, 193 | ::ethers::contract::EthAbiCodec, 194 | Default, 195 | Debug, 196 | PartialEq, 197 | Eq, 198 | Hash 199 | )] 200 | pub struct VersionReturn(pub ::std::string::String); 201 | } 202 | -------------------------------------------------------------------------------- /eas-contracts/src/ownable.rs: -------------------------------------------------------------------------------- 1 | pub use ownable::*; 2 | /// This module was auto-generated with ethers-rs Abigen. 3 | /// More information at: 4 | #[allow( 5 | clippy::enum_variant_names, 6 | clippy::too_many_arguments, 7 | clippy::upper_case_acronyms, 8 | clippy::type_complexity, 9 | dead_code, 10 | non_camel_case_types, 11 | )] 12 | pub mod ownable { 13 | #[allow(deprecated)] 14 | fn __abi() -> ::ethers::core::abi::Abi { 15 | ::ethers::core::abi::ethabi::Contract { 16 | constructor: ::core::option::Option::None, 17 | functions: ::core::convert::From::from([ 18 | ( 19 | ::std::borrow::ToOwned::to_owned("owner"), 20 | ::std::vec![ 21 | ::ethers::core::abi::ethabi::Function { 22 | name: ::std::borrow::ToOwned::to_owned("owner"), 23 | inputs: ::std::vec![], 24 | outputs: ::std::vec![ 25 | ::ethers::core::abi::ethabi::Param { 26 | name: ::std::string::String::new(), 27 | kind: ::ethers::core::abi::ethabi::ParamType::Address, 28 | internal_type: ::core::option::Option::Some( 29 | ::std::borrow::ToOwned::to_owned("address"), 30 | ), 31 | }, 32 | ], 33 | constant: ::core::option::Option::None, 34 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, 35 | }, 36 | ], 37 | ), 38 | ( 39 | ::std::borrow::ToOwned::to_owned("renounceOwnership"), 40 | ::std::vec![ 41 | ::ethers::core::abi::ethabi::Function { 42 | name: ::std::borrow::ToOwned::to_owned("renounceOwnership"), 43 | inputs: ::std::vec![], 44 | outputs: ::std::vec![], 45 | constant: ::core::option::Option::None, 46 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, 47 | }, 48 | ], 49 | ), 50 | ( 51 | ::std::borrow::ToOwned::to_owned("transferOwnership"), 52 | ::std::vec![ 53 | ::ethers::core::abi::ethabi::Function { 54 | name: ::std::borrow::ToOwned::to_owned("transferOwnership"), 55 | inputs: ::std::vec![ 56 | ::ethers::core::abi::ethabi::Param { 57 | name: ::std::borrow::ToOwned::to_owned("newOwner"), 58 | kind: ::ethers::core::abi::ethabi::ParamType::Address, 59 | internal_type: ::core::option::Option::Some( 60 | ::std::borrow::ToOwned::to_owned("address"), 61 | ), 62 | }, 63 | ], 64 | outputs: ::std::vec![], 65 | constant: ::core::option::Option::None, 66 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, 67 | }, 68 | ], 69 | ), 70 | ]), 71 | events: ::core::convert::From::from([ 72 | ( 73 | ::std::borrow::ToOwned::to_owned("OwnershipTransferred"), 74 | ::std::vec![ 75 | ::ethers::core::abi::ethabi::Event { 76 | name: ::std::borrow::ToOwned::to_owned( 77 | "OwnershipTransferred", 78 | ), 79 | inputs: ::std::vec![ 80 | ::ethers::core::abi::ethabi::EventParam { 81 | name: ::std::borrow::ToOwned::to_owned("previousOwner"), 82 | kind: ::ethers::core::abi::ethabi::ParamType::Address, 83 | indexed: true, 84 | }, 85 | ::ethers::core::abi::ethabi::EventParam { 86 | name: ::std::borrow::ToOwned::to_owned("newOwner"), 87 | kind: ::ethers::core::abi::ethabi::ParamType::Address, 88 | indexed: true, 89 | }, 90 | ], 91 | anonymous: false, 92 | }, 93 | ], 94 | ), 95 | ]), 96 | errors: ::std::collections::BTreeMap::new(), 97 | receive: false, 98 | fallback: false, 99 | } 100 | } 101 | ///The parsed JSON ABI of the contract. 102 | pub static OWNABLE_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( 103 | __abi, 104 | ); 105 | pub struct Ownable(::ethers::contract::Contract); 106 | impl ::core::clone::Clone for Ownable { 107 | fn clone(&self) -> Self { 108 | Self(::core::clone::Clone::clone(&self.0)) 109 | } 110 | } 111 | impl ::core::ops::Deref for Ownable { 112 | type Target = ::ethers::contract::Contract; 113 | fn deref(&self) -> &Self::Target { 114 | &self.0 115 | } 116 | } 117 | impl ::core::ops::DerefMut for Ownable { 118 | fn deref_mut(&mut self) -> &mut Self::Target { 119 | &mut self.0 120 | } 121 | } 122 | impl ::core::fmt::Debug for Ownable { 123 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 124 | f.debug_tuple(::core::stringify!(Ownable)).field(&self.address()).finish() 125 | } 126 | } 127 | impl Ownable { 128 | /// Creates a new contract instance with the specified `ethers` client at 129 | /// `address`. The contract derefs to a `ethers::Contract` object. 130 | pub fn new>( 131 | address: T, 132 | client: ::std::sync::Arc, 133 | ) -> Self { 134 | Self( 135 | ::ethers::contract::Contract::new( 136 | address.into(), 137 | OWNABLE_ABI.clone(), 138 | client, 139 | ), 140 | ) 141 | } 142 | ///Calls the contract's `owner` (0x8da5cb5b) function 143 | pub fn owner( 144 | &self, 145 | ) -> ::ethers::contract::builders::ContractCall< 146 | M, 147 | ::ethers::core::types::Address, 148 | > { 149 | self.0 150 | .method_hash([141, 165, 203, 91], ()) 151 | .expect("method not found (this should never happen)") 152 | } 153 | ///Calls the contract's `renounceOwnership` (0x715018a6) function 154 | pub fn renounce_ownership( 155 | &self, 156 | ) -> ::ethers::contract::builders::ContractCall { 157 | self.0 158 | .method_hash([113, 80, 24, 166], ()) 159 | .expect("method not found (this should never happen)") 160 | } 161 | ///Calls the contract's `transferOwnership` (0xf2fde38b) function 162 | pub fn transfer_ownership( 163 | &self, 164 | new_owner: ::ethers::core::types::Address, 165 | ) -> ::ethers::contract::builders::ContractCall { 166 | self.0 167 | .method_hash([242, 253, 227, 139], new_owner) 168 | .expect("method not found (this should never happen)") 169 | } 170 | ///Gets the contract's `OwnershipTransferred` event 171 | pub fn ownership_transferred_filter( 172 | &self, 173 | ) -> ::ethers::contract::builders::Event< 174 | ::std::sync::Arc, 175 | M, 176 | OwnershipTransferredFilter, 177 | > { 178 | self.0.event() 179 | } 180 | /// Returns an `Event` builder for all the events of this contract. 181 | pub fn events( 182 | &self, 183 | ) -> ::ethers::contract::builders::Event< 184 | ::std::sync::Arc, 185 | M, 186 | OwnershipTransferredFilter, 187 | > { 188 | self.0.event_with_filter(::core::default::Default::default()) 189 | } 190 | } 191 | impl From<::ethers::contract::Contract> 192 | for Ownable { 193 | fn from(contract: ::ethers::contract::Contract) -> Self { 194 | Self::new(contract.address(), contract.client()) 195 | } 196 | } 197 | #[derive( 198 | Clone, 199 | ::ethers::contract::EthEvent, 200 | ::ethers::contract::EthDisplay, 201 | Default, 202 | Debug, 203 | PartialEq, 204 | Eq, 205 | Hash 206 | )] 207 | #[ethevent( 208 | name = "OwnershipTransferred", 209 | abi = "OwnershipTransferred(address,address)" 210 | )] 211 | pub struct OwnershipTransferredFilter { 212 | #[ethevent(indexed)] 213 | pub previous_owner: ::ethers::core::types::Address, 214 | #[ethevent(indexed)] 215 | pub new_owner: ::ethers::core::types::Address, 216 | } 217 | ///Container type for all input parameters for the `owner` function with signature `owner()` and selector `0x8da5cb5b` 218 | #[derive( 219 | Clone, 220 | ::ethers::contract::EthCall, 221 | ::ethers::contract::EthDisplay, 222 | Default, 223 | Debug, 224 | PartialEq, 225 | Eq, 226 | Hash 227 | )] 228 | #[ethcall(name = "owner", abi = "owner()")] 229 | pub struct OwnerCall; 230 | ///Container type for all input parameters for the `renounceOwnership` function with signature `renounceOwnership()` and selector `0x715018a6` 231 | #[derive( 232 | Clone, 233 | ::ethers::contract::EthCall, 234 | ::ethers::contract::EthDisplay, 235 | Default, 236 | Debug, 237 | PartialEq, 238 | Eq, 239 | Hash 240 | )] 241 | #[ethcall(name = "renounceOwnership", abi = "renounceOwnership()")] 242 | pub struct RenounceOwnershipCall; 243 | ///Container type for all input parameters for the `transferOwnership` function with signature `transferOwnership(address)` and selector `0xf2fde38b` 244 | #[derive( 245 | Clone, 246 | ::ethers::contract::EthCall, 247 | ::ethers::contract::EthDisplay, 248 | Default, 249 | Debug, 250 | PartialEq, 251 | Eq, 252 | Hash 253 | )] 254 | #[ethcall(name = "transferOwnership", abi = "transferOwnership(address)")] 255 | pub struct TransferOwnershipCall { 256 | pub new_owner: ::ethers::core::types::Address, 257 | } 258 | ///Container type for all of the contract's call 259 | #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] 260 | pub enum OwnableCalls { 261 | Owner(OwnerCall), 262 | RenounceOwnership(RenounceOwnershipCall), 263 | TransferOwnership(TransferOwnershipCall), 264 | } 265 | impl ::ethers::core::abi::AbiDecode for OwnableCalls { 266 | fn decode( 267 | data: impl AsRef<[u8]>, 268 | ) -> ::core::result::Result { 269 | let data = data.as_ref(); 270 | if let Ok(decoded) 271 | = ::decode(data) { 272 | return Ok(Self::Owner(decoded)); 273 | } 274 | if let Ok(decoded) 275 | = ::decode( 276 | data, 277 | ) { 278 | return Ok(Self::RenounceOwnership(decoded)); 279 | } 280 | if let Ok(decoded) 281 | = ::decode( 282 | data, 283 | ) { 284 | return Ok(Self::TransferOwnership(decoded)); 285 | } 286 | Err(::ethers::core::abi::Error::InvalidData.into()) 287 | } 288 | } 289 | impl ::ethers::core::abi::AbiEncode for OwnableCalls { 290 | fn encode(self) -> Vec { 291 | match self { 292 | Self::Owner(element) => ::ethers::core::abi::AbiEncode::encode(element), 293 | Self::RenounceOwnership(element) => { 294 | ::ethers::core::abi::AbiEncode::encode(element) 295 | } 296 | Self::TransferOwnership(element) => { 297 | ::ethers::core::abi::AbiEncode::encode(element) 298 | } 299 | } 300 | } 301 | } 302 | impl ::core::fmt::Display for OwnableCalls { 303 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 304 | match self { 305 | Self::Owner(element) => ::core::fmt::Display::fmt(element, f), 306 | Self::RenounceOwnership(element) => ::core::fmt::Display::fmt(element, f), 307 | Self::TransferOwnership(element) => ::core::fmt::Display::fmt(element, f), 308 | } 309 | } 310 | } 311 | impl ::core::convert::From for OwnableCalls { 312 | fn from(value: OwnerCall) -> Self { 313 | Self::Owner(value) 314 | } 315 | } 316 | impl ::core::convert::From for OwnableCalls { 317 | fn from(value: RenounceOwnershipCall) -> Self { 318 | Self::RenounceOwnership(value) 319 | } 320 | } 321 | impl ::core::convert::From for OwnableCalls { 322 | fn from(value: TransferOwnershipCall) -> Self { 323 | Self::TransferOwnership(value) 324 | } 325 | } 326 | ///Container type for all return fields from the `owner` function with signature `owner()` and selector `0x8da5cb5b` 327 | #[derive( 328 | Clone, 329 | ::ethers::contract::EthAbiType, 330 | ::ethers::contract::EthAbiCodec, 331 | Default, 332 | Debug, 333 | PartialEq, 334 | Eq, 335 | Hash 336 | )] 337 | pub struct OwnerReturn(pub ::ethers::core::types::Address); 338 | } 339 | -------------------------------------------------------------------------------- /eas-contracts/src/i_schema_registry.rs: -------------------------------------------------------------------------------- 1 | pub use i_schema_registry::*; 2 | /// This module was auto-generated with ethers-rs Abigen. 3 | /// More information at: 4 | #[allow( 5 | clippy::enum_variant_names, 6 | clippy::too_many_arguments, 7 | clippy::upper_case_acronyms, 8 | clippy::type_complexity, 9 | dead_code, 10 | non_camel_case_types, 11 | )] 12 | pub mod i_schema_registry { 13 | pub use super::super::shared_types::*; 14 | #[allow(deprecated)] 15 | fn __abi() -> ::ethers::core::abi::Abi { 16 | ::ethers::core::abi::ethabi::Contract { 17 | constructor: ::core::option::Option::None, 18 | functions: ::core::convert::From::from([ 19 | ( 20 | ::std::borrow::ToOwned::to_owned("getSchema"), 21 | ::std::vec![ 22 | ::ethers::core::abi::ethabi::Function { 23 | name: ::std::borrow::ToOwned::to_owned("getSchema"), 24 | inputs: ::std::vec![ 25 | ::ethers::core::abi::ethabi::Param { 26 | name: ::std::borrow::ToOwned::to_owned("uid"), 27 | kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( 28 | 32usize, 29 | ), 30 | internal_type: ::core::option::Option::Some( 31 | ::std::borrow::ToOwned::to_owned("bytes32"), 32 | ), 33 | }, 34 | ], 35 | outputs: ::std::vec![ 36 | ::ethers::core::abi::ethabi::Param { 37 | name: ::std::string::String::new(), 38 | kind: ::ethers::core::abi::ethabi::ParamType::Tuple( 39 | ::std::vec![ 40 | ::ethers::core::abi::ethabi::ParamType::FixedBytes(32usize), 41 | ::ethers::core::abi::ethabi::ParamType::Address, 42 | ::ethers::core::abi::ethabi::ParamType::Bool, 43 | ::ethers::core::abi::ethabi::ParamType::String, 44 | ], 45 | ), 46 | internal_type: ::core::option::Option::Some( 47 | ::std::borrow::ToOwned::to_owned("struct SchemaRecord"), 48 | ), 49 | }, 50 | ], 51 | constant: ::core::option::Option::None, 52 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, 53 | }, 54 | ], 55 | ), 56 | ( 57 | ::std::borrow::ToOwned::to_owned("register"), 58 | ::std::vec![ 59 | ::ethers::core::abi::ethabi::Function { 60 | name: ::std::borrow::ToOwned::to_owned("register"), 61 | inputs: ::std::vec![ 62 | ::ethers::core::abi::ethabi::Param { 63 | name: ::std::borrow::ToOwned::to_owned("schema"), 64 | kind: ::ethers::core::abi::ethabi::ParamType::String, 65 | internal_type: ::core::option::Option::Some( 66 | ::std::borrow::ToOwned::to_owned("string"), 67 | ), 68 | }, 69 | ::ethers::core::abi::ethabi::Param { 70 | name: ::std::borrow::ToOwned::to_owned("resolver"), 71 | kind: ::ethers::core::abi::ethabi::ParamType::Address, 72 | internal_type: ::core::option::Option::Some( 73 | ::std::borrow::ToOwned::to_owned("contract ISchemaResolver"), 74 | ), 75 | }, 76 | ::ethers::core::abi::ethabi::Param { 77 | name: ::std::borrow::ToOwned::to_owned("revocable"), 78 | kind: ::ethers::core::abi::ethabi::ParamType::Bool, 79 | internal_type: ::core::option::Option::Some( 80 | ::std::borrow::ToOwned::to_owned("bool"), 81 | ), 82 | }, 83 | ], 84 | outputs: ::std::vec![ 85 | ::ethers::core::abi::ethabi::Param { 86 | name: ::std::string::String::new(), 87 | kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( 88 | 32usize, 89 | ), 90 | internal_type: ::core::option::Option::Some( 91 | ::std::borrow::ToOwned::to_owned("bytes32"), 92 | ), 93 | }, 94 | ], 95 | constant: ::core::option::Option::None, 96 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, 97 | }, 98 | ], 99 | ), 100 | ]), 101 | events: ::core::convert::From::from([ 102 | ( 103 | ::std::borrow::ToOwned::to_owned("Registered"), 104 | ::std::vec![ 105 | ::ethers::core::abi::ethabi::Event { 106 | name: ::std::borrow::ToOwned::to_owned("Registered"), 107 | inputs: ::std::vec![ 108 | ::ethers::core::abi::ethabi::EventParam { 109 | name: ::std::borrow::ToOwned::to_owned("uid"), 110 | kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( 111 | 32usize, 112 | ), 113 | indexed: true, 114 | }, 115 | ::ethers::core::abi::ethabi::EventParam { 116 | name: ::std::borrow::ToOwned::to_owned("registerer"), 117 | kind: ::ethers::core::abi::ethabi::ParamType::Address, 118 | indexed: false, 119 | }, 120 | ], 121 | anonymous: false, 122 | }, 123 | ], 124 | ), 125 | ]), 126 | errors: ::std::collections::BTreeMap::new(), 127 | receive: false, 128 | fallback: false, 129 | } 130 | } 131 | ///The parsed JSON ABI of the contract. 132 | pub static ISCHEMAREGISTRY_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( 133 | __abi, 134 | ); 135 | pub struct ISchemaRegistry(::ethers::contract::Contract); 136 | impl ::core::clone::Clone for ISchemaRegistry { 137 | fn clone(&self) -> Self { 138 | Self(::core::clone::Clone::clone(&self.0)) 139 | } 140 | } 141 | impl ::core::ops::Deref for ISchemaRegistry { 142 | type Target = ::ethers::contract::Contract; 143 | fn deref(&self) -> &Self::Target { 144 | &self.0 145 | } 146 | } 147 | impl ::core::ops::DerefMut for ISchemaRegistry { 148 | fn deref_mut(&mut self) -> &mut Self::Target { 149 | &mut self.0 150 | } 151 | } 152 | impl ::core::fmt::Debug for ISchemaRegistry { 153 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 154 | f.debug_tuple(::core::stringify!(ISchemaRegistry)) 155 | .field(&self.address()) 156 | .finish() 157 | } 158 | } 159 | impl ISchemaRegistry { 160 | /// Creates a new contract instance with the specified `ethers` client at 161 | /// `address`. The contract derefs to a `ethers::Contract` object. 162 | pub fn new>( 163 | address: T, 164 | client: ::std::sync::Arc, 165 | ) -> Self { 166 | Self( 167 | ::ethers::contract::Contract::new( 168 | address.into(), 169 | ISCHEMAREGISTRY_ABI.clone(), 170 | client, 171 | ), 172 | ) 173 | } 174 | ///Calls the contract's `getSchema` (0xa2ea7c6e) function 175 | pub fn get_schema( 176 | &self, 177 | uid: [u8; 32], 178 | ) -> ::ethers::contract::builders::ContractCall { 179 | self.0 180 | .method_hash([162, 234, 124, 110], uid) 181 | .expect("method not found (this should never happen)") 182 | } 183 | ///Calls the contract's `register` (0x60d7a278) function 184 | pub fn register( 185 | &self, 186 | schema: ::std::string::String, 187 | resolver: ::ethers::core::types::Address, 188 | revocable: bool, 189 | ) -> ::ethers::contract::builders::ContractCall { 190 | self.0 191 | .method_hash([96, 215, 162, 120], (schema, resolver, revocable)) 192 | .expect("method not found (this should never happen)") 193 | } 194 | ///Gets the contract's `Registered` event 195 | pub fn registered_filter( 196 | &self, 197 | ) -> ::ethers::contract::builders::Event< 198 | ::std::sync::Arc, 199 | M, 200 | RegisteredFilter, 201 | > { 202 | self.0.event() 203 | } 204 | /// Returns an `Event` builder for all the events of this contract. 205 | pub fn events( 206 | &self, 207 | ) -> ::ethers::contract::builders::Event< 208 | ::std::sync::Arc, 209 | M, 210 | RegisteredFilter, 211 | > { 212 | self.0.event_with_filter(::core::default::Default::default()) 213 | } 214 | } 215 | impl From<::ethers::contract::Contract> 216 | for ISchemaRegistry { 217 | fn from(contract: ::ethers::contract::Contract) -> Self { 218 | Self::new(contract.address(), contract.client()) 219 | } 220 | } 221 | #[derive( 222 | Clone, 223 | ::ethers::contract::EthEvent, 224 | ::ethers::contract::EthDisplay, 225 | Default, 226 | Debug, 227 | PartialEq, 228 | Eq, 229 | Hash 230 | )] 231 | #[ethevent(name = "Registered", abi = "Registered(bytes32,address)")] 232 | pub struct RegisteredFilter { 233 | #[ethevent(indexed)] 234 | pub uid: [u8; 32], 235 | pub registerer: ::ethers::core::types::Address, 236 | } 237 | ///Container type for all input parameters for the `getSchema` function with signature `getSchema(bytes32)` and selector `0xa2ea7c6e` 238 | #[derive( 239 | Clone, 240 | ::ethers::contract::EthCall, 241 | ::ethers::contract::EthDisplay, 242 | Default, 243 | Debug, 244 | PartialEq, 245 | Eq, 246 | Hash 247 | )] 248 | #[ethcall(name = "getSchema", abi = "getSchema(bytes32)")] 249 | pub struct GetSchemaCall { 250 | pub uid: [u8; 32], 251 | } 252 | ///Container type for all input parameters for the `register` function with signature `register(string,address,bool)` and selector `0x60d7a278` 253 | #[derive( 254 | Clone, 255 | ::ethers::contract::EthCall, 256 | ::ethers::contract::EthDisplay, 257 | Default, 258 | Debug, 259 | PartialEq, 260 | Eq, 261 | Hash 262 | )] 263 | #[ethcall(name = "register", abi = "register(string,address,bool)")] 264 | pub struct RegisterCall { 265 | pub schema: ::std::string::String, 266 | pub resolver: ::ethers::core::types::Address, 267 | pub revocable: bool, 268 | } 269 | ///Container type for all of the contract's call 270 | #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] 271 | pub enum ISchemaRegistryCalls { 272 | GetSchema(GetSchemaCall), 273 | Register(RegisterCall), 274 | } 275 | impl ::ethers::core::abi::AbiDecode for ISchemaRegistryCalls { 276 | fn decode( 277 | data: impl AsRef<[u8]>, 278 | ) -> ::core::result::Result { 279 | let data = data.as_ref(); 280 | if let Ok(decoded) 281 | = ::decode(data) { 282 | return Ok(Self::GetSchema(decoded)); 283 | } 284 | if let Ok(decoded) 285 | = ::decode(data) { 286 | return Ok(Self::Register(decoded)); 287 | } 288 | Err(::ethers::core::abi::Error::InvalidData.into()) 289 | } 290 | } 291 | impl ::ethers::core::abi::AbiEncode for ISchemaRegistryCalls { 292 | fn encode(self) -> Vec { 293 | match self { 294 | Self::GetSchema(element) => { 295 | ::ethers::core::abi::AbiEncode::encode(element) 296 | } 297 | Self::Register(element) => { 298 | ::ethers::core::abi::AbiEncode::encode(element) 299 | } 300 | } 301 | } 302 | } 303 | impl ::core::fmt::Display for ISchemaRegistryCalls { 304 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 305 | match self { 306 | Self::GetSchema(element) => ::core::fmt::Display::fmt(element, f), 307 | Self::Register(element) => ::core::fmt::Display::fmt(element, f), 308 | } 309 | } 310 | } 311 | impl ::core::convert::From for ISchemaRegistryCalls { 312 | fn from(value: GetSchemaCall) -> Self { 313 | Self::GetSchema(value) 314 | } 315 | } 316 | impl ::core::convert::From for ISchemaRegistryCalls { 317 | fn from(value: RegisterCall) -> Self { 318 | Self::Register(value) 319 | } 320 | } 321 | ///Container type for all return fields from the `getSchema` function with signature `getSchema(bytes32)` and selector `0xa2ea7c6e` 322 | #[derive( 323 | Clone, 324 | ::ethers::contract::EthAbiType, 325 | ::ethers::contract::EthAbiCodec, 326 | Default, 327 | Debug, 328 | PartialEq, 329 | Eq, 330 | Hash 331 | )] 332 | pub struct GetSchemaReturn(pub SchemaRecord); 333 | ///Container type for all return fields from the `register` function with signature `register(string,address,bool)` and selector `0x60d7a278` 334 | #[derive( 335 | Clone, 336 | ::ethers::contract::EthAbiType, 337 | ::ethers::contract::EthAbiCodec, 338 | Default, 339 | Debug, 340 | PartialEq, 341 | Eq, 342 | Hash 343 | )] 344 | pub struct RegisterReturn(pub [u8; 32]); 345 | } 346 | -------------------------------------------------------------------------------- /eas-contracts/src/ierc20_permit.rs: -------------------------------------------------------------------------------- 1 | pub use ierc20_permit::*; 2 | /// This module was auto-generated with ethers-rs Abigen. 3 | /// More information at: 4 | #[allow( 5 | clippy::enum_variant_names, 6 | clippy::too_many_arguments, 7 | clippy::upper_case_acronyms, 8 | clippy::type_complexity, 9 | dead_code, 10 | non_camel_case_types, 11 | )] 12 | pub mod ierc20_permit { 13 | #[allow(deprecated)] 14 | fn __abi() -> ::ethers::core::abi::Abi { 15 | ::ethers::core::abi::ethabi::Contract { 16 | constructor: ::core::option::Option::None, 17 | functions: ::core::convert::From::from([ 18 | ( 19 | ::std::borrow::ToOwned::to_owned("DOMAIN_SEPARATOR"), 20 | ::std::vec![ 21 | ::ethers::core::abi::ethabi::Function { 22 | name: ::std::borrow::ToOwned::to_owned("DOMAIN_SEPARATOR"), 23 | inputs: ::std::vec![], 24 | outputs: ::std::vec![ 25 | ::ethers::core::abi::ethabi::Param { 26 | name: ::std::string::String::new(), 27 | kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( 28 | 32usize, 29 | ), 30 | internal_type: ::core::option::Option::Some( 31 | ::std::borrow::ToOwned::to_owned("bytes32"), 32 | ), 33 | }, 34 | ], 35 | constant: ::core::option::Option::None, 36 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, 37 | }, 38 | ], 39 | ), 40 | ( 41 | ::std::borrow::ToOwned::to_owned("nonces"), 42 | ::std::vec![ 43 | ::ethers::core::abi::ethabi::Function { 44 | name: ::std::borrow::ToOwned::to_owned("nonces"), 45 | inputs: ::std::vec![ 46 | ::ethers::core::abi::ethabi::Param { 47 | name: ::std::borrow::ToOwned::to_owned("owner"), 48 | kind: ::ethers::core::abi::ethabi::ParamType::Address, 49 | internal_type: ::core::option::Option::Some( 50 | ::std::borrow::ToOwned::to_owned("address"), 51 | ), 52 | }, 53 | ], 54 | outputs: ::std::vec![ 55 | ::ethers::core::abi::ethabi::Param { 56 | name: ::std::string::String::new(), 57 | kind: ::ethers::core::abi::ethabi::ParamType::Uint( 58 | 256usize, 59 | ), 60 | internal_type: ::core::option::Option::Some( 61 | ::std::borrow::ToOwned::to_owned("uint256"), 62 | ), 63 | }, 64 | ], 65 | constant: ::core::option::Option::None, 66 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, 67 | }, 68 | ], 69 | ), 70 | ( 71 | ::std::borrow::ToOwned::to_owned("permit"), 72 | ::std::vec![ 73 | ::ethers::core::abi::ethabi::Function { 74 | name: ::std::borrow::ToOwned::to_owned("permit"), 75 | inputs: ::std::vec![ 76 | ::ethers::core::abi::ethabi::Param { 77 | name: ::std::borrow::ToOwned::to_owned("owner"), 78 | kind: ::ethers::core::abi::ethabi::ParamType::Address, 79 | internal_type: ::core::option::Option::Some( 80 | ::std::borrow::ToOwned::to_owned("address"), 81 | ), 82 | }, 83 | ::ethers::core::abi::ethabi::Param { 84 | name: ::std::borrow::ToOwned::to_owned("spender"), 85 | kind: ::ethers::core::abi::ethabi::ParamType::Address, 86 | internal_type: ::core::option::Option::Some( 87 | ::std::borrow::ToOwned::to_owned("address"), 88 | ), 89 | }, 90 | ::ethers::core::abi::ethabi::Param { 91 | name: ::std::borrow::ToOwned::to_owned("value"), 92 | kind: ::ethers::core::abi::ethabi::ParamType::Uint( 93 | 256usize, 94 | ), 95 | internal_type: ::core::option::Option::Some( 96 | ::std::borrow::ToOwned::to_owned("uint256"), 97 | ), 98 | }, 99 | ::ethers::core::abi::ethabi::Param { 100 | name: ::std::borrow::ToOwned::to_owned("deadline"), 101 | kind: ::ethers::core::abi::ethabi::ParamType::Uint( 102 | 256usize, 103 | ), 104 | internal_type: ::core::option::Option::Some( 105 | ::std::borrow::ToOwned::to_owned("uint256"), 106 | ), 107 | }, 108 | ::ethers::core::abi::ethabi::Param { 109 | name: ::std::borrow::ToOwned::to_owned("v"), 110 | kind: ::ethers::core::abi::ethabi::ParamType::Uint(8usize), 111 | internal_type: ::core::option::Option::Some( 112 | ::std::borrow::ToOwned::to_owned("uint8"), 113 | ), 114 | }, 115 | ::ethers::core::abi::ethabi::Param { 116 | name: ::std::borrow::ToOwned::to_owned("r"), 117 | kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( 118 | 32usize, 119 | ), 120 | internal_type: ::core::option::Option::Some( 121 | ::std::borrow::ToOwned::to_owned("bytes32"), 122 | ), 123 | }, 124 | ::ethers::core::abi::ethabi::Param { 125 | name: ::std::borrow::ToOwned::to_owned("s"), 126 | kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( 127 | 32usize, 128 | ), 129 | internal_type: ::core::option::Option::Some( 130 | ::std::borrow::ToOwned::to_owned("bytes32"), 131 | ), 132 | }, 133 | ], 134 | outputs: ::std::vec![], 135 | constant: ::core::option::Option::None, 136 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, 137 | }, 138 | ], 139 | ), 140 | ]), 141 | events: ::std::collections::BTreeMap::new(), 142 | errors: ::std::collections::BTreeMap::new(), 143 | receive: false, 144 | fallback: false, 145 | } 146 | } 147 | ///The parsed JSON ABI of the contract. 148 | pub static IERC20PERMIT_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( 149 | __abi, 150 | ); 151 | pub struct IERC20Permit(::ethers::contract::Contract); 152 | impl ::core::clone::Clone for IERC20Permit { 153 | fn clone(&self) -> Self { 154 | Self(::core::clone::Clone::clone(&self.0)) 155 | } 156 | } 157 | impl ::core::ops::Deref for IERC20Permit { 158 | type Target = ::ethers::contract::Contract; 159 | fn deref(&self) -> &Self::Target { 160 | &self.0 161 | } 162 | } 163 | impl ::core::ops::DerefMut for IERC20Permit { 164 | fn deref_mut(&mut self) -> &mut Self::Target { 165 | &mut self.0 166 | } 167 | } 168 | impl ::core::fmt::Debug for IERC20Permit { 169 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 170 | f.debug_tuple(::core::stringify!(IERC20Permit)) 171 | .field(&self.address()) 172 | .finish() 173 | } 174 | } 175 | impl IERC20Permit { 176 | /// Creates a new contract instance with the specified `ethers` client at 177 | /// `address`. The contract derefs to a `ethers::Contract` object. 178 | pub fn new>( 179 | address: T, 180 | client: ::std::sync::Arc, 181 | ) -> Self { 182 | Self( 183 | ::ethers::contract::Contract::new( 184 | address.into(), 185 | IERC20PERMIT_ABI.clone(), 186 | client, 187 | ), 188 | ) 189 | } 190 | ///Calls the contract's `DOMAIN_SEPARATOR` (0x3644e515) function 191 | pub fn domain_separator( 192 | &self, 193 | ) -> ::ethers::contract::builders::ContractCall { 194 | self.0 195 | .method_hash([54, 68, 229, 21], ()) 196 | .expect("method not found (this should never happen)") 197 | } 198 | ///Calls the contract's `nonces` (0x7ecebe00) function 199 | pub fn nonces( 200 | &self, 201 | owner: ::ethers::core::types::Address, 202 | ) -> ::ethers::contract::builders::ContractCall { 203 | self.0 204 | .method_hash([126, 206, 190, 0], owner) 205 | .expect("method not found (this should never happen)") 206 | } 207 | ///Calls the contract's `permit` (0xd505accf) function 208 | pub fn permit( 209 | &self, 210 | owner: ::ethers::core::types::Address, 211 | spender: ::ethers::core::types::Address, 212 | value: ::ethers::core::types::U256, 213 | deadline: ::ethers::core::types::U256, 214 | v: u8, 215 | r: [u8; 32], 216 | s: [u8; 32], 217 | ) -> ::ethers::contract::builders::ContractCall { 218 | self.0 219 | .method_hash( 220 | [213, 5, 172, 207], 221 | (owner, spender, value, deadline, v, r, s), 222 | ) 223 | .expect("method not found (this should never happen)") 224 | } 225 | } 226 | impl From<::ethers::contract::Contract> 227 | for IERC20Permit { 228 | fn from(contract: ::ethers::contract::Contract) -> Self { 229 | Self::new(contract.address(), contract.client()) 230 | } 231 | } 232 | ///Container type for all input parameters for the `DOMAIN_SEPARATOR` function with signature `DOMAIN_SEPARATOR()` and selector `0x3644e515` 233 | #[derive( 234 | Clone, 235 | ::ethers::contract::EthCall, 236 | ::ethers::contract::EthDisplay, 237 | Default, 238 | Debug, 239 | PartialEq, 240 | Eq, 241 | Hash 242 | )] 243 | #[ethcall(name = "DOMAIN_SEPARATOR", abi = "DOMAIN_SEPARATOR()")] 244 | pub struct DomainSeparatorCall; 245 | ///Container type for all input parameters for the `nonces` function with signature `nonces(address)` and selector `0x7ecebe00` 246 | #[derive( 247 | Clone, 248 | ::ethers::contract::EthCall, 249 | ::ethers::contract::EthDisplay, 250 | Default, 251 | Debug, 252 | PartialEq, 253 | Eq, 254 | Hash 255 | )] 256 | #[ethcall(name = "nonces", abi = "nonces(address)")] 257 | pub struct NoncesCall { 258 | pub owner: ::ethers::core::types::Address, 259 | } 260 | ///Container type for all input parameters for the `permit` function with signature `permit(address,address,uint256,uint256,uint8,bytes32,bytes32)` and selector `0xd505accf` 261 | #[derive( 262 | Clone, 263 | ::ethers::contract::EthCall, 264 | ::ethers::contract::EthDisplay, 265 | Default, 266 | Debug, 267 | PartialEq, 268 | Eq, 269 | Hash 270 | )] 271 | #[ethcall( 272 | name = "permit", 273 | abi = "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)" 274 | )] 275 | pub struct PermitCall { 276 | pub owner: ::ethers::core::types::Address, 277 | pub spender: ::ethers::core::types::Address, 278 | pub value: ::ethers::core::types::U256, 279 | pub deadline: ::ethers::core::types::U256, 280 | pub v: u8, 281 | pub r: [u8; 32], 282 | pub s: [u8; 32], 283 | } 284 | ///Container type for all of the contract's call 285 | #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] 286 | pub enum IERC20PermitCalls { 287 | DomainSeparator(DomainSeparatorCall), 288 | Nonces(NoncesCall), 289 | Permit(PermitCall), 290 | } 291 | impl ::ethers::core::abi::AbiDecode for IERC20PermitCalls { 292 | fn decode( 293 | data: impl AsRef<[u8]>, 294 | ) -> ::core::result::Result { 295 | let data = data.as_ref(); 296 | if let Ok(decoded) 297 | = ::decode(data) { 298 | return Ok(Self::DomainSeparator(decoded)); 299 | } 300 | if let Ok(decoded) 301 | = ::decode(data) { 302 | return Ok(Self::Nonces(decoded)); 303 | } 304 | if let Ok(decoded) 305 | = ::decode(data) { 306 | return Ok(Self::Permit(decoded)); 307 | } 308 | Err(::ethers::core::abi::Error::InvalidData.into()) 309 | } 310 | } 311 | impl ::ethers::core::abi::AbiEncode for IERC20PermitCalls { 312 | fn encode(self) -> Vec { 313 | match self { 314 | Self::DomainSeparator(element) => { 315 | ::ethers::core::abi::AbiEncode::encode(element) 316 | } 317 | Self::Nonces(element) => ::ethers::core::abi::AbiEncode::encode(element), 318 | Self::Permit(element) => ::ethers::core::abi::AbiEncode::encode(element), 319 | } 320 | } 321 | } 322 | impl ::core::fmt::Display for IERC20PermitCalls { 323 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 324 | match self { 325 | Self::DomainSeparator(element) => ::core::fmt::Display::fmt(element, f), 326 | Self::Nonces(element) => ::core::fmt::Display::fmt(element, f), 327 | Self::Permit(element) => ::core::fmt::Display::fmt(element, f), 328 | } 329 | } 330 | } 331 | impl ::core::convert::From for IERC20PermitCalls { 332 | fn from(value: DomainSeparatorCall) -> Self { 333 | Self::DomainSeparator(value) 334 | } 335 | } 336 | impl ::core::convert::From for IERC20PermitCalls { 337 | fn from(value: NoncesCall) -> Self { 338 | Self::Nonces(value) 339 | } 340 | } 341 | impl ::core::convert::From for IERC20PermitCalls { 342 | fn from(value: PermitCall) -> Self { 343 | Self::Permit(value) 344 | } 345 | } 346 | ///Container type for all return fields from the `DOMAIN_SEPARATOR` function with signature `DOMAIN_SEPARATOR()` and selector `0x3644e515` 347 | #[derive( 348 | Clone, 349 | ::ethers::contract::EthAbiType, 350 | ::ethers::contract::EthAbiCodec, 351 | Default, 352 | Debug, 353 | PartialEq, 354 | Eq, 355 | Hash 356 | )] 357 | pub struct DomainSeparatorReturn(pub [u8; 32]); 358 | ///Container type for all return fields from the `nonces` function with signature `nonces(address)` and selector `0x7ecebe00` 359 | #[derive( 360 | Clone, 361 | ::ethers::contract::EthAbiType, 362 | ::ethers::contract::EthAbiCodec, 363 | Default, 364 | Debug, 365 | PartialEq, 366 | Eq, 367 | Hash 368 | )] 369 | pub struct NoncesReturn(pub ::ethers::core::types::U256); 370 | } 371 | -------------------------------------------------------------------------------- /eas-contracts/src/eip712_verifier.rs: -------------------------------------------------------------------------------- 1 | pub use eip712_verifier::*; 2 | /// This module was auto-generated with ethers-rs Abigen. 3 | /// More information at: 4 | #[allow( 5 | clippy::enum_variant_names, 6 | clippy::too_many_arguments, 7 | clippy::upper_case_acronyms, 8 | clippy::type_complexity, 9 | dead_code, 10 | non_camel_case_types, 11 | )] 12 | pub mod eip712_verifier { 13 | #[allow(deprecated)] 14 | fn __abi() -> ::ethers::core::abi::Abi { 15 | ::ethers::core::abi::ethabi::Contract { 16 | constructor: ::core::option::Option::None, 17 | functions: ::core::convert::From::from([ 18 | ( 19 | ::std::borrow::ToOwned::to_owned("getAttestTypeHash"), 20 | ::std::vec![ 21 | ::ethers::core::abi::ethabi::Function { 22 | name: ::std::borrow::ToOwned::to_owned("getAttestTypeHash"), 23 | inputs: ::std::vec![], 24 | outputs: ::std::vec![ 25 | ::ethers::core::abi::ethabi::Param { 26 | name: ::std::string::String::new(), 27 | kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( 28 | 32usize, 29 | ), 30 | internal_type: ::core::option::Option::Some( 31 | ::std::borrow::ToOwned::to_owned("bytes32"), 32 | ), 33 | }, 34 | ], 35 | constant: ::core::option::Option::None, 36 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::Pure, 37 | }, 38 | ], 39 | ), 40 | ( 41 | ::std::borrow::ToOwned::to_owned("getDomainSeparator"), 42 | ::std::vec![ 43 | ::ethers::core::abi::ethabi::Function { 44 | name: ::std::borrow::ToOwned::to_owned("getDomainSeparator"), 45 | inputs: ::std::vec![], 46 | outputs: ::std::vec![ 47 | ::ethers::core::abi::ethabi::Param { 48 | name: ::std::string::String::new(), 49 | kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( 50 | 32usize, 51 | ), 52 | internal_type: ::core::option::Option::Some( 53 | ::std::borrow::ToOwned::to_owned("bytes32"), 54 | ), 55 | }, 56 | ], 57 | constant: ::core::option::Option::None, 58 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, 59 | }, 60 | ], 61 | ), 62 | ( 63 | ::std::borrow::ToOwned::to_owned("getName"), 64 | ::std::vec![ 65 | ::ethers::core::abi::ethabi::Function { 66 | name: ::std::borrow::ToOwned::to_owned("getName"), 67 | inputs: ::std::vec![], 68 | outputs: ::std::vec![ 69 | ::ethers::core::abi::ethabi::Param { 70 | name: ::std::string::String::new(), 71 | kind: ::ethers::core::abi::ethabi::ParamType::String, 72 | internal_type: ::core::option::Option::Some( 73 | ::std::borrow::ToOwned::to_owned("string"), 74 | ), 75 | }, 76 | ], 77 | constant: ::core::option::Option::None, 78 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, 79 | }, 80 | ], 81 | ), 82 | ( 83 | ::std::borrow::ToOwned::to_owned("getNonce"), 84 | ::std::vec![ 85 | ::ethers::core::abi::ethabi::Function { 86 | name: ::std::borrow::ToOwned::to_owned("getNonce"), 87 | inputs: ::std::vec![ 88 | ::ethers::core::abi::ethabi::Param { 89 | name: ::std::borrow::ToOwned::to_owned("account"), 90 | kind: ::ethers::core::abi::ethabi::ParamType::Address, 91 | internal_type: ::core::option::Option::Some( 92 | ::std::borrow::ToOwned::to_owned("address"), 93 | ), 94 | }, 95 | ], 96 | outputs: ::std::vec![ 97 | ::ethers::core::abi::ethabi::Param { 98 | name: ::std::string::String::new(), 99 | kind: ::ethers::core::abi::ethabi::ParamType::Uint( 100 | 256usize, 101 | ), 102 | internal_type: ::core::option::Option::Some( 103 | ::std::borrow::ToOwned::to_owned("uint256"), 104 | ), 105 | }, 106 | ], 107 | constant: ::core::option::Option::None, 108 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, 109 | }, 110 | ], 111 | ), 112 | ( 113 | ::std::borrow::ToOwned::to_owned("getRevokeTypeHash"), 114 | ::std::vec![ 115 | ::ethers::core::abi::ethabi::Function { 116 | name: ::std::borrow::ToOwned::to_owned("getRevokeTypeHash"), 117 | inputs: ::std::vec![], 118 | outputs: ::std::vec![ 119 | ::ethers::core::abi::ethabi::Param { 120 | name: ::std::string::String::new(), 121 | kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( 122 | 32usize, 123 | ), 124 | internal_type: ::core::option::Option::Some( 125 | ::std::borrow::ToOwned::to_owned("bytes32"), 126 | ), 127 | }, 128 | ], 129 | constant: ::core::option::Option::None, 130 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::Pure, 131 | }, 132 | ], 133 | ), 134 | ]), 135 | events: ::std::collections::BTreeMap::new(), 136 | errors: ::std::collections::BTreeMap::new(), 137 | receive: false, 138 | fallback: false, 139 | } 140 | } 141 | ///The parsed JSON ABI of the contract. 142 | pub static EIP712VERIFIER_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( 143 | __abi, 144 | ); 145 | pub struct EIP712Verifier(::ethers::contract::Contract); 146 | impl ::core::clone::Clone for EIP712Verifier { 147 | fn clone(&self) -> Self { 148 | Self(::core::clone::Clone::clone(&self.0)) 149 | } 150 | } 151 | impl ::core::ops::Deref for EIP712Verifier { 152 | type Target = ::ethers::contract::Contract; 153 | fn deref(&self) -> &Self::Target { 154 | &self.0 155 | } 156 | } 157 | impl ::core::ops::DerefMut for EIP712Verifier { 158 | fn deref_mut(&mut self) -> &mut Self::Target { 159 | &mut self.0 160 | } 161 | } 162 | impl ::core::fmt::Debug for EIP712Verifier { 163 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 164 | f.debug_tuple(::core::stringify!(EIP712Verifier)) 165 | .field(&self.address()) 166 | .finish() 167 | } 168 | } 169 | impl EIP712Verifier { 170 | /// Creates a new contract instance with the specified `ethers` client at 171 | /// `address`. The contract derefs to a `ethers::Contract` object. 172 | pub fn new>( 173 | address: T, 174 | client: ::std::sync::Arc, 175 | ) -> Self { 176 | Self( 177 | ::ethers::contract::Contract::new( 178 | address.into(), 179 | EIP712VERIFIER_ABI.clone(), 180 | client, 181 | ), 182 | ) 183 | } 184 | ///Calls the contract's `getAttestTypeHash` (0x12b11a17) function 185 | pub fn get_attest_type_hash( 186 | &self, 187 | ) -> ::ethers::contract::builders::ContractCall { 188 | self.0 189 | .method_hash([18, 177, 26, 23], ()) 190 | .expect("method not found (this should never happen)") 191 | } 192 | ///Calls the contract's `getDomainSeparator` (0xed24911d) function 193 | pub fn get_domain_separator( 194 | &self, 195 | ) -> ::ethers::contract::builders::ContractCall { 196 | self.0 197 | .method_hash([237, 36, 145, 29], ()) 198 | .expect("method not found (this should never happen)") 199 | } 200 | ///Calls the contract's `getName` (0x17d7de7c) function 201 | pub fn get_name( 202 | &self, 203 | ) -> ::ethers::contract::builders::ContractCall { 204 | self.0 205 | .method_hash([23, 215, 222, 124], ()) 206 | .expect("method not found (this should never happen)") 207 | } 208 | ///Calls the contract's `getNonce` (0x2d0335ab) function 209 | pub fn get_nonce( 210 | &self, 211 | account: ::ethers::core::types::Address, 212 | ) -> ::ethers::contract::builders::ContractCall { 213 | self.0 214 | .method_hash([45, 3, 53, 171], account) 215 | .expect("method not found (this should never happen)") 216 | } 217 | ///Calls the contract's `getRevokeTypeHash` (0xb83010d3) function 218 | pub fn get_revoke_type_hash( 219 | &self, 220 | ) -> ::ethers::contract::builders::ContractCall { 221 | self.0 222 | .method_hash([184, 48, 16, 211], ()) 223 | .expect("method not found (this should never happen)") 224 | } 225 | } 226 | impl From<::ethers::contract::Contract> 227 | for EIP712Verifier { 228 | fn from(contract: ::ethers::contract::Contract) -> Self { 229 | Self::new(contract.address(), contract.client()) 230 | } 231 | } 232 | ///Container type for all input parameters for the `getAttestTypeHash` function with signature `getAttestTypeHash()` and selector `0x12b11a17` 233 | #[derive( 234 | Clone, 235 | ::ethers::contract::EthCall, 236 | ::ethers::contract::EthDisplay, 237 | Default, 238 | Debug, 239 | PartialEq, 240 | Eq, 241 | Hash 242 | )] 243 | #[ethcall(name = "getAttestTypeHash", abi = "getAttestTypeHash()")] 244 | pub struct GetAttestTypeHashCall; 245 | ///Container type for all input parameters for the `getDomainSeparator` function with signature `getDomainSeparator()` and selector `0xed24911d` 246 | #[derive( 247 | Clone, 248 | ::ethers::contract::EthCall, 249 | ::ethers::contract::EthDisplay, 250 | Default, 251 | Debug, 252 | PartialEq, 253 | Eq, 254 | Hash 255 | )] 256 | #[ethcall(name = "getDomainSeparator", abi = "getDomainSeparator()")] 257 | pub struct GetDomainSeparatorCall; 258 | ///Container type for all input parameters for the `getName` function with signature `getName()` and selector `0x17d7de7c` 259 | #[derive( 260 | Clone, 261 | ::ethers::contract::EthCall, 262 | ::ethers::contract::EthDisplay, 263 | Default, 264 | Debug, 265 | PartialEq, 266 | Eq, 267 | Hash 268 | )] 269 | #[ethcall(name = "getName", abi = "getName()")] 270 | pub struct GetNameCall; 271 | ///Container type for all input parameters for the `getNonce` function with signature `getNonce(address)` and selector `0x2d0335ab` 272 | #[derive( 273 | Clone, 274 | ::ethers::contract::EthCall, 275 | ::ethers::contract::EthDisplay, 276 | Default, 277 | Debug, 278 | PartialEq, 279 | Eq, 280 | Hash 281 | )] 282 | #[ethcall(name = "getNonce", abi = "getNonce(address)")] 283 | pub struct GetNonceCall { 284 | pub account: ::ethers::core::types::Address, 285 | } 286 | ///Container type for all input parameters for the `getRevokeTypeHash` function with signature `getRevokeTypeHash()` and selector `0xb83010d3` 287 | #[derive( 288 | Clone, 289 | ::ethers::contract::EthCall, 290 | ::ethers::contract::EthDisplay, 291 | Default, 292 | Debug, 293 | PartialEq, 294 | Eq, 295 | Hash 296 | )] 297 | #[ethcall(name = "getRevokeTypeHash", abi = "getRevokeTypeHash()")] 298 | pub struct GetRevokeTypeHashCall; 299 | ///Container type for all of the contract's call 300 | #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] 301 | pub enum EIP712VerifierCalls { 302 | GetAttestTypeHash(GetAttestTypeHashCall), 303 | GetDomainSeparator(GetDomainSeparatorCall), 304 | GetName(GetNameCall), 305 | GetNonce(GetNonceCall), 306 | GetRevokeTypeHash(GetRevokeTypeHashCall), 307 | } 308 | impl ::ethers::core::abi::AbiDecode for EIP712VerifierCalls { 309 | fn decode( 310 | data: impl AsRef<[u8]>, 311 | ) -> ::core::result::Result { 312 | let data = data.as_ref(); 313 | if let Ok(decoded) 314 | = ::decode( 315 | data, 316 | ) { 317 | return Ok(Self::GetAttestTypeHash(decoded)); 318 | } 319 | if let Ok(decoded) 320 | = ::decode( 321 | data, 322 | ) { 323 | return Ok(Self::GetDomainSeparator(decoded)); 324 | } 325 | if let Ok(decoded) 326 | = ::decode(data) { 327 | return Ok(Self::GetName(decoded)); 328 | } 329 | if let Ok(decoded) 330 | = ::decode(data) { 331 | return Ok(Self::GetNonce(decoded)); 332 | } 333 | if let Ok(decoded) 334 | = ::decode( 335 | data, 336 | ) { 337 | return Ok(Self::GetRevokeTypeHash(decoded)); 338 | } 339 | Err(::ethers::core::abi::Error::InvalidData.into()) 340 | } 341 | } 342 | impl ::ethers::core::abi::AbiEncode for EIP712VerifierCalls { 343 | fn encode(self) -> Vec { 344 | match self { 345 | Self::GetAttestTypeHash(element) => { 346 | ::ethers::core::abi::AbiEncode::encode(element) 347 | } 348 | Self::GetDomainSeparator(element) => { 349 | ::ethers::core::abi::AbiEncode::encode(element) 350 | } 351 | Self::GetName(element) => ::ethers::core::abi::AbiEncode::encode(element), 352 | Self::GetNonce(element) => { 353 | ::ethers::core::abi::AbiEncode::encode(element) 354 | } 355 | Self::GetRevokeTypeHash(element) => { 356 | ::ethers::core::abi::AbiEncode::encode(element) 357 | } 358 | } 359 | } 360 | } 361 | impl ::core::fmt::Display for EIP712VerifierCalls { 362 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 363 | match self { 364 | Self::GetAttestTypeHash(element) => ::core::fmt::Display::fmt(element, f), 365 | Self::GetDomainSeparator(element) => { 366 | ::core::fmt::Display::fmt(element, f) 367 | } 368 | Self::GetName(element) => ::core::fmt::Display::fmt(element, f), 369 | Self::GetNonce(element) => ::core::fmt::Display::fmt(element, f), 370 | Self::GetRevokeTypeHash(element) => ::core::fmt::Display::fmt(element, f), 371 | } 372 | } 373 | } 374 | impl ::core::convert::From for EIP712VerifierCalls { 375 | fn from(value: GetAttestTypeHashCall) -> Self { 376 | Self::GetAttestTypeHash(value) 377 | } 378 | } 379 | impl ::core::convert::From for EIP712VerifierCalls { 380 | fn from(value: GetDomainSeparatorCall) -> Self { 381 | Self::GetDomainSeparator(value) 382 | } 383 | } 384 | impl ::core::convert::From for EIP712VerifierCalls { 385 | fn from(value: GetNameCall) -> Self { 386 | Self::GetName(value) 387 | } 388 | } 389 | impl ::core::convert::From for EIP712VerifierCalls { 390 | fn from(value: GetNonceCall) -> Self { 391 | Self::GetNonce(value) 392 | } 393 | } 394 | impl ::core::convert::From for EIP712VerifierCalls { 395 | fn from(value: GetRevokeTypeHashCall) -> Self { 396 | Self::GetRevokeTypeHash(value) 397 | } 398 | } 399 | ///Container type for all return fields from the `getAttestTypeHash` function with signature `getAttestTypeHash()` and selector `0x12b11a17` 400 | #[derive( 401 | Clone, 402 | ::ethers::contract::EthAbiType, 403 | ::ethers::contract::EthAbiCodec, 404 | Default, 405 | Debug, 406 | PartialEq, 407 | Eq, 408 | Hash 409 | )] 410 | pub struct GetAttestTypeHashReturn(pub [u8; 32]); 411 | ///Container type for all return fields from the `getDomainSeparator` function with signature `getDomainSeparator()` and selector `0xed24911d` 412 | #[derive( 413 | Clone, 414 | ::ethers::contract::EthAbiType, 415 | ::ethers::contract::EthAbiCodec, 416 | Default, 417 | Debug, 418 | PartialEq, 419 | Eq, 420 | Hash 421 | )] 422 | pub struct GetDomainSeparatorReturn(pub [u8; 32]); 423 | ///Container type for all return fields from the `getName` function with signature `getName()` and selector `0x17d7de7c` 424 | #[derive( 425 | Clone, 426 | ::ethers::contract::EthAbiType, 427 | ::ethers::contract::EthAbiCodec, 428 | Default, 429 | Debug, 430 | PartialEq, 431 | Eq, 432 | Hash 433 | )] 434 | pub struct GetNameReturn(pub ::std::string::String); 435 | ///Container type for all return fields from the `getNonce` function with signature `getNonce(address)` and selector `0x2d0335ab` 436 | #[derive( 437 | Clone, 438 | ::ethers::contract::EthAbiType, 439 | ::ethers::contract::EthAbiCodec, 440 | Default, 441 | Debug, 442 | PartialEq, 443 | Eq, 444 | Hash 445 | )] 446 | pub struct GetNonceReturn(pub ::ethers::core::types::U256); 447 | ///Container type for all return fields from the `getRevokeTypeHash` function with signature `getRevokeTypeHash()` and selector `0xb83010d3` 448 | #[derive( 449 | Clone, 450 | ::ethers::contract::EthAbiType, 451 | ::ethers::contract::EthAbiCodec, 452 | Default, 453 | Debug, 454 | PartialEq, 455 | Eq, 456 | Hash 457 | )] 458 | pub struct GetRevokeTypeHashReturn(pub [u8; 32]); 459 | } 460 | -------------------------------------------------------------------------------- /eas-contracts/src/i_schema_resolver.rs: -------------------------------------------------------------------------------- 1 | pub use i_schema_resolver::*; 2 | /// This module was auto-generated with ethers-rs Abigen. 3 | /// More information at: 4 | #[allow( 5 | clippy::enum_variant_names, 6 | clippy::too_many_arguments, 7 | clippy::upper_case_acronyms, 8 | clippy::type_complexity, 9 | dead_code, 10 | non_camel_case_types, 11 | )] 12 | pub mod i_schema_resolver { 13 | pub use super::super::shared_types::*; 14 | #[allow(deprecated)] 15 | fn __abi() -> ::ethers::core::abi::Abi { 16 | ::ethers::core::abi::ethabi::Contract { 17 | constructor: ::core::option::Option::None, 18 | functions: ::core::convert::From::from([ 19 | ( 20 | ::std::borrow::ToOwned::to_owned("attest"), 21 | ::std::vec![ 22 | ::ethers::core::abi::ethabi::Function { 23 | name: ::std::borrow::ToOwned::to_owned("attest"), 24 | inputs: ::std::vec![ 25 | ::ethers::core::abi::ethabi::Param { 26 | name: ::std::borrow::ToOwned::to_owned("attestation"), 27 | kind: ::ethers::core::abi::ethabi::ParamType::Tuple( 28 | ::std::vec![ 29 | ::ethers::core::abi::ethabi::ParamType::FixedBytes(32usize), 30 | ::ethers::core::abi::ethabi::ParamType::FixedBytes(32usize), 31 | ::ethers::core::abi::ethabi::ParamType::Uint(64usize), 32 | ::ethers::core::abi::ethabi::ParamType::Uint(64usize), 33 | ::ethers::core::abi::ethabi::ParamType::Uint(64usize), 34 | ::ethers::core::abi::ethabi::ParamType::FixedBytes(32usize), 35 | ::ethers::core::abi::ethabi::ParamType::Address, 36 | ::ethers::core::abi::ethabi::ParamType::Address, 37 | ::ethers::core::abi::ethabi::ParamType::Bool, 38 | ::ethers::core::abi::ethabi::ParamType::Bytes, 39 | ], 40 | ), 41 | internal_type: ::core::option::Option::Some( 42 | ::std::borrow::ToOwned::to_owned("struct Attestation"), 43 | ), 44 | }, 45 | ], 46 | outputs: ::std::vec![ 47 | ::ethers::core::abi::ethabi::Param { 48 | name: ::std::string::String::new(), 49 | kind: ::ethers::core::abi::ethabi::ParamType::Bool, 50 | internal_type: ::core::option::Option::Some( 51 | ::std::borrow::ToOwned::to_owned("bool"), 52 | ), 53 | }, 54 | ], 55 | constant: ::core::option::Option::None, 56 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::Payable, 57 | }, 58 | ], 59 | ), 60 | ( 61 | ::std::borrow::ToOwned::to_owned("isPayable"), 62 | ::std::vec![ 63 | ::ethers::core::abi::ethabi::Function { 64 | name: ::std::borrow::ToOwned::to_owned("isPayable"), 65 | inputs: ::std::vec![], 66 | outputs: ::std::vec![ 67 | ::ethers::core::abi::ethabi::Param { 68 | name: ::std::string::String::new(), 69 | kind: ::ethers::core::abi::ethabi::ParamType::Bool, 70 | internal_type: ::core::option::Option::Some( 71 | ::std::borrow::ToOwned::to_owned("bool"), 72 | ), 73 | }, 74 | ], 75 | constant: ::core::option::Option::None, 76 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::Pure, 77 | }, 78 | ], 79 | ), 80 | ( 81 | ::std::borrow::ToOwned::to_owned("multiAttest"), 82 | ::std::vec![ 83 | ::ethers::core::abi::ethabi::Function { 84 | name: ::std::borrow::ToOwned::to_owned("multiAttest"), 85 | inputs: ::std::vec![ 86 | ::ethers::core::abi::ethabi::Param { 87 | name: ::std::borrow::ToOwned::to_owned("attestations"), 88 | kind: ::ethers::core::abi::ethabi::ParamType::Array( 89 | ::std::boxed::Box::new( 90 | ::ethers::core::abi::ethabi::ParamType::Tuple( 91 | ::std::vec![ 92 | ::ethers::core::abi::ethabi::ParamType::FixedBytes(32usize), 93 | ::ethers::core::abi::ethabi::ParamType::FixedBytes(32usize), 94 | ::ethers::core::abi::ethabi::ParamType::Uint(64usize), 95 | ::ethers::core::abi::ethabi::ParamType::Uint(64usize), 96 | ::ethers::core::abi::ethabi::ParamType::Uint(64usize), 97 | ::ethers::core::abi::ethabi::ParamType::FixedBytes(32usize), 98 | ::ethers::core::abi::ethabi::ParamType::Address, 99 | ::ethers::core::abi::ethabi::ParamType::Address, 100 | ::ethers::core::abi::ethabi::ParamType::Bool, 101 | ::ethers::core::abi::ethabi::ParamType::Bytes, 102 | ], 103 | ), 104 | ), 105 | ), 106 | internal_type: ::core::option::Option::Some( 107 | ::std::borrow::ToOwned::to_owned("struct Attestation[]"), 108 | ), 109 | }, 110 | ::ethers::core::abi::ethabi::Param { 111 | name: ::std::borrow::ToOwned::to_owned("values"), 112 | kind: ::ethers::core::abi::ethabi::ParamType::Array( 113 | ::std::boxed::Box::new( 114 | ::ethers::core::abi::ethabi::ParamType::Uint(256usize), 115 | ), 116 | ), 117 | internal_type: ::core::option::Option::Some( 118 | ::std::borrow::ToOwned::to_owned("uint256[]"), 119 | ), 120 | }, 121 | ], 122 | outputs: ::std::vec![ 123 | ::ethers::core::abi::ethabi::Param { 124 | name: ::std::string::String::new(), 125 | kind: ::ethers::core::abi::ethabi::ParamType::Bool, 126 | internal_type: ::core::option::Option::Some( 127 | ::std::borrow::ToOwned::to_owned("bool"), 128 | ), 129 | }, 130 | ], 131 | constant: ::core::option::Option::None, 132 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::Payable, 133 | }, 134 | ], 135 | ), 136 | ( 137 | ::std::borrow::ToOwned::to_owned("multiRevoke"), 138 | ::std::vec![ 139 | ::ethers::core::abi::ethabi::Function { 140 | name: ::std::borrow::ToOwned::to_owned("multiRevoke"), 141 | inputs: ::std::vec![ 142 | ::ethers::core::abi::ethabi::Param { 143 | name: ::std::borrow::ToOwned::to_owned("attestations"), 144 | kind: ::ethers::core::abi::ethabi::ParamType::Array( 145 | ::std::boxed::Box::new( 146 | ::ethers::core::abi::ethabi::ParamType::Tuple( 147 | ::std::vec![ 148 | ::ethers::core::abi::ethabi::ParamType::FixedBytes(32usize), 149 | ::ethers::core::abi::ethabi::ParamType::FixedBytes(32usize), 150 | ::ethers::core::abi::ethabi::ParamType::Uint(64usize), 151 | ::ethers::core::abi::ethabi::ParamType::Uint(64usize), 152 | ::ethers::core::abi::ethabi::ParamType::Uint(64usize), 153 | ::ethers::core::abi::ethabi::ParamType::FixedBytes(32usize), 154 | ::ethers::core::abi::ethabi::ParamType::Address, 155 | ::ethers::core::abi::ethabi::ParamType::Address, 156 | ::ethers::core::abi::ethabi::ParamType::Bool, 157 | ::ethers::core::abi::ethabi::ParamType::Bytes, 158 | ], 159 | ), 160 | ), 161 | ), 162 | internal_type: ::core::option::Option::Some( 163 | ::std::borrow::ToOwned::to_owned("struct Attestation[]"), 164 | ), 165 | }, 166 | ::ethers::core::abi::ethabi::Param { 167 | name: ::std::borrow::ToOwned::to_owned("values"), 168 | kind: ::ethers::core::abi::ethabi::ParamType::Array( 169 | ::std::boxed::Box::new( 170 | ::ethers::core::abi::ethabi::ParamType::Uint(256usize), 171 | ), 172 | ), 173 | internal_type: ::core::option::Option::Some( 174 | ::std::borrow::ToOwned::to_owned("uint256[]"), 175 | ), 176 | }, 177 | ], 178 | outputs: ::std::vec![ 179 | ::ethers::core::abi::ethabi::Param { 180 | name: ::std::string::String::new(), 181 | kind: ::ethers::core::abi::ethabi::ParamType::Bool, 182 | internal_type: ::core::option::Option::Some( 183 | ::std::borrow::ToOwned::to_owned("bool"), 184 | ), 185 | }, 186 | ], 187 | constant: ::core::option::Option::None, 188 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::Payable, 189 | }, 190 | ], 191 | ), 192 | ( 193 | ::std::borrow::ToOwned::to_owned("revoke"), 194 | ::std::vec![ 195 | ::ethers::core::abi::ethabi::Function { 196 | name: ::std::borrow::ToOwned::to_owned("revoke"), 197 | inputs: ::std::vec![ 198 | ::ethers::core::abi::ethabi::Param { 199 | name: ::std::borrow::ToOwned::to_owned("attestation"), 200 | kind: ::ethers::core::abi::ethabi::ParamType::Tuple( 201 | ::std::vec![ 202 | ::ethers::core::abi::ethabi::ParamType::FixedBytes(32usize), 203 | ::ethers::core::abi::ethabi::ParamType::FixedBytes(32usize), 204 | ::ethers::core::abi::ethabi::ParamType::Uint(64usize), 205 | ::ethers::core::abi::ethabi::ParamType::Uint(64usize), 206 | ::ethers::core::abi::ethabi::ParamType::Uint(64usize), 207 | ::ethers::core::abi::ethabi::ParamType::FixedBytes(32usize), 208 | ::ethers::core::abi::ethabi::ParamType::Address, 209 | ::ethers::core::abi::ethabi::ParamType::Address, 210 | ::ethers::core::abi::ethabi::ParamType::Bool, 211 | ::ethers::core::abi::ethabi::ParamType::Bytes, 212 | ], 213 | ), 214 | internal_type: ::core::option::Option::Some( 215 | ::std::borrow::ToOwned::to_owned("struct Attestation"), 216 | ), 217 | }, 218 | ], 219 | outputs: ::std::vec![ 220 | ::ethers::core::abi::ethabi::Param { 221 | name: ::std::string::String::new(), 222 | kind: ::ethers::core::abi::ethabi::ParamType::Bool, 223 | internal_type: ::core::option::Option::Some( 224 | ::std::borrow::ToOwned::to_owned("bool"), 225 | ), 226 | }, 227 | ], 228 | constant: ::core::option::Option::None, 229 | state_mutability: ::ethers::core::abi::ethabi::StateMutability::Payable, 230 | }, 231 | ], 232 | ), 233 | ]), 234 | events: ::std::collections::BTreeMap::new(), 235 | errors: ::std::collections::BTreeMap::new(), 236 | receive: false, 237 | fallback: false, 238 | } 239 | } 240 | ///The parsed JSON ABI of the contract. 241 | pub static ISCHEMARESOLVER_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( 242 | __abi, 243 | ); 244 | pub struct ISchemaResolver(::ethers::contract::Contract); 245 | impl ::core::clone::Clone for ISchemaResolver { 246 | fn clone(&self) -> Self { 247 | Self(::core::clone::Clone::clone(&self.0)) 248 | } 249 | } 250 | impl ::core::ops::Deref for ISchemaResolver { 251 | type Target = ::ethers::contract::Contract; 252 | fn deref(&self) -> &Self::Target { 253 | &self.0 254 | } 255 | } 256 | impl ::core::ops::DerefMut for ISchemaResolver { 257 | fn deref_mut(&mut self) -> &mut Self::Target { 258 | &mut self.0 259 | } 260 | } 261 | impl ::core::fmt::Debug for ISchemaResolver { 262 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 263 | f.debug_tuple(::core::stringify!(ISchemaResolver)) 264 | .field(&self.address()) 265 | .finish() 266 | } 267 | } 268 | impl ISchemaResolver { 269 | /// Creates a new contract instance with the specified `ethers` client at 270 | /// `address`. The contract derefs to a `ethers::Contract` object. 271 | pub fn new>( 272 | address: T, 273 | client: ::std::sync::Arc, 274 | ) -> Self { 275 | Self( 276 | ::ethers::contract::Contract::new( 277 | address.into(), 278 | ISCHEMARESOLVER_ABI.clone(), 279 | client, 280 | ), 281 | ) 282 | } 283 | ///Calls the contract's `attest` (0xe60c3505) function 284 | pub fn attest( 285 | &self, 286 | attestation: Attestation, 287 | ) -> ::ethers::contract::builders::ContractCall { 288 | self.0 289 | .method_hash([230, 12, 53, 5], (attestation,)) 290 | .expect("method not found (this should never happen)") 291 | } 292 | ///Calls the contract's `isPayable` (0xce46e046) function 293 | pub fn is_payable(&self) -> ::ethers::contract::builders::ContractCall { 294 | self.0 295 | .method_hash([206, 70, 224, 70], ()) 296 | .expect("method not found (this should never happen)") 297 | } 298 | ///Calls the contract's `multiAttest` (0x91db0b7e) function 299 | pub fn multi_attest( 300 | &self, 301 | attestations: ::std::vec::Vec, 302 | values: ::std::vec::Vec<::ethers::core::types::U256>, 303 | ) -> ::ethers::contract::builders::ContractCall { 304 | self.0 305 | .method_hash([145, 219, 11, 126], (attestations, values)) 306 | .expect("method not found (this should never happen)") 307 | } 308 | ///Calls the contract's `multiRevoke` (0x88e5b2d9) function 309 | pub fn multi_revoke( 310 | &self, 311 | attestations: ::std::vec::Vec, 312 | values: ::std::vec::Vec<::ethers::core::types::U256>, 313 | ) -> ::ethers::contract::builders::ContractCall { 314 | self.0 315 | .method_hash([136, 229, 178, 217], (attestations, values)) 316 | .expect("method not found (this should never happen)") 317 | } 318 | ///Calls the contract's `revoke` (0xe49617e1) function 319 | pub fn revoke( 320 | &self, 321 | attestation: Attestation, 322 | ) -> ::ethers::contract::builders::ContractCall { 323 | self.0 324 | .method_hash([228, 150, 23, 225], (attestation,)) 325 | .expect("method not found (this should never happen)") 326 | } 327 | } 328 | impl From<::ethers::contract::Contract> 329 | for ISchemaResolver { 330 | fn from(contract: ::ethers::contract::Contract) -> Self { 331 | Self::new(contract.address(), contract.client()) 332 | } 333 | } 334 | ///Container type for all input parameters for the `attest` function with signature `attest((bytes32,bytes32,uint64,uint64,uint64,bytes32,address,address,bool,bytes))` and selector `0xe60c3505` 335 | #[derive( 336 | Clone, 337 | ::ethers::contract::EthCall, 338 | ::ethers::contract::EthDisplay, 339 | Default, 340 | Debug, 341 | PartialEq, 342 | Eq, 343 | Hash 344 | )] 345 | #[ethcall( 346 | name = "attest", 347 | abi = "attest((bytes32,bytes32,uint64,uint64,uint64,bytes32,address,address,bool,bytes))" 348 | )] 349 | pub struct AttestCall { 350 | pub attestation: Attestation, 351 | } 352 | ///Container type for all input parameters for the `isPayable` function with signature `isPayable()` and selector `0xce46e046` 353 | #[derive( 354 | Clone, 355 | ::ethers::contract::EthCall, 356 | ::ethers::contract::EthDisplay, 357 | Default, 358 | Debug, 359 | PartialEq, 360 | Eq, 361 | Hash 362 | )] 363 | #[ethcall(name = "isPayable", abi = "isPayable()")] 364 | pub struct IsPayableCall; 365 | ///Container type for all input parameters for the `multiAttest` function with signature `multiAttest((bytes32,bytes32,uint64,uint64,uint64,bytes32,address,address,bool,bytes)[],uint256[])` and selector `0x91db0b7e` 366 | #[derive( 367 | Clone, 368 | ::ethers::contract::EthCall, 369 | ::ethers::contract::EthDisplay, 370 | Default, 371 | Debug, 372 | PartialEq, 373 | Eq, 374 | Hash 375 | )] 376 | #[ethcall( 377 | name = "multiAttest", 378 | abi = "multiAttest((bytes32,bytes32,uint64,uint64,uint64,bytes32,address,address,bool,bytes)[],uint256[])" 379 | )] 380 | pub struct MultiAttestCall { 381 | pub attestations: ::std::vec::Vec, 382 | pub values: ::std::vec::Vec<::ethers::core::types::U256>, 383 | } 384 | ///Container type for all input parameters for the `multiRevoke` function with signature `multiRevoke((bytes32,bytes32,uint64,uint64,uint64,bytes32,address,address,bool,bytes)[],uint256[])` and selector `0x88e5b2d9` 385 | #[derive( 386 | Clone, 387 | ::ethers::contract::EthCall, 388 | ::ethers::contract::EthDisplay, 389 | Default, 390 | Debug, 391 | PartialEq, 392 | Eq, 393 | Hash 394 | )] 395 | #[ethcall( 396 | name = "multiRevoke", 397 | abi = "multiRevoke((bytes32,bytes32,uint64,uint64,uint64,bytes32,address,address,bool,bytes)[],uint256[])" 398 | )] 399 | pub struct MultiRevokeCall { 400 | pub attestations: ::std::vec::Vec, 401 | pub values: ::std::vec::Vec<::ethers::core::types::U256>, 402 | } 403 | ///Container type for all input parameters for the `revoke` function with signature `revoke((bytes32,bytes32,uint64,uint64,uint64,bytes32,address,address,bool,bytes))` and selector `0xe49617e1` 404 | #[derive( 405 | Clone, 406 | ::ethers::contract::EthCall, 407 | ::ethers::contract::EthDisplay, 408 | Default, 409 | Debug, 410 | PartialEq, 411 | Eq, 412 | Hash 413 | )] 414 | #[ethcall( 415 | name = "revoke", 416 | abi = "revoke((bytes32,bytes32,uint64,uint64,uint64,bytes32,address,address,bool,bytes))" 417 | )] 418 | pub struct RevokeCall { 419 | pub attestation: Attestation, 420 | } 421 | ///Container type for all of the contract's call 422 | #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] 423 | pub enum ISchemaResolverCalls { 424 | Attest(AttestCall), 425 | IsPayable(IsPayableCall), 426 | MultiAttest(MultiAttestCall), 427 | MultiRevoke(MultiRevokeCall), 428 | Revoke(RevokeCall), 429 | } 430 | impl ::ethers::core::abi::AbiDecode for ISchemaResolverCalls { 431 | fn decode( 432 | data: impl AsRef<[u8]>, 433 | ) -> ::core::result::Result { 434 | let data = data.as_ref(); 435 | if let Ok(decoded) 436 | = ::decode(data) { 437 | return Ok(Self::Attest(decoded)); 438 | } 439 | if let Ok(decoded) 440 | = ::decode(data) { 441 | return Ok(Self::IsPayable(decoded)); 442 | } 443 | if let Ok(decoded) 444 | = ::decode(data) { 445 | return Ok(Self::MultiAttest(decoded)); 446 | } 447 | if let Ok(decoded) 448 | = ::decode(data) { 449 | return Ok(Self::MultiRevoke(decoded)); 450 | } 451 | if let Ok(decoded) 452 | = ::decode(data) { 453 | return Ok(Self::Revoke(decoded)); 454 | } 455 | Err(::ethers::core::abi::Error::InvalidData.into()) 456 | } 457 | } 458 | impl ::ethers::core::abi::AbiEncode for ISchemaResolverCalls { 459 | fn encode(self) -> Vec { 460 | match self { 461 | Self::Attest(element) => ::ethers::core::abi::AbiEncode::encode(element), 462 | Self::IsPayable(element) => { 463 | ::ethers::core::abi::AbiEncode::encode(element) 464 | } 465 | Self::MultiAttest(element) => { 466 | ::ethers::core::abi::AbiEncode::encode(element) 467 | } 468 | Self::MultiRevoke(element) => { 469 | ::ethers::core::abi::AbiEncode::encode(element) 470 | } 471 | Self::Revoke(element) => ::ethers::core::abi::AbiEncode::encode(element), 472 | } 473 | } 474 | } 475 | impl ::core::fmt::Display for ISchemaResolverCalls { 476 | fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { 477 | match self { 478 | Self::Attest(element) => ::core::fmt::Display::fmt(element, f), 479 | Self::IsPayable(element) => ::core::fmt::Display::fmt(element, f), 480 | Self::MultiAttest(element) => ::core::fmt::Display::fmt(element, f), 481 | Self::MultiRevoke(element) => ::core::fmt::Display::fmt(element, f), 482 | Self::Revoke(element) => ::core::fmt::Display::fmt(element, f), 483 | } 484 | } 485 | } 486 | impl ::core::convert::From for ISchemaResolverCalls { 487 | fn from(value: AttestCall) -> Self { 488 | Self::Attest(value) 489 | } 490 | } 491 | impl ::core::convert::From for ISchemaResolverCalls { 492 | fn from(value: IsPayableCall) -> Self { 493 | Self::IsPayable(value) 494 | } 495 | } 496 | impl ::core::convert::From for ISchemaResolverCalls { 497 | fn from(value: MultiAttestCall) -> Self { 498 | Self::MultiAttest(value) 499 | } 500 | } 501 | impl ::core::convert::From for ISchemaResolverCalls { 502 | fn from(value: MultiRevokeCall) -> Self { 503 | Self::MultiRevoke(value) 504 | } 505 | } 506 | impl ::core::convert::From for ISchemaResolverCalls { 507 | fn from(value: RevokeCall) -> Self { 508 | Self::Revoke(value) 509 | } 510 | } 511 | ///Container type for all return fields from the `attest` function with signature `attest((bytes32,bytes32,uint64,uint64,uint64,bytes32,address,address,bool,bytes))` and selector `0xe60c3505` 512 | #[derive( 513 | Clone, 514 | ::ethers::contract::EthAbiType, 515 | ::ethers::contract::EthAbiCodec, 516 | Default, 517 | Debug, 518 | PartialEq, 519 | Eq, 520 | Hash 521 | )] 522 | pub struct AttestReturn(pub bool); 523 | ///Container type for all return fields from the `isPayable` function with signature `isPayable()` and selector `0xce46e046` 524 | #[derive( 525 | Clone, 526 | ::ethers::contract::EthAbiType, 527 | ::ethers::contract::EthAbiCodec, 528 | Default, 529 | Debug, 530 | PartialEq, 531 | Eq, 532 | Hash 533 | )] 534 | pub struct IsPayableReturn(pub bool); 535 | ///Container type for all return fields from the `multiAttest` function with signature `multiAttest((bytes32,bytes32,uint64,uint64,uint64,bytes32,address,address,bool,bytes)[],uint256[])` and selector `0x91db0b7e` 536 | #[derive( 537 | Clone, 538 | ::ethers::contract::EthAbiType, 539 | ::ethers::contract::EthAbiCodec, 540 | Default, 541 | Debug, 542 | PartialEq, 543 | Eq, 544 | Hash 545 | )] 546 | pub struct MultiAttestReturn(pub bool); 547 | ///Container type for all return fields from the `multiRevoke` function with signature `multiRevoke((bytes32,bytes32,uint64,uint64,uint64,bytes32,address,address,bool,bytes)[],uint256[])` and selector `0x88e5b2d9` 548 | #[derive( 549 | Clone, 550 | ::ethers::contract::EthAbiType, 551 | ::ethers::contract::EthAbiCodec, 552 | Default, 553 | Debug, 554 | PartialEq, 555 | Eq, 556 | Hash 557 | )] 558 | pub struct MultiRevokeReturn(pub bool); 559 | ///Container type for all return fields from the `revoke` function with signature `revoke((bytes32,bytes32,uint64,uint64,uint64,bytes32,address,address,bool,bytes))` and selector `0xe49617e1` 560 | #[derive( 561 | Clone, 562 | ::ethers::contract::EthAbiType, 563 | ::ethers::contract::EthAbiCodec, 564 | Default, 565 | Debug, 566 | PartialEq, 567 | Eq, 568 | Hash 569 | )] 570 | pub struct RevokeReturn(pub bool); 571 | } 572 | -------------------------------------------------------------------------------- /src/eas.rs: -------------------------------------------------------------------------------- 1 | use eas_contracts::{ 2 | eas::EAS, 3 | value_resolver::{ 4 | AttestationRequest, AttestationRequestData, DelegatedAttestationRequest, 5 | DelegatedRevocationRequest, MultiAttestationRequest, MultiDelegatedAttestationRequest, 6 | MultiDelegatedRevocationRequest, MultiRevocationRequest, RevocationRequest, 7 | }, 8 | }; 9 | use ethers::{ 10 | middleware::SignerMiddleware, 11 | prelude::ContractError, 12 | providers::{Http, Provider}, 13 | signers::LocalWallet, 14 | types::{Address, Bytes, U256}, 15 | }; 16 | use log::info; 17 | use std::sync::Arc; 18 | 19 | // Signer type alias. 20 | pub type Signer = SignerMiddleware, LocalWallet>; 21 | 22 | /// The Eas struct encapsulates a signer and an instance of an EAS. 23 | pub struct Eas { 24 | /// The signer used by the Eas instance. 25 | signer: Arc, 26 | /// The EAS contract. 27 | eas: EAS, 28 | } 29 | 30 | // Implementation block for the Eas struct. 31 | impl Eas { 32 | /// Constructs a new Eas instance. 33 | /// If no EAS contract address is provided, the zero address is used. 34 | /// The address will be updated when the EAS is deployed. 35 | /// 36 | /// # Parameters 37 | /// 38 | /// * `signer`: An instance of the Signer. 39 | /// * `eas_address`: The address of the EAS contract. 40 | /// 41 | /// # Returns 42 | /// 43 | /// A new Eas instance. 44 | pub fn new(signer: Signer, eas_address: Option
) -> Self { 45 | let signer_arc = Arc::new(signer); 46 | 47 | Self { 48 | signer: signer_arc.clone(), 49 | eas: EAS::new(eas_address.unwrap_or(Address::zero()), signer_arc), 50 | } 51 | } 52 | 53 | /// Returns the signer used by the Eas instance. 54 | /// 55 | /// # Returns 56 | /// 57 | /// An Arc pointing to the Signer instance. 58 | pub fn signer(&self) -> Arc { 59 | self.signer.clone() 60 | } 61 | 62 | /// Returns the EAS contract. 63 | /// 64 | /// # Returns 65 | /// 66 | /// An instance of the EAS contract. 67 | pub fn eas(&self) -> EAS { 68 | self.eas.clone() 69 | } 70 | 71 | /// Deploys the EAS. 72 | /// This function will update the EAS instance with the deployed contract address. 73 | /// 74 | /// # Returns 75 | /// 76 | /// A Result which is an Ok if the EAS was successfully deployed, else an Err. 77 | pub async fn deploy( 78 | &mut self, 79 | schema_registry: Address, 80 | ) -> Result> { 81 | let deployment = EAS::deploy(self.signer.clone(), schema_registry)?; 82 | let address = deployment.send().await?.address(); 83 | 84 | // Update the EAS instance with the deployed contract address. 85 | self.eas = EAS::new(address, self.signer.clone()); 86 | 87 | Ok(address) 88 | } 89 | 90 | /// Performs an attestation with the provided request. 91 | /// 92 | /// # Parameters 93 | /// 94 | /// * `request`: The AttestationRequest to be sent. 95 | /// 96 | /// # Returns 97 | /// 98 | /// A Result which is an Ok if the attestation was successful, else an Err. 99 | pub async fn attest(&self, request: AttestationRequest) -> Result<(), ContractError> { 100 | let call = self.eas.attest(request); 101 | let res = call.send().await?; 102 | 103 | info!("Attestation result: {:?}", res); 104 | Ok(()) 105 | } 106 | 107 | /// Performs an attestation by delegation with the provided request. 108 | /// 109 | /// # Parameters 110 | /// 111 | /// * `delegated_request`: The DelegatedAttestationRequest to be sent. 112 | /// 113 | /// # Returns 114 | /// 115 | /// A Result which is an Ok if the attestation by delegation was successful, else an Err. 116 | pub async fn attest_by_delegation( 117 | &self, 118 | delegated_request: DelegatedAttestationRequest, 119 | ) -> Result<(), ContractError> { 120 | let call = self.eas.attest_by_delegation(delegated_request); 121 | let res = call.send().await?; 122 | 123 | info!("Attestation by delegation result: {:?}", res); 124 | Ok(()) 125 | } 126 | 127 | /// Retrieves the attestation type hash. 128 | /// 129 | /// # Returns 130 | /// 131 | /// A Result which is an Ok if the attestation type hash was successfully retrieved, else an Err. 132 | pub async fn get_attest_type_hash(&self) -> Result<(), ContractError> { 133 | let call = self.eas.get_attest_type_hash(); 134 | let res = call.send().await?; 135 | 136 | info!("Attestation type hash: {:?}", res); 137 | Ok(()) 138 | } 139 | 140 | /// Retrieves an attestation for the provided UID. 141 | /// 142 | /// # Parameters 143 | /// 144 | /// * `uid`: The UID for which to retrieve the attestation. 145 | /// 146 | /// # Returns 147 | /// 148 | /// A Result which is an Ok if the attestation was successfully retrieved, else an Err. 149 | pub async fn get_attestation(&self, uid: [u8; 32]) -> Result<(), ContractError> { 150 | let call = self.eas.get_attestation(uid); 151 | let res = call.send().await?; 152 | 153 | info!("Attestation: {:?}", res); 154 | Ok(()) 155 | } 156 | 157 | /// Retrieves the domain separator of the EAS contract. 158 | /// 159 | /// # Returns 160 | /// 161 | /// A Result which is an Ok if the domain separator was successfully retrieved, else an Err. 162 | pub async fn get_domain_separator(&self) -> Result<(), ContractError> { 163 | let call = self.eas.get_domain_separator(); 164 | let res = call.send().await?; 165 | 166 | info!("Domain separator: {:?}", res); 167 | Ok(()) 168 | } 169 | 170 | /// Retrieves the name of the EAS contract. 171 | /// 172 | /// # Returns 173 | /// 174 | /// A Result which is an Ok if the name was successfully retrieved, else an Err. 175 | pub async fn get_name(&self) -> Result<(), ContractError> { 176 | let call = self.eas.get_name(); 177 | let res = call.send().await?; 178 | 179 | info!("Name: {:?}", res); 180 | Ok(()) 181 | } 182 | 183 | /// Retrieves the nonce of the provided account. 184 | /// 185 | /// # Parameters 186 | /// 187 | /// * `account`: The account for which to retrieve the nonce. 188 | /// 189 | /// # Returns 190 | /// 191 | /// A Result which is an Ok if the nonce was successfully retrieved, else an Err. 192 | pub async fn get_nonce( 193 | &self, 194 | account: ::ethers::core::types::Address, 195 | ) -> Result<(), ContractError> { 196 | let call = self.eas.get_nonce(account); 197 | let res = call.send().await?; 198 | 199 | info!("Nonce: {:?}", res); 200 | Ok(()) 201 | } 202 | 203 | /// Retrieves the offchain revocation for the provided revoker and data. 204 | /// 205 | /// # Parameters 206 | /// 207 | /// * `revoker`: The revoker for which to retrieve the offchain revocation. 208 | /// * `data`: The data for which to retrieve the offchain revocation. 209 | /// 210 | /// # Returns 211 | /// 212 | /// A Result which is an Ok if the offchain revocation was successfully retrieved, else an Err. 213 | pub async fn get_revoke_offchain( 214 | &self, 215 | revoker: ::ethers::core::types::Address, 216 | data: [u8; 32], 217 | ) -> Result<(), ContractError> { 218 | let call = self.eas.get_revoke_offchain(revoker, data); 219 | let res = call.send().await?; 220 | 221 | info!("Revoke offchain: {:?}", res); 222 | Ok(()) 223 | } 224 | 225 | /// Retrieves the revocation type hash of the EAS contract. 226 | /// 227 | /// # Returns 228 | /// 229 | /// A Result which is an Ok if the revocation type hash was successfully retrieved, else an Err. 230 | pub async fn get_revoke_type_hash(&self) -> Result<(), ContractError> { 231 | let call = self.eas.get_revoke_type_hash(); 232 | let res = call.send().await?; 233 | 234 | info!("Revoke type hash: {:?}", res); 235 | Ok(()) 236 | } 237 | 238 | /// Retrieves the schema registry of the EAS contract. 239 | /// 240 | /// # Returns 241 | /// 242 | /// A Result which is an Ok if the schema registry was successfully retrieved, else an Err. 243 | pub async fn get_schema_registry(&self) -> Result<(), ContractError> { 244 | let call = self.eas.get_schema_registry(); 245 | let res = call.send().await?; 246 | 247 | info!("Schema registry: {:?}", res); 248 | Ok(()) 249 | } 250 | 251 | /// Retrieves the timestamp for the provided data. 252 | /// 253 | /// # Parameters 254 | /// 255 | /// * `data`: The data for which to retrieve the timestamp. 256 | /// 257 | /// # Returns 258 | /// 259 | /// A Result which is an Ok if the timestamp was successfully retrieved, else an Err. 260 | pub async fn get_timestamp(&self, data: [u8; 32]) -> Result<(), ContractError> { 261 | let call = self.eas.get_timestamp(data); 262 | let res = call.send().await?; 263 | 264 | info!("Timestamp: {:?}", res); 265 | Ok(()) 266 | } 267 | 268 | /// Checks if the attestation for the provided UID is valid. 269 | /// 270 | /// # Parameters 271 | /// 272 | /// * `uid`: The UID for which to check the attestation. 273 | /// 274 | /// # Returns 275 | /// 276 | /// A Result which is an Ok if the attestation was successfully checked, else an Err. 277 | pub async fn is_attestation_valid(&self, uid: [u8; 32]) -> Result<(), ContractError> { 278 | let call = self.eas.is_attestation_valid(uid); 279 | let res = call.send().await?; 280 | 281 | info!("Is attestation valid: {:?}", res); 282 | Ok(()) 283 | } 284 | 285 | /// Performs multiple attestations with the provided request. 286 | /// 287 | /// # Parameters 288 | /// 289 | /// * `requests`: The vector of MultiAttestationRequest to be sent. 290 | /// 291 | /// # Returns 292 | /// 293 | /// A Result which is an Ok if the multiple attestations were successful, else an Err. 294 | pub async fn multi_attest( 295 | &self, 296 | requests: Vec, 297 | ) -> Result<(), ContractError> { 298 | let call = self.eas.multi_attest(requests); 299 | let res = call.send().await?; 300 | 301 | info!("Multi attestation result: {:?}", res); 302 | Ok(()) 303 | } 304 | 305 | /// Performs multiple attestations by delegation with the provided request. 306 | /// 307 | /// # Parameters 308 | /// 309 | /// * `multi_delegated_requests`: The vector of MultiDelegatedAttestationRequest to be sent. 310 | /// 311 | /// # Returns 312 | /// 313 | /// A Result which is an Ok if the multiple attestations by delegation were successful, else an Err. 314 | pub async fn multi_attest_by_delegation( 315 | &self, 316 | multi_delegated_requests: Vec, 317 | ) -> Result<(), ContractError> { 318 | let call = self 319 | .eas 320 | .multi_attest_by_delegation(multi_delegated_requests); 321 | let res = call.send().await?; 322 | 323 | info!("Multi attestation by delegation result: {:?}", res); 324 | Ok(()) 325 | } 326 | 327 | /// Revokes multiple attestations with the provided request. 328 | /// 329 | /// # Parameters 330 | /// 331 | /// * `multi_requests`: The vector of MultiRevocationRequest to be sent. 332 | /// 333 | /// # Returns 334 | /// 335 | /// A Result which is an Ok if the multiple revocations were successful, else an Err. 336 | pub async fn multi_revoke( 337 | &self, 338 | multi_requests: Vec, 339 | ) -> Result<(), ContractError> { 340 | let call = self.eas.multi_revoke(multi_requests); 341 | let res = call.send().await?; 342 | 343 | info!("Multi revocation result: {:?}", res); 344 | Ok(()) 345 | } 346 | 347 | /// Revokes multiple attestations by delegation with the provided request. 348 | /// 349 | /// # Parameters 350 | /// 351 | /// * `multi_delegated_requests`: The vector of MultiDelegatedRevocationRequest to be sent. 352 | /// 353 | /// # Returns 354 | /// 355 | /// A Result which is an Ok if the multiple revocations by delegation were successful, else an Err. 356 | pub async fn multi_revoke_by_delegation( 357 | &self, 358 | multi_delegated_requests: Vec, 359 | ) -> Result<(), ContractError> { 360 | let call = self 361 | .eas 362 | .multi_revoke_by_delegation(multi_delegated_requests); 363 | let res = call.send().await?; 364 | 365 | info!("Multi revocation by delegation result: {:?}", res); 366 | Ok(()) 367 | } 368 | 369 | /// Revokes multiple attestations off-chain with the provided data. 370 | /// 371 | /// # Parameters 372 | /// 373 | /// * `data`: The vector of 32-byte arrays to be sent. 374 | /// 375 | /// # Returns 376 | /// 377 | /// A Result which is an Ok if the multiple off-chain revocations were successful, else an Err. 378 | pub async fn multi_revoke_offchain( 379 | &self, 380 | data: Vec<[u8; 32]>, 381 | ) -> Result<(), ContractError> { 382 | let call = self.eas.multi_revoke_offchain(data); 383 | let res = call.send().await?; 384 | 385 | info!("Multi off-chain revocation result: {:?}", res); 386 | Ok(()) 387 | } 388 | 389 | /// Performs multiple timestamp actions with the provided data. 390 | /// 391 | /// # Parameters 392 | /// 393 | /// * `data`: The vector of 32-byte arrays to be timestamped. 394 | /// 395 | /// # Returns 396 | /// 397 | /// A Result which is an Ok if the multiple timestamps were successful, else an Err. 398 | pub async fn multi_timestamp(&self, data: Vec<[u8; 32]>) -> Result<(), ContractError> { 399 | let call = self.eas.multi_timestamp(data); 400 | let res = call.send().await?; 401 | 402 | info!("Multi timestamp result: {:?}", res); 403 | Ok(()) 404 | } 405 | 406 | /// Revokes an attestation with the provided request. 407 | /// 408 | /// # Parameters 409 | /// 410 | /// * `request`: The RevocationRequest to be sent. 411 | /// 412 | /// # Returns 413 | /// 414 | /// A Result which is an Ok if the revocation was successful, else an Err. 415 | pub async fn revoke(&self, request: RevocationRequest) -> Result<(), ContractError> { 416 | let call = self.eas.revoke(request); 417 | let res = call.send().await?; 418 | 419 | info!("Revoke result: {:?}", res); 420 | Ok(()) 421 | } 422 | 423 | /// Revokes an attestation by delegation with the provided request. 424 | /// 425 | /// # Parameters 426 | /// 427 | /// * `delegated_request`: The DelegatedRevocationRequest to be sent. 428 | /// 429 | /// # Returns 430 | /// 431 | /// A Result which is an Ok if the revocation by delegation was successful, else an Err. 432 | pub async fn revoke_by_delegation( 433 | &self, 434 | delegated_request: DelegatedRevocationRequest, 435 | ) -> Result<(), ContractError> { 436 | let call = self.eas.revoke_by_delegation(delegated_request); 437 | let res = call.send().await?; 438 | 439 | info!("Revoke by delegation result: {:?}", res); 440 | Ok(()) 441 | } 442 | 443 | /// Revokes an attestation off-chain with the provided data. 444 | /// 445 | /// # Parameters 446 | /// 447 | /// * `data`: The 32-byte array to be revoked off-chain. 448 | /// 449 | /// # Returns 450 | /// 451 | /// A Result which is an Ok if the off-chain revocation was successful, else an Err. 452 | pub async fn revoke_offchain(&self, data: [u8; 32]) -> Result<(), ContractError> { 453 | let call = self.eas.revoke_offchain(data); 454 | let res = call.send().await?; 455 | 456 | info!("Revoke offchain result: {:?}", res); 457 | Ok(()) 458 | } 459 | 460 | /// Performs a timestamp action with the provided data. 461 | /// 462 | /// # Parameters 463 | /// 464 | /// * `data`: The 32-byte array to be timestamped. 465 | /// 466 | /// # Returns 467 | /// 468 | /// A Result which is an Ok if the timestamp was successful, else an Err. 469 | pub async fn timestamp(&self, data: [u8; 32]) -> Result<(), ContractError> { 470 | let call = self.eas.timestamp(data); 471 | let res = call.send().await?; 472 | 473 | info!("Timestamp result: {:?}", res); 474 | Ok(()) 475 | } 476 | 477 | /// Retrieves the version of the EAS contract. 478 | /// 479 | /// # Returns 480 | /// 481 | /// A Result which is an Ok if the version was successfully retrieved, else an Err. 482 | pub async fn version(&self) -> Result<(), ContractError> { 483 | let call = self.eas.version(); 484 | let res = call.send().await?; 485 | 486 | info!("Version: {:?}", res); 487 | Ok(()) 488 | } 489 | 490 | /// Constructs and returns the attestation data. 491 | /// 492 | /// # Parameters 493 | /// 494 | /// * `recipient`: The recipient of the attestation. 495 | /// * `expiration_time`: The expiration time of the attestation. 496 | /// * `revocable`: Whether the attestation is revocable. 497 | /// * `ref_uid`: The reference UID of the attestation. 498 | /// * `data`: The data of the attestation. 499 | /// * `value`: The value of the attestation. 500 | /// 501 | /// # Returns 502 | /// 503 | /// An instance of AttestationRequestData. 504 | pub fn get_attestation_data( 505 | recipient: Address, 506 | expiration_time: u64, 507 | revocable: bool, 508 | ref_uid: [u8; 32], 509 | data: Bytes, 510 | value: U256, 511 | ) -> AttestationRequestData { 512 | AttestationRequestData { 513 | recipient, 514 | expiration_time, 515 | revocable, 516 | ref_uid, 517 | data, 518 | value, 519 | } 520 | } 521 | } 522 | 523 | #[cfg(test)] 524 | mod tests { 525 | use crate::eas::*; 526 | use eas_contracts::value_resolver::{ 527 | AttestationRequest, DelegatedAttestationRequest, Eip712Signature, RevocationRequestData, 528 | }; 529 | use ethers::{ 530 | middleware::SignerMiddleware, 531 | providers::{Http, Provider}, 532 | signers::{coins_bip39::English, MnemonicBuilder, Signer}, 533 | types::{Address, U256}, 534 | utils::Anvil, 535 | }; 536 | use std::convert::TryFrom; 537 | 538 | const TEST_MNEMONIC: &'static str = 539 | "test test test test test test test test test test test junk"; 540 | 541 | async fn setup_eas(node_url: &str) -> Eas { 542 | let provider = Provider::::try_from(node_url).unwrap(); 543 | let wallet = MnemonicBuilder::::default() 544 | .phrase(TEST_MNEMONIC) 545 | .build() 546 | .unwrap(); 547 | let signer = SignerMiddleware::new(provider, wallet.with_chain_id(31337u64)); 548 | 549 | Eas::new(signer, None) 550 | } 551 | 552 | #[tokio::test] 553 | async fn test_eas_new() { 554 | let anvil = Anvil::new().spawn(); 555 | setup_eas(anvil.endpoint().as_str()).await; 556 | drop(anvil); 557 | } 558 | 559 | #[tokio::test] 560 | async fn test_eas_deploy() { 561 | let anvil = Anvil::new().spawn(); 562 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 563 | let schema_registry = Address::from([0x42; 20]); 564 | 565 | let res = eas.deploy(schema_registry).await; 566 | 567 | assert!(res.is_ok()); 568 | drop(anvil); 569 | } 570 | 571 | #[ignore] 572 | #[tokio::test] 573 | async fn test_eas_attest() { 574 | let anvil = Anvil::new().spawn(); 575 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 576 | let schema_registry = Address::from([0x42; 20]); 577 | eas.deploy(schema_registry).await.unwrap(); 578 | 579 | let data = Eas::get_attestation_data( 580 | Address::zero(), 581 | 0, 582 | false, 583 | [0u8; 32], 584 | [0u8; 32].into(), 585 | 0.into(), 586 | ); 587 | 588 | let attestation_request = AttestationRequest { 589 | schema: [0; 32], 590 | data, 591 | }; 592 | 593 | let res = eas.attest(attestation_request).await; 594 | res.unwrap(); 595 | 596 | drop(anvil); 597 | } 598 | 599 | #[ignore] 600 | #[tokio::test] 601 | async fn test_eas_attest_by_delegation() { 602 | let anvil = Anvil::new().spawn(); 603 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 604 | let schema_registry: ethers::types::H160 = Address::from([0x42; 20]); 605 | eas.deploy(schema_registry).await.unwrap(); 606 | 607 | let data = Eas::get_attestation_data( 608 | Address::zero(), 609 | 0, 610 | false, 611 | [0u8; 32], 612 | [0u8; 32].into(), 613 | 0.into(), 614 | ); 615 | 616 | let delegated_attestation_request = DelegatedAttestationRequest { 617 | schema: [0; 32], 618 | data, 619 | signature: Eip712Signature::default(), 620 | attester: Address::zero(), 621 | }; 622 | 623 | let res = eas 624 | .attest_by_delegation(delegated_attestation_request) 625 | .await; 626 | 627 | res.unwrap(); 628 | drop(anvil); 629 | } 630 | 631 | #[tokio::test] 632 | async fn test_eas_get_attest_type_hash() { 633 | let anvil = Anvil::new().spawn(); 634 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 635 | let schema_registry = Address::from([0x42; 20]); 636 | eas.deploy(schema_registry).await.unwrap(); 637 | 638 | let res = eas.get_attest_type_hash().await; 639 | res.unwrap(); 640 | 641 | drop(anvil); 642 | } 643 | 644 | #[tokio::test] 645 | async fn test_eas_get_attestation() { 646 | let anvil = Anvil::new().spawn(); 647 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 648 | let schema_registry = Address::from([0x42; 20]); 649 | eas.deploy(schema_registry).await.unwrap(); 650 | 651 | let uid = [0u8; 32]; 652 | 653 | let res = eas.get_attestation(uid).await; 654 | 655 | assert!(res.is_ok()); 656 | drop(anvil); 657 | } 658 | 659 | #[tokio::test] 660 | async fn test_eas_get_domain_separator() { 661 | let anvil = Anvil::new().spawn(); 662 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 663 | let schema_registry = Address::from([0x42; 20]); 664 | eas.deploy(schema_registry).await.unwrap(); 665 | 666 | let res = eas.get_domain_separator().await; 667 | 668 | assert!(res.is_ok()); 669 | drop(anvil); 670 | } 671 | 672 | #[tokio::test] 673 | async fn test_eas_get_name() { 674 | let anvil = Anvil::new().spawn(); 675 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 676 | let schema_registry = Address::from([0x42; 20]); 677 | eas.deploy(schema_registry).await.unwrap(); 678 | 679 | let _res = eas.get_name().await.unwrap(); 680 | 681 | drop(anvil); 682 | } 683 | 684 | #[tokio::test] 685 | async fn test_eas_get_nonce() { 686 | let anvil = Anvil::new().spawn(); 687 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 688 | let schema_registry = Address::from([0x42; 20]); 689 | eas.deploy(schema_registry).await.unwrap(); 690 | 691 | let account = Address::zero(); 692 | 693 | let res = eas.get_nonce(account).await; 694 | 695 | res.unwrap(); 696 | 697 | // assert!(res.is_ok()); 698 | drop(anvil); 699 | } 700 | 701 | #[tokio::test] 702 | async fn test_eas_get_revoke_offchain() { 703 | let anvil = Anvil::new().spawn(); 704 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 705 | let schema_registry = Address::from([0x42; 20]); 706 | eas.deploy(schema_registry).await.unwrap(); 707 | 708 | let revoker = Address::zero(); 709 | let data = [0u8; 32]; 710 | 711 | let res = eas.get_revoke_offchain(revoker, data).await; 712 | 713 | assert!(res.is_ok()); 714 | drop(anvil); 715 | } 716 | 717 | #[tokio::test] 718 | async fn test_eas_get_revoke_type_hash() { 719 | let anvil = Anvil::new().spawn(); 720 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 721 | let schema_registry = Address::from([0x42; 20]); 722 | eas.deploy(schema_registry).await.unwrap(); 723 | 724 | let res = eas.get_revoke_type_hash().await; 725 | 726 | assert!(res.is_ok()); 727 | drop(anvil); 728 | } 729 | 730 | #[tokio::test] 731 | async fn test_eas_get_schema_registry() { 732 | let anvil = Anvil::new().spawn(); 733 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 734 | let schema_registry = Address::from([0x42; 20]); 735 | eas.deploy(schema_registry).await.unwrap(); 736 | 737 | let res = eas.get_schema_registry().await; 738 | 739 | assert!(res.is_ok()); 740 | drop(anvil); 741 | } 742 | 743 | #[tokio::test] 744 | async fn test_eas_get_timestamp() { 745 | let anvil = Anvil::new().spawn(); 746 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 747 | let schema_registry = Address::from([0x42; 20]); 748 | eas.deploy(schema_registry).await.unwrap(); 749 | 750 | let data = [0u8; 32]; 751 | 752 | let res = eas.get_timestamp(data).await; 753 | 754 | assert!(res.is_ok()); 755 | drop(anvil); 756 | } 757 | 758 | #[tokio::test] 759 | async fn test_eas_is_attestation_valid() { 760 | let anvil = Anvil::new().spawn(); 761 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 762 | let schema_registry = Address::from([0x42; 20]); 763 | eas.deploy(schema_registry).await.unwrap(); 764 | 765 | let uid = [0u8; 32]; 766 | 767 | let res = eas.is_attestation_valid(uid).await; 768 | 769 | assert!(res.is_ok()); 770 | drop(anvil); 771 | } 772 | 773 | #[ignore] 774 | #[tokio::test] 775 | async fn test_eas_multi_attest() { 776 | let anvil = Anvil::new().spawn(); 777 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 778 | let schema_registry = Address::from([0x42; 20]); 779 | eas.deploy(schema_registry).await.unwrap(); 780 | 781 | let data = Eas::get_attestation_data( 782 | Address::zero(), 783 | 0, 784 | false, 785 | [0u8; 32], 786 | [0u8; 32].into(), 787 | 0.into(), 788 | ); 789 | 790 | let multi_attestation_request = MultiAttestationRequest { 791 | schema: [0; 32], 792 | data: vec![data], 793 | }; 794 | 795 | let res = eas.multi_attest(vec![multi_attestation_request]).await; 796 | res.unwrap(); 797 | 798 | drop(anvil); 799 | } 800 | 801 | #[ignore] 802 | #[tokio::test] 803 | async fn test_eas_multi_attest_by_delegation() { 804 | let anvil = Anvil::new().spawn(); 805 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 806 | let schema_registry = Address::from([0x42; 20]); 807 | eas.deploy(schema_registry).await.unwrap(); 808 | 809 | let data = Eas::get_attestation_data( 810 | Address::zero(), 811 | 0, 812 | false, 813 | [0u8; 32], 814 | [0u8; 32].into(), 815 | 0.into(), 816 | ); 817 | 818 | let multi_delegated_attestation_request = MultiDelegatedAttestationRequest { 819 | schema: [0; 32], 820 | data: vec![data], 821 | signatures: vec![Eip712Signature::default()], 822 | attester: Address::zero(), 823 | }; 824 | 825 | let res = eas 826 | .multi_attest_by_delegation(vec![multi_delegated_attestation_request]) 827 | .await; 828 | res.unwrap(); 829 | 830 | drop(anvil); 831 | } 832 | 833 | #[ignore] 834 | #[tokio::test] 835 | async fn test_eas_multi_revoke() { 836 | let anvil = Anvil::new().spawn(); 837 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 838 | let schema_registry = Address::from([0x42; 20]); 839 | eas.deploy(schema_registry).await.unwrap(); 840 | 841 | let revocation_request_data = RevocationRequestData { 842 | uid: [0; 32], 843 | value: U256::default(), 844 | }; 845 | 846 | let multi_revocation_request = MultiRevocationRequest { 847 | schema: [0; 32], 848 | data: vec![revocation_request_data], 849 | }; 850 | 851 | let res = eas.multi_revoke(vec![multi_revocation_request]).await; 852 | res.unwrap(); 853 | 854 | drop(anvil); 855 | } 856 | 857 | #[ignore] 858 | #[tokio::test] 859 | async fn test_eas_multi_revoke_by_delegation() { 860 | let anvil = Anvil::new().spawn(); 861 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 862 | let schema_registry = Address::from([0x42; 20]); 863 | eas.deploy(schema_registry).await.unwrap(); 864 | 865 | let revocation_request_data = RevocationRequestData { 866 | uid: [0; 32], 867 | value: U256::default(), 868 | }; 869 | 870 | let multi_delegated_revocation_request = MultiDelegatedRevocationRequest { 871 | schema: [0; 32], 872 | data: vec![revocation_request_data], 873 | signatures: vec![Eip712Signature::default()], 874 | revoker: Address::zero(), 875 | }; 876 | 877 | let res = eas 878 | .multi_revoke_by_delegation(vec![multi_delegated_revocation_request]) 879 | .await; 880 | res.unwrap(); 881 | 882 | drop(anvil); 883 | } 884 | 885 | #[tokio::test] 886 | async fn test_eas_multi_revoke_offchain() { 887 | let anvil = Anvil::new().spawn(); 888 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 889 | let schema_registry = Address::from([0x42; 20]); 890 | eas.deploy(schema_registry).await.unwrap(); 891 | 892 | let data = [0u8; 32]; 893 | 894 | assert!(eas.multi_revoke_offchain(vec![data]).await.is_ok()); 895 | drop(anvil); 896 | } 897 | 898 | #[ignore] 899 | #[tokio::test] 900 | async fn test_eas_multi_timestamp() { 901 | let anvil = Anvil::new().spawn(); 902 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 903 | let schema_registry = Address::from([0x42; 20]); 904 | eas.deploy(schema_registry).await.unwrap(); 905 | 906 | let data = vec![[0; 32]; 10]; 907 | let res = eas.multi_timestamp(data).await; 908 | res.unwrap(); 909 | 910 | drop(anvil); 911 | } 912 | 913 | #[ignore] 914 | #[tokio::test] 915 | async fn test_eas_revoke() { 916 | let anvil = Anvil::new().spawn(); 917 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 918 | let schema_registry = Address::from([0x42; 20]); 919 | eas.deploy(schema_registry).await.unwrap(); 920 | 921 | let request = RevocationRequest::default(); 922 | 923 | let res = eas.revoke(request).await; 924 | res.unwrap(); 925 | 926 | drop(anvil); 927 | } 928 | 929 | #[ignore] 930 | #[tokio::test] 931 | async fn test_eas_revoke_by_delegation() { 932 | let anvil = Anvil::new().spawn(); 933 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 934 | let schema_registry = Address::from([0x42; 20]); 935 | eas.deploy(schema_registry).await.unwrap(); 936 | 937 | let delegated_request = DelegatedRevocationRequest::default(); 938 | let res = eas.revoke_by_delegation(delegated_request).await; 939 | res.unwrap(); 940 | 941 | drop(anvil); 942 | } 943 | 944 | #[tokio::test] 945 | async fn test_eas_revoke_offchain() { 946 | let anvil = Anvil::new().spawn(); 947 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 948 | let schema_registry = Address::from([0x42; 20]); 949 | eas.deploy(schema_registry).await.unwrap(); 950 | 951 | let data = [0; 32]; 952 | let res = eas.revoke_offchain(data).await; 953 | 954 | assert!(res.is_ok()); 955 | drop(anvil); 956 | } 957 | 958 | #[tokio::test] 959 | async fn test_eas_timestamp() { 960 | let anvil = Anvil::new().spawn(); 961 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 962 | let schema_registry = Address::from([0x42; 20]); 963 | eas.deploy(schema_registry).await.unwrap(); 964 | 965 | let data = [0; 32]; 966 | let res = eas.timestamp(data).await; 967 | 968 | assert!(res.is_ok()); 969 | drop(anvil); 970 | } 971 | 972 | #[tokio::test] 973 | async fn test_eas_version() { 974 | let anvil = Anvil::new().spawn(); 975 | let mut eas = setup_eas(anvil.endpoint().as_str()).await; 976 | let schema_registry = Address::from([0x42; 20]); 977 | eas.deploy(schema_registry).await.unwrap(); 978 | 979 | let res = eas.version().await; 980 | 981 | assert!(res.is_ok()); 982 | drop(anvil); 983 | } 984 | } 985 | --------------------------------------------------------------------------------