From b7fca3323ac40f3c4a210aa8b062b78ef904fabf Mon Sep 17 00:00:00 2001 From: ameanasad Date: Sat, 5 Aug 2023 07:58:35 -0400 Subject: [PATCH] feat: Add access control to measure + docs --- README.md | 17 +- contract-bindings/src/measure.rs | 1183 ++++++++++++++++++++- contract-utils/openzeppelin-contracts | 1 - contract-utils/src/lib.rs | 3 +- contract-utils/src/main.rs | 4 +- contract-utils/tests/integration_tests.rs | 2 +- foundry.toml | 4 +- src/Measure.sol | 32 +- 8 files changed, 1174 insertions(+), 72 deletions(-) delete mode 160000 contract-utils/openzeppelin-contracts diff --git a/README.md b/README.md index fa169d4..45715bc 100644 --- a/README.md +++ b/README.md @@ -52,10 +52,25 @@ This deployment method requires manual insertion of a private key and is not rec NOTE: Deployment using forge CLI often errors out on Filecoin networks even though the transaction goes through (Foundry is configured for EVM's block time, not FVM's). Use a block explorer to find the address of the contract. +Make sure the following env vars are defined as follows: ```bash -forge create --rpc-url https://api.calibration.node.glif.io/rpc/v1 --private-key src/Measure.sol:Measure +export RPC_URL="..." +export ADMIN_ADDRESS="..." +export MNEMONIC_PATH="{path to mnemonic secret file}" ``` +To deploy using a private key, run: + +```bash +forge create --rpc-url $RPC_URL --private-key src/Measure.sol:Measure --constructor-args $ADMIN_ADDRESS +``` + +To deploy using a local mnemonic secret, run: +```bash +forge create --rpc-url $RPC_URL --mnemonic $MNEMONIC_PATH src/Measure.sol:Measure --constructor-args $ADMIN_ADDRESS +``` + + ### Deployment Rust Script The deployment relies on contract bindings generated in the `/contract-bindings` directory. If you make changes to the contracts, run: diff --git a/contract-bindings/src/measure.rs b/contract-bindings/src/measure.rs index 7aa0ad2..3bc76b5 100644 --- a/contract-bindings/src/measure.rs +++ b/contract-bindings/src/measure.rs @@ -7,59 +7,444 @@ pub use measure::*; clippy::upper_case_acronyms, clippy::type_complexity, dead_code, - non_camel_case_types + non_camel_case_types, )] pub mod measure { #[allow(deprecated)] fn __abi() -> ::ethers::core::abi::Abi { ::ethers::core::abi::ethabi::Contract { - constructor: ::core::option::Option::None, - functions: ::core::convert::From::from([( - ::std::borrow::ToOwned::to_owned("measure"), - ::std::vec![::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("measure"), - inputs: ::std::vec![::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("data"), - kind: ::ethers::core::abi::ethabi::ParamType::String, + constructor: ::core::option::Option::Some(::ethers::core::abi::ethabi::Constructor { + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("admin"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("string"), + ::std::borrow::ToOwned::to_owned("address"), ), - },], - outputs: ::std::vec![], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, - },], - )]), - events: ::core::convert::From::from([( - ::std::borrow::ToOwned::to_owned("Measurement"), - ::std::vec![::ethers::core::abi::ethabi::Event { - name: ::std::borrow::ToOwned::to_owned("Measurement"), - inputs: ::std::vec![::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("data"), - kind: ::ethers::core::abi::ethabi::ParamType::String, - indexed: false, - },], - anonymous: false, - },], - )]), - errors: ::std::collections::BTreeMap::new(), + }, + ], + }), + functions: ::core::convert::From::from([ + ( + ::std::borrow::ToOwned::to_owned("COMMITMENT_ROLE"), + ::std::vec![ + ::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("COMMITMENT_ROLE"), + inputs: ::std::vec![], + outputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( + 32usize, + ), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("bytes32"), + ), + }, + ], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + }, + ], + ), + ( + ::std::borrow::ToOwned::to_owned("DEFAULT_ADMIN_ROLE"), + ::std::vec![ + ::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("DEFAULT_ADMIN_ROLE"), + inputs: ::std::vec![], + outputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( + 32usize, + ), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("bytes32"), + ), + }, + ], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + }, + ], + ), + ( + ::std::borrow::ToOwned::to_owned("getRoleAdmin"), + ::std::vec![ + ::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("getRoleAdmin"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("role"), + kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( + 32usize, + ), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("bytes32"), + ), + }, + ], + outputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( + 32usize, + ), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("bytes32"), + ), + }, + ], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + }, + ], + ), + ( + ::std::borrow::ToOwned::to_owned("grantRole"), + ::std::vec![ + ::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("grantRole"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("role"), + kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( + 32usize, + ), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("bytes32"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("account"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + }, + ], + outputs: ::std::vec![], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, + }, + ], + ), + ( + ::std::borrow::ToOwned::to_owned("hasRole"), + ::std::vec![ + ::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("hasRole"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("role"), + kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( + 32usize, + ), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("bytes32"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("account"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + }, + ], + outputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::Bool, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("bool"), + ), + }, + ], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + }, + ], + ), + ( + ::std::borrow::ToOwned::to_owned("measure"), + ::std::vec![ + ::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("measure"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("dataCommitment"), + kind: ::ethers::core::abi::ethabi::ParamType::String, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("string"), + ), + }, + ], + outputs: ::std::vec![], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, + }, + ], + ), + ( + ::std::borrow::ToOwned::to_owned("renounceRole"), + ::std::vec![ + ::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("renounceRole"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("role"), + kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( + 32usize, + ), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("bytes32"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned( + "callerConfirmation", + ), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + }, + ], + outputs: ::std::vec![], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, + }, + ], + ), + ( + ::std::borrow::ToOwned::to_owned("revokeRole"), + ::std::vec![ + ::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("revokeRole"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("role"), + kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( + 32usize, + ), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("bytes32"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("account"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + }, + ], + outputs: ::std::vec![], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, + }, + ], + ), + ( + ::std::borrow::ToOwned::to_owned("supportsInterface"), + ::std::vec![ + ::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("supportsInterface"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("interfaceId"), + kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( + 4usize, + ), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("bytes4"), + ), + }, + ], + outputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::Bool, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("bool"), + ), + }, + ], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + }, + ], + ), + ]), + events: ::core::convert::From::from([ + ( + ::std::borrow::ToOwned::to_owned("Measurement"), + ::std::vec![ + ::ethers::core::abi::ethabi::Event { + name: ::std::borrow::ToOwned::to_owned("Measurement"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("dataCommitment"), + kind: ::ethers::core::abi::ethabi::ParamType::String, + indexed: false, + }, + ], + anonymous: false, + }, + ], + ), + ( + ::std::borrow::ToOwned::to_owned("RoleAdminChanged"), + ::std::vec![ + ::ethers::core::abi::ethabi::Event { + name: ::std::borrow::ToOwned::to_owned("RoleAdminChanged"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("role"), + kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( + 32usize, + ), + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("previousAdminRole"), + kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( + 32usize, + ), + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("newAdminRole"), + kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( + 32usize, + ), + indexed: true, + }, + ], + anonymous: false, + }, + ], + ), + ( + ::std::borrow::ToOwned::to_owned("RoleGranted"), + ::std::vec![ + ::ethers::core::abi::ethabi::Event { + name: ::std::borrow::ToOwned::to_owned("RoleGranted"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("role"), + kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( + 32usize, + ), + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("account"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("sender"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: true, + }, + ], + anonymous: false, + }, + ], + ), + ( + ::std::borrow::ToOwned::to_owned("RoleRevoked"), + ::std::vec![ + ::ethers::core::abi::ethabi::Event { + name: ::std::borrow::ToOwned::to_owned("RoleRevoked"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("role"), + kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( + 32usize, + ), + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("account"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("sender"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: true, + }, + ], + anonymous: false, + }, + ], + ), + ]), + errors: ::core::convert::From::from([ + ( + ::std::borrow::ToOwned::to_owned("AccessControlBadConfirmation"), + ::std::vec![ + ::ethers::core::abi::ethabi::AbiError { + name: ::std::borrow::ToOwned::to_owned( + "AccessControlBadConfirmation", + ), + inputs: ::std::vec![], + }, + ], + ), + ( + ::std::borrow::ToOwned::to_owned("AccessControlUnauthorizedAccount"), + ::std::vec![ + ::ethers::core::abi::ethabi::AbiError { + name: ::std::borrow::ToOwned::to_owned( + "AccessControlUnauthorizedAccount", + ), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("account"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("neededRole"), + kind: ::ethers::core::abi::ethabi::ParamType::FixedBytes( + 32usize, + ), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("bytes32"), + ), + }, + ], + }, + ], + ), + ]), receive: false, fallback: false, } } ///The parsed JSON ABI of the contract. - pub static MEASURE_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = - ::ethers::contract::Lazy::new(__abi); + pub static MEASURE_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new( + __abi, + ); #[rustfmt::skip] - const __BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[Pa\x02\x1F\x80a\0 `\09`\0\xF3\xFE`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`\x046\x10a\0+W`\x005`\xE0\x1C\x80c\xCA;\xD3\xF3\x14a\x000W[`\0\x80\xFD[a\0Ca\0>6`\x04a\0\xAEV[a\0EV[\0[\x7F\x03@~\x0C\x85{kp\xFE\x95$:\x9F\xD14k\xA3\xC6ev\xC99\x11\x1El\x0E\x94\x02\xFD\xADN\xEE\x81`@Qa\0t\x91\x90a\x01}V[`@Q\x80\x91\x03\x90\xA1PV[\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[`\0` \x82\x84\x03\x12\x15a\0\xC0W`\0\x80\xFD[\x815g\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x80\x82\x11\x15a\0\xD8W`\0\x80\xFD[\x81\x84\x01\x91P\x84`\x1F\x83\x01\x12a\0\xECW`\0\x80\xFD[\x815\x81\x81\x11\x15a\0\xFEWa\0\xFEa\0\x7FV[`@Q`\x1F\x82\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\x90\x81\x16`?\x01\x16\x81\x01\x90\x83\x82\x11\x81\x83\x10\x17\x15a\x01DWa\x01Da\0\x7FV[\x81`@R\x82\x81R\x87` \x84\x87\x01\x01\x11\x15a\x01]W`\0\x80\xFD[\x82` \x86\x01` \x83\x017`\0\x92\x81\x01` \x01\x92\x90\x92RP\x95\x94PPPPPV[`\0` \x80\x83R\x83Q\x80\x82\x85\x01R`\0[\x81\x81\x10\x15a\x01\xAAW\x85\x81\x01\x83\x01Q\x85\x82\x01`@\x01R\x82\x01a\x01\x8EV[P`\0`@\x82\x86\x01\x01R`@\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`\x1F\x83\x01\x16\x85\x01\x01\x92PPP\x92\x91PPV\xFE\xA2dipfsX\"\x12 \x0B\xF77\xBB\xF4\xE7\x17=\xF5\xE0c\xF3\x82O\x19I\xAC\xAA\xACQH*\xB90C\xF4\xDE5\x97D\xAC\x85dsolcC\0\x08\x11\x003"; + const __BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`@Qa\tr8\x03\x80a\tr\x839\x81\x01`@\x81\x90Ra\0/\x91a\x01\x18V[a\0:`\0\x82a\0lV[Pa\0e\x7F>mM\xDD\x87\x88G\xA5\xCF<\x90>H\x83~\x7F\xBD\xAD\xCB\x12\x10\xD7\x1B\xD6,\xE8\xC4\xD4\xE4\0\x93s\x82a\0lV[PPa\x01HV[`\0\x82\x81R` \x81\x81R`@\x80\x83 `\x01`\x01`\xA0\x1B\x03\x85\x16\x84R\x90\x91R\x81 T`\xFF\x16a\x01\x0EW`\0\x83\x81R` \x81\x81R`@\x80\x83 `\x01`\x01`\xA0\x1B\x03\x86\x16\x84R\x90\x91R\x90 \x80T`\xFF\x19\x16`\x01\x17\x90Ua\0\xC63\x90V[`\x01`\x01`\xA0\x1B\x03\x16\x82`\x01`\x01`\xA0\x1B\x03\x16\x84\x7F/\x87\x88\x11~~\xFF\x1D\x82\xE9&\xECyI\x01\xD1|x\x02JP'\t@0E@\xA73eo\r`@Q`@Q\x80\x91\x03\x90\xA4P`\x01a\x01\x12V[P`\0[\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\x01*W`\0\x80\xFD[\x81Q`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\x01AW`\0\x80\xFD[\x93\x92PPPV[a\x08\x1B\x80a\x01W`\09`\0\xF3\xFE`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`\x046\x10a\0\xA3W`\x005`\xE0\x1C\x80c6V\x8A\xBE\x11a\0vW\x80c\xA2\x17\xFD\xDF\x11a\0[W\x80c\xA2\x17\xFD\xDF\x14a\x01\x94W\x80c\xCA;\xD3\xF3\x14a\x01\x9CW\x80c\xD5Gt\x1F\x14a\x01\xAFW`\0\x80\xFD[\x80c6V\x8A\xBE\x14a\x01=W\x80c\x91\xD1HT\x14a\x01PW`\0\x80\xFD[\x80c\x01\xFF\xC9\xA7\x14a\0\xA8W\x80c\x07%\x06z\x14a\0\xD0W\x80c$\x8A\x9C\xA3\x14a\x01\x05W\x80c//\xF1]\x14a\x01(W[`\0\x80\xFD[a\0\xBBa\0\xB66`\x04a\x05\xD0V[a\x01\xC2V[`@Q\x90\x15\x15\x81R` \x01[`@Q\x80\x91\x03\x90\xF3[a\0\xF7\x7F>mM\xDD\x87\x88G\xA5\xCF<\x90>H\x83~\x7F\xBD\xAD\xCB\x12\x10\xD7\x1B\xD6,\xE8\xC4\xD4\xE4\0\x93s\x81V[`@Q\x90\x81R` \x01a\0\xC7V[a\0\xF7a\x01\x136`\x04a\x06\x19V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0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x81\x16\x81\x14a\x06\x12W`\0\x80\xFD[\x93\x92PPPV[`\0` \x82\x84\x03\x12\x15a\x06+W`\0\x80\xFD[P5\x91\x90PV[`\0\x80`@\x83\x85\x03\x12\x15a\x06EW`\0\x80\xFD[\x825\x91P` \x83\x015s\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x81\x16\x81\x14a\x06pW`\0\x80\xFD[\x80\x91PP\x92P\x92\x90PV[\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[`\0` \x82\x84\x03\x12\x15a\x06\xBCW`\0\x80\xFD[\x815g\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x80\x82\x11\x15a\x06\xD4W`\0\x80\xFD[\x81\x84\x01\x91P\x84`\x1F\x83\x01\x12a\x06\xE8W`\0\x80\xFD[\x815\x81\x81\x11\x15a\x06\xFAWa\x06\xFAa\x06{V[`@Q`\x1F\x82\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\x90\x81\x16`?\x01\x16\x81\x01\x90\x83\x82\x11\x81\x83\x10\x17\x15a\x07@Wa\x07@a\x06{V[\x81`@R\x82\x81R\x87` \x84\x87\x01\x01\x11\x15a\x07YW`\0\x80\xFD[\x82` \x86\x01` \x83\x017`\0\x92\x81\x01` \x01\x92\x90\x92RP\x95\x94PPPPPV[`\0` \x80\x83R\x83Q\x80\x82\x85\x01R`\0[\x81\x81\x10\x15a\x07\xA6W\x85\x81\x01\x83\x01Q\x85\x82\x01`@\x01R\x82\x01a\x07\x8AV[P`\0`@\x82\x86\x01\x01R`@\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`\x1F\x83\x01\x16\x85\x01\x01\x92PPP\x92\x91PPV\xFE\xA2dipfsX\"\x12 sF\xA0\x01\xC3\xA3\xED\xC4\xE2t\xA5+\xC2\xA9dyuZ\x16\xB9C \x92]\x12\x85\xE8\x9E\0\xABt\xCEdsolcC\0\x08\x15\x003"; /// The bytecode of the contract. - pub static MEASURE_BYTECODE: ::ethers::core::types::Bytes = - ::ethers::core::types::Bytes::from_static(__BYTECODE); + pub static MEASURE_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( + __BYTECODE, + ); #[rustfmt::skip] - const __DEPLOYED_BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`\x046\x10a\0+W`\x005`\xE0\x1C\x80c\xCA;\xD3\xF3\x14a\x000W[`\0\x80\xFD[a\0Ca\0>6`\x04a\0\xAEV[a\0EV[\0[\x7F\x03@~\x0C\x85{kp\xFE\x95$:\x9F\xD14k\xA3\xC6ev\xC99\x11\x1El\x0E\x94\x02\xFD\xADN\xEE\x81`@Qa\0t\x91\x90a\x01}V[`@Q\x80\x91\x03\x90\xA1PV[\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[`\0` \x82\x84\x03\x12\x15a\0\xC0W`\0\x80\xFD[\x815g\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x80\x82\x11\x15a\0\xD8W`\0\x80\xFD[\x81\x84\x01\x91P\x84`\x1F\x83\x01\x12a\0\xECW`\0\x80\xFD[\x815\x81\x81\x11\x15a\0\xFEWa\0\xFEa\0\x7FV[`@Q`\x1F\x82\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\x90\x81\x16`?\x01\x16\x81\x01\x90\x83\x82\x11\x81\x83\x10\x17\x15a\x01DWa\x01Da\0\x7FV[\x81`@R\x82\x81R\x87` \x84\x87\x01\x01\x11\x15a\x01]W`\0\x80\xFD[\x82` \x86\x01` \x83\x017`\0\x92\x81\x01` \x01\x92\x90\x92RP\x95\x94PPPPPV[`\0` \x80\x83R\x83Q\x80\x82\x85\x01R`\0[\x81\x81\x10\x15a\x01\xAAW\x85\x81\x01\x83\x01Q\x85\x82\x01`@\x01R\x82\x01a\x01\x8EV[P`\0`@\x82\x86\x01\x01R`@\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`\x1F\x83\x01\x16\x85\x01\x01\x92PPP\x92\x91PPV\xFE\xA2dipfsX\"\x12 \x0B\xF77\xBB\xF4\xE7\x17=\xF5\xE0c\xF3\x82O\x19I\xAC\xAA\xACQH*\xB90C\xF4\xDE5\x97D\xAC\x85dsolcC\0\x08\x11\x003"; + const __DEPLOYED_BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`\x046\x10a\0\xA3W`\x005`\xE0\x1C\x80c6V\x8A\xBE\x11a\0vW\x80c\xA2\x17\xFD\xDF\x11a\0[W\x80c\xA2\x17\xFD\xDF\x14a\x01\x94W\x80c\xCA;\xD3\xF3\x14a\x01\x9CW\x80c\xD5Gt\x1F\x14a\x01\xAFW`\0\x80\xFD[\x80c6V\x8A\xBE\x14a\x01=W\x80c\x91\xD1HT\x14a\x01PW`\0\x80\xFD[\x80c\x01\xFF\xC9\xA7\x14a\0\xA8W\x80c\x07%\x06z\x14a\0\xD0W\x80c$\x8A\x9C\xA3\x14a\x01\x05W\x80c//\xF1]\x14a\x01(W[`\0\x80\xFD[a\0\xBBa\0\xB66`\x04a\x05\xD0V[a\x01\xC2V[`@Q\x90\x15\x15\x81R` \x01[`@Q\x80\x91\x03\x90\xF3[a\0\xF7\x7F>mM\xDD\x87\x88G\xA5\xCF<\x90>H\x83~\x7F\xBD\xAD\xCB\x12\x10\xD7\x1B\xD6,\xE8\xC4\xD4\xE4\0\x93s\x81V[`@Q\x90\x81R` \x01a\0\xC7V[a\0\xF7a\x01\x136`\x04a\x06\x19V[`\0\x90\x81R` \x81\x90R`@\x90 `\x01\x01T\x90V[a\x01;a\x0166`\x04a\x062V[a\x02[V[\0[a\x01;a\x01K6`\x04a\x062V[a\x02\x86V[a\0\xBBa\x01^6`\x04a\x062V[`\0\x91\x82R` \x82\x81R`@\x80\x84 s\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x93\x90\x93\x16\x84R\x91\x90R\x90 T`\xFF\x16\x90V[a\0\xF7`\0\x81V[a\x01;a\x01\xAA6`\x04a\x06\xAAV[a\x02\xE4V[a\x01;a\x01\xBD6`\x04a\x062V[a\x03YV[`\0\x7F\xFF\xFF\xFF\xFF\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\x82\x16\x7Fye\xDB\x0B\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\x14\x80a\x02UWP\x7F\x01\xFF\xC9\xA7\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\x7F\xFF\xFF\xFF\xFF\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\x83\x16\x14[\x92\x91PPV[`\0\x82\x81R` \x81\x90R`@\x90 `\x01\x01Ta\x02v\x81a\x03~V[a\x02\x80\x83\x83a\x03\x8BV[PPPPV[s\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x81\x163\x14a\x02\xD5W`@Q\x7Ff\x97\xB22\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\x81R`\x04\x01`@Q\x80\x91\x03\x90\xFD[a\x02\xDF\x82\x82a\x04\x87V[PPPV[3`\0\x90\x81R\x7F\x18\xA3C\xF9X\xB3\xC3\xD7\x8B\xFBP\x89\xCA\xC5\xD3\xC5\x91\xFD\xCB\x024\xA9\x15\xA1\x87C\x9D\x86\xA12J0` R`@\x90 T`\xFF\x16a\x03\x1FW`\0\x80\xFD[\x7F\x03@~\x0C\x85{kp\xFE\x95$:\x9F\xD14k\xA3\xC6ev\xC99\x11\x1El\x0E\x94\x02\xFD\xADN\xEE\x81`@Qa\x03N\x91\x90a\x07yV[`@Q\x80\x91\x03\x90\xA1PV[`\0\x82\x81R` \x81\x90R`@\x90 `\x01\x01Ta\x03t\x81a\x03~V[a\x02\x80\x83\x83a\x04\x87V[a\x03\x88\x813a\x05BV[PV[`\0\x82\x81R` \x81\x81R`@\x80\x83 s\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x85\x16\x84R\x90\x91R\x81 T`\xFF\x16a\x04\x7FW`\0\x83\x81R` \x81\x81R`@\x80\x83 s\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x86\x16\x84R\x90\x91R\x90 \x80T\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xF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FF\xFF\xFF\xFF\x85\x16\x84R\x90\x91R\x90 T`\xFF\x16a\x05\xCCW`@Q\x7F\xE2Q}?\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\x81Rs\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x82\x16`\x04\x82\x01R`$\x81\x01\x83\x90R`D\x01`@Q\x80\x91\x03\x90\xFD[PPV[`\0` \x82\x84\x03\x12\x15a\x05\xE2W`\0\x80\xFD[\x815\x7F\xFF\xFF\xFF\xFF\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\x81\x16\x81\x14a\x06\x12W`\0\x80\xFD[\x93\x92PPPV[`\0` \x82\x84\x03\x12\x15a\x06+W`\0\x80\xFD[P5\x91\x90PV[`\0\x80`@\x83\x85\x03\x12\x15a\x06EW`\0\x80\xFD[\x825\x91P` \x83\x015s\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x81\x16\x81\x14a\x06pW`\0\x80\xFD[\x80\x91PP\x92P\x92\x90PV[\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[`\0` \x82\x84\x03\x12\x15a\x06\xBCW`\0\x80\xFD[\x815g\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x80\x82\x11\x15a\x06\xD4W`\0\x80\xFD[\x81\x84\x01\x91P\x84`\x1F\x83\x01\x12a\x06\xE8W`\0\x80\xFD[\x815\x81\x81\x11\x15a\x06\xFAWa\x06\xFAa\x06{V[`@Q`\x1F\x82\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\x90\x81\x16`?\x01\x16\x81\x01\x90\x83\x82\x11\x81\x83\x10\x17\x15a\x07@Wa\x07@a\x06{V[\x81`@R\x82\x81R\x87` \x84\x87\x01\x01\x11\x15a\x07YW`\0\x80\xFD[\x82` \x86\x01` \x83\x017`\0\x92\x81\x01` \x01\x92\x90\x92RP\x95\x94PPPPPV[`\0` \x80\x83R\x83Q\x80\x82\x85\x01R`\0[\x81\x81\x10\x15a\x07\xA6W\x85\x81\x01\x83\x01Q\x85\x82\x01`@\x01R\x82\x01a\x07\x8AV[P`\0`@\x82\x86\x01\x01R`@\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`\x1F\x83\x01\x16\x85\x01\x01\x92PPP\x92\x91PPV\xFE\xA2dipfsX\"\x12 sF\xA0\x01\xC3\xA3\xED\xC4\xE2t\xA5+\xC2\xA9dyuZ\x16\xB9C \x92]\x12\x85\xE8\x9E\0\xABt\xCEdsolcC\0\x08\x15\x003"; /// The deployed bytecode of the contract. - pub static MEASURE_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = - ::ethers::core::types::Bytes::from_static(__DEPLOYED_BYTECODE); + pub static MEASURE_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( + __DEPLOYED_BYTECODE, + ); pub struct Measure(::ethers::contract::Contract); impl ::core::clone::Clone for Measure { fn clone(&self) -> Self { @@ -79,9 +464,7 @@ pub mod measure { } impl ::core::fmt::Debug for Measure { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_tuple(::core::stringify!(Measure)) - .field(&self.address()) - .finish() + f.debug_tuple(::core::stringify!(Measure)).field(&self.address()).finish() } } impl Measure { @@ -91,11 +474,13 @@ pub mod measure { address: T, client: ::std::sync::Arc, ) -> Self { - Self(::ethers::contract::Contract::new( - address.into(), - MEASURE_ABI.clone(), - client, - )) + Self( + ::ethers::contract::Contract::new( + address.into(), + MEASURE_ABI.clone(), + client, + ), + ) } /// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it. /// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction @@ -136,36 +521,269 @@ pub mod measure { let deployer = ::ethers::contract::ContractDeployer::new(deployer); Ok(deployer) } + ///Calls the contract's `COMMITMENT_ROLE` (0x0725067a) function + pub fn commitment_role( + &self, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([7, 37, 6, 122], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `DEFAULT_ADMIN_ROLE` (0xa217fddf) function + pub fn default_admin_role( + &self, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([162, 23, 253, 223], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `getRoleAdmin` (0x248a9ca3) function + pub fn get_role_admin( + &self, + role: [u8; 32], + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([36, 138, 156, 163], role) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `grantRole` (0x2f2ff15d) function + pub fn grant_role( + &self, + role: [u8; 32], + account: ::ethers::core::types::Address, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([47, 47, 241, 93], (role, account)) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `hasRole` (0x91d14854) function + pub fn has_role( + &self, + role: [u8; 32], + account: ::ethers::core::types::Address, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([145, 209, 72, 84], (role, account)) + .expect("method not found (this should never happen)") + } ///Calls the contract's `measure` (0xca3bd3f3) function pub fn measure( &self, - data: ::std::string::String, + data_commitment: ::std::string::String, ) -> ::ethers::contract::builders::ContractCall { self.0 - .method_hash([202, 59, 211, 243], data) + .method_hash([202, 59, 211, 243], data_commitment) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `renounceRole` (0x36568abe) function + pub fn renounce_role( + &self, + role: [u8; 32], + caller_confirmation: ::ethers::core::types::Address, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([54, 86, 138, 190], (role, caller_confirmation)) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `revokeRole` (0xd547741f) function + pub fn revoke_role( + &self, + role: [u8; 32], + account: ::ethers::core::types::Address, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([213, 71, 116, 31], (role, account)) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `supportsInterface` (0x01ffc9a7) function + pub fn supports_interface( + &self, + interface_id: [u8; 4], + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([1, 255, 201, 167], interface_id) .expect("method not found (this should never happen)") } ///Gets the contract's `Measurement` event pub fn measurement_filter( &self, - ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, MeasurementFilter> - { + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + MeasurementFilter, + > { + self.0.event() + } + ///Gets the contract's `RoleAdminChanged` event + pub fn role_admin_changed_filter( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + RoleAdminChangedFilter, + > { + self.0.event() + } + ///Gets the contract's `RoleGranted` event + pub fn role_granted_filter( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + RoleGrantedFilter, + > { + self.0.event() + } + ///Gets the contract's `RoleRevoked` event + pub fn role_revoked_filter( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + RoleRevokedFilter, + > { self.0.event() } /// Returns an `Event` builder for all the events of this contract. pub fn events( &self, - ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, MeasurementFilter> - { - self.0 - .event_with_filter(::core::default::Default::default()) + ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, MeasureEvents> { + self.0.event_with_filter(::core::default::Default::default()) } } - impl From<::ethers::contract::Contract> for Measure { + impl From<::ethers::contract::Contract> + for Measure { fn from(contract: ::ethers::contract::Contract) -> Self { Self::new(contract.address(), contract.client()) } } + ///Custom Error type `AccessControlBadConfirmation` with signature `AccessControlBadConfirmation()` and selector `0x6697b232` + #[derive( + Clone, + ::ethers::contract::EthError, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[etherror( + name = "AccessControlBadConfirmation", + abi = "AccessControlBadConfirmation()" + )] + pub struct AccessControlBadConfirmation; + ///Custom Error type `AccessControlUnauthorizedAccount` with signature `AccessControlUnauthorizedAccount(address,bytes32)` and selector `0xe2517d3f` + #[derive( + Clone, + ::ethers::contract::EthError, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[etherror( + name = "AccessControlUnauthorizedAccount", + abi = "AccessControlUnauthorizedAccount(address,bytes32)" + )] + pub struct AccessControlUnauthorizedAccount { + pub account: ::ethers::core::types::Address, + pub needed_role: [u8; 32], + } + ///Container type for all of the contract's custom errors + #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] + pub enum MeasureErrors { + AccessControlBadConfirmation(AccessControlBadConfirmation), + AccessControlUnauthorizedAccount(AccessControlUnauthorizedAccount), + /// The standard solidity revert string, with selector + /// Error(string) -- 0x08c379a0 + RevertString(::std::string::String), + } + impl ::ethers::core::abi::AbiDecode for MeasureErrors { + fn decode( + data: impl AsRef<[u8]>, + ) -> ::core::result::Result { + let data = data.as_ref(); + if let Ok(decoded) + = <::std::string::String as ::ethers::core::abi::AbiDecode>::decode( + data, + ) { + return Ok(Self::RevertString(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::AccessControlBadConfirmation(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::AccessControlUnauthorizedAccount(decoded)); + } + Err(::ethers::core::abi::Error::InvalidData.into()) + } + } + impl ::ethers::core::abi::AbiEncode for MeasureErrors { + fn encode(self) -> ::std::vec::Vec { + match self { + Self::AccessControlBadConfirmation(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::AccessControlUnauthorizedAccount(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::RevertString(s) => ::ethers::core::abi::AbiEncode::encode(s), + } + } + } + impl ::ethers::contract::ContractRevert for MeasureErrors { + fn valid_selector(selector: [u8; 4]) -> bool { + match selector { + [0x08, 0xc3, 0x79, 0xa0] => true, + _ if selector + == ::selector() => { + true + } + _ if selector + == ::selector() => { + true + } + _ => false, + } + } + } + impl ::core::fmt::Display for MeasureErrors { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Self::AccessControlBadConfirmation(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::AccessControlUnauthorizedAccount(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::RevertString(s) => ::core::fmt::Display::fmt(s, f), + } + } + } + impl ::core::convert::From<::std::string::String> for MeasureErrors { + fn from(value: String) -> Self { + Self::RevertString(value) + } + } + impl ::core::convert::From for MeasureErrors { + fn from(value: AccessControlBadConfirmation) -> Self { + Self::AccessControlBadConfirmation(value) + } + } + impl ::core::convert::From for MeasureErrors { + fn from(value: AccessControlUnauthorizedAccount) -> Self { + Self::AccessControlUnauthorizedAccount(value) + } + } #[derive( Clone, ::ethers::contract::EthEvent, @@ -174,11 +792,203 @@ pub mod measure { Debug, PartialEq, Eq, - Hash, + Hash )] #[ethevent(name = "Measurement", abi = "Measurement(string)")] pub struct MeasurementFilter { - pub data: ::std::string::String, + pub data_commitment: ::std::string::String, + } + #[derive( + Clone, + ::ethers::contract::EthEvent, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethevent( + name = "RoleAdminChanged", + abi = "RoleAdminChanged(bytes32,bytes32,bytes32)" + )] + pub struct RoleAdminChangedFilter { + #[ethevent(indexed)] + pub role: [u8; 32], + #[ethevent(indexed)] + pub previous_admin_role: [u8; 32], + #[ethevent(indexed)] + pub new_admin_role: [u8; 32], + } + #[derive( + Clone, + ::ethers::contract::EthEvent, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethevent(name = "RoleGranted", abi = "RoleGranted(bytes32,address,address)")] + pub struct RoleGrantedFilter { + #[ethevent(indexed)] + pub role: [u8; 32], + #[ethevent(indexed)] + pub account: ::ethers::core::types::Address, + #[ethevent(indexed)] + pub sender: ::ethers::core::types::Address, + } + #[derive( + Clone, + ::ethers::contract::EthEvent, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethevent(name = "RoleRevoked", abi = "RoleRevoked(bytes32,address,address)")] + pub struct RoleRevokedFilter { + #[ethevent(indexed)] + pub role: [u8; 32], + #[ethevent(indexed)] + pub account: ::ethers::core::types::Address, + #[ethevent(indexed)] + pub sender: ::ethers::core::types::Address, + } + ///Container type for all of the contract's events + #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] + pub enum MeasureEvents { + MeasurementFilter(MeasurementFilter), + RoleAdminChangedFilter(RoleAdminChangedFilter), + RoleGrantedFilter(RoleGrantedFilter), + RoleRevokedFilter(RoleRevokedFilter), + } + impl ::ethers::contract::EthLogDecode for MeasureEvents { + fn decode_log( + log: &::ethers::core::abi::RawLog, + ) -> ::core::result::Result { + if let Ok(decoded) = MeasurementFilter::decode_log(log) { + return Ok(MeasureEvents::MeasurementFilter(decoded)); + } + if let Ok(decoded) = RoleAdminChangedFilter::decode_log(log) { + return Ok(MeasureEvents::RoleAdminChangedFilter(decoded)); + } + if let Ok(decoded) = RoleGrantedFilter::decode_log(log) { + return Ok(MeasureEvents::RoleGrantedFilter(decoded)); + } + if let Ok(decoded) = RoleRevokedFilter::decode_log(log) { + return Ok(MeasureEvents::RoleRevokedFilter(decoded)); + } + Err(::ethers::core::abi::Error::InvalidData) + } + } + impl ::core::fmt::Display for MeasureEvents { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Self::MeasurementFilter(element) => ::core::fmt::Display::fmt(element, f), + Self::RoleAdminChangedFilter(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::RoleGrantedFilter(element) => ::core::fmt::Display::fmt(element, f), + Self::RoleRevokedFilter(element) => ::core::fmt::Display::fmt(element, f), + } + } + } + impl ::core::convert::From for MeasureEvents { + fn from(value: MeasurementFilter) -> Self { + Self::MeasurementFilter(value) + } + } + impl ::core::convert::From for MeasureEvents { + fn from(value: RoleAdminChangedFilter) -> Self { + Self::RoleAdminChangedFilter(value) + } + } + impl ::core::convert::From for MeasureEvents { + fn from(value: RoleGrantedFilter) -> Self { + Self::RoleGrantedFilter(value) + } + } + impl ::core::convert::From for MeasureEvents { + fn from(value: RoleRevokedFilter) -> Self { + Self::RoleRevokedFilter(value) + } + } + ///Container type for all input parameters for the `COMMITMENT_ROLE` function with signature `COMMITMENT_ROLE()` and selector `0x0725067a` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "COMMITMENT_ROLE", abi = "COMMITMENT_ROLE()")] + pub struct CommitmentRoleCall; + ///Container type for all input parameters for the `DEFAULT_ADMIN_ROLE` function with signature `DEFAULT_ADMIN_ROLE()` and selector `0xa217fddf` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "DEFAULT_ADMIN_ROLE", abi = "DEFAULT_ADMIN_ROLE()")] + pub struct DefaultAdminRoleCall; + ///Container type for all input parameters for the `getRoleAdmin` function with signature `getRoleAdmin(bytes32)` and selector `0x248a9ca3` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "getRoleAdmin", abi = "getRoleAdmin(bytes32)")] + pub struct GetRoleAdminCall { + pub role: [u8; 32], + } + ///Container type for all input parameters for the `grantRole` function with signature `grantRole(bytes32,address)` and selector `0x2f2ff15d` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "grantRole", abi = "grantRole(bytes32,address)")] + pub struct GrantRoleCall { + pub role: [u8; 32], + pub account: ::ethers::core::types::Address, + } + ///Container type for all input parameters for the `hasRole` function with signature `hasRole(bytes32,address)` and selector `0x91d14854` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "hasRole", abi = "hasRole(bytes32,address)")] + pub struct HasRoleCall { + pub role: [u8; 32], + pub account: ::ethers::core::types::Address, } ///Container type for all input parameters for the `measure` function with signature `measure(string)` and selector `0xca3bd3f3` #[derive( @@ -189,10 +999,267 @@ pub mod measure { Debug, PartialEq, Eq, - Hash, + Hash )] #[ethcall(name = "measure", abi = "measure(string)")] pub struct MeasureCall { - pub data: ::std::string::String, + pub data_commitment: ::std::string::String, + } + ///Container type for all input parameters for the `renounceRole` function with signature `renounceRole(bytes32,address)` and selector `0x36568abe` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "renounceRole", abi = "renounceRole(bytes32,address)")] + pub struct RenounceRoleCall { + pub role: [u8; 32], + pub caller_confirmation: ::ethers::core::types::Address, } + ///Container type for all input parameters for the `revokeRole` function with signature `revokeRole(bytes32,address)` and selector `0xd547741f` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "revokeRole", abi = "revokeRole(bytes32,address)")] + pub struct RevokeRoleCall { + pub role: [u8; 32], + pub account: ::ethers::core::types::Address, + } + ///Container type for all input parameters for the `supportsInterface` function with signature `supportsInterface(bytes4)` and selector `0x01ffc9a7` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "supportsInterface", abi = "supportsInterface(bytes4)")] + pub struct SupportsInterfaceCall { + pub interface_id: [u8; 4], + } + ///Container type for all of the contract's call + #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] + pub enum MeasureCalls { + CommitmentRole(CommitmentRoleCall), + DefaultAdminRole(DefaultAdminRoleCall), + GetRoleAdmin(GetRoleAdminCall), + GrantRole(GrantRoleCall), + HasRole(HasRoleCall), + Measure(MeasureCall), + RenounceRole(RenounceRoleCall), + RevokeRole(RevokeRoleCall), + SupportsInterface(SupportsInterfaceCall), + } + impl ::ethers::core::abi::AbiDecode for MeasureCalls { + fn decode( + data: impl AsRef<[u8]>, + ) -> ::core::result::Result { + let data = data.as_ref(); + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::CommitmentRole(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::DefaultAdminRole(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::GetRoleAdmin(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::GrantRole(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::HasRole(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::Measure(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::RenounceRole(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::RevokeRole(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::SupportsInterface(decoded)); + } + Err(::ethers::core::abi::Error::InvalidData.into()) + } + } + impl ::ethers::core::abi::AbiEncode for MeasureCalls { + fn encode(self) -> Vec { + match self { + Self::CommitmentRole(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::DefaultAdminRole(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::GetRoleAdmin(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::GrantRole(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::HasRole(element) => ::ethers::core::abi::AbiEncode::encode(element), + Self::Measure(element) => ::ethers::core::abi::AbiEncode::encode(element), + Self::RenounceRole(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::RevokeRole(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::SupportsInterface(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + } + } + } + impl ::core::fmt::Display for MeasureCalls { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Self::CommitmentRole(element) => ::core::fmt::Display::fmt(element, f), + Self::DefaultAdminRole(element) => ::core::fmt::Display::fmt(element, f), + Self::GetRoleAdmin(element) => ::core::fmt::Display::fmt(element, f), + Self::GrantRole(element) => ::core::fmt::Display::fmt(element, f), + Self::HasRole(element) => ::core::fmt::Display::fmt(element, f), + Self::Measure(element) => ::core::fmt::Display::fmt(element, f), + Self::RenounceRole(element) => ::core::fmt::Display::fmt(element, f), + Self::RevokeRole(element) => ::core::fmt::Display::fmt(element, f), + Self::SupportsInterface(element) => ::core::fmt::Display::fmt(element, f), + } + } + } + impl ::core::convert::From for MeasureCalls { + fn from(value: CommitmentRoleCall) -> Self { + Self::CommitmentRole(value) + } + } + impl ::core::convert::From for MeasureCalls { + fn from(value: DefaultAdminRoleCall) -> Self { + Self::DefaultAdminRole(value) + } + } + impl ::core::convert::From for MeasureCalls { + fn from(value: GetRoleAdminCall) -> Self { + Self::GetRoleAdmin(value) + } + } + impl ::core::convert::From for MeasureCalls { + fn from(value: GrantRoleCall) -> Self { + Self::GrantRole(value) + } + } + impl ::core::convert::From for MeasureCalls { + fn from(value: HasRoleCall) -> Self { + Self::HasRole(value) + } + } + impl ::core::convert::From for MeasureCalls { + fn from(value: MeasureCall) -> Self { + Self::Measure(value) + } + } + impl ::core::convert::From for MeasureCalls { + fn from(value: RenounceRoleCall) -> Self { + Self::RenounceRole(value) + } + } + impl ::core::convert::From for MeasureCalls { + fn from(value: RevokeRoleCall) -> Self { + Self::RevokeRole(value) + } + } + impl ::core::convert::From for MeasureCalls { + fn from(value: SupportsInterfaceCall) -> Self { + Self::SupportsInterface(value) + } + } + ///Container type for all return fields from the `COMMITMENT_ROLE` function with signature `COMMITMENT_ROLE()` and selector `0x0725067a` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct CommitmentRoleReturn(pub [u8; 32]); + ///Container type for all return fields from the `DEFAULT_ADMIN_ROLE` function with signature `DEFAULT_ADMIN_ROLE()` and selector `0xa217fddf` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct DefaultAdminRoleReturn(pub [u8; 32]); + ///Container type for all return fields from the `getRoleAdmin` function with signature `getRoleAdmin(bytes32)` and selector `0x248a9ca3` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct GetRoleAdminReturn(pub [u8; 32]); + ///Container type for all return fields from the `hasRole` function with signature `hasRole(bytes32,address)` and selector `0x91d14854` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct HasRoleReturn(pub bool); + ///Container type for all return fields from the `supportsInterface` function with signature `supportsInterface(bytes4)` and selector `0x01ffc9a7` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct SupportsInterfaceReturn(pub bool); } diff --git a/contract-utils/openzeppelin-contracts b/contract-utils/openzeppelin-contracts deleted file mode 160000 index 54a235f..0000000 --- a/contract-utils/openzeppelin-contracts +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 54a235f8959ecffb1916cf5693ec9bbd695cbf71 diff --git a/contract-utils/src/lib.rs b/contract-utils/src/lib.rs index 2731fbf..b125a50 100644 --- a/contract-utils/src/lib.rs +++ b/contract-utils/src/lib.rs @@ -22,12 +22,13 @@ pub mod measure { client: Arc, retries: usize, provider: Provider, + address: H160, ) -> Result> { let gas_price = provider.get_gas_price().await?; println!("current gas price: {:#?}", gas_price); println!("using {} retries", retries); - let mut contract = Measure::deploy(client.clone(), ())?; + let mut contract = Measure::deploy(client.clone(), address)?; let tx = contract.deployer.tx.clone(); set_tx_gas( &mut contract.deployer.tx, diff --git a/contract-utils/src/main.rs b/contract-utils/src/main.rs index b8d912a..6c81675 100644 --- a/contract-utils/src/main.rs +++ b/contract-utils/src/main.rs @@ -21,7 +21,7 @@ async fn main() { .await .unwrap(); let client = Arc::new(ledger_client); - deploy_factory_contract(client.clone(), RETRIES, provider) + deploy_factory_contract(client.clone(), RETRIES, provider, client.address()) .await .unwrap(); } @@ -32,7 +32,7 @@ async fn main() { .await .unwrap(); let client = Arc::new(local_client); - deploy_factory_contract(client.clone(), RETRIES, provider) + deploy_factory_contract(client.clone(), RETRIES, provider, client.address()) .await .unwrap(); } diff --git a/contract-utils/tests/integration_tests.rs b/contract-utils/tests/integration_tests.rs index ecc4dc8..b489013 100644 --- a/contract-utils/tests/integration_tests.rs +++ b/contract-utils/tests/integration_tests.rs @@ -30,7 +30,7 @@ async fn deploy() -> Result<(), Box> { .await .unwrap(); let client = Arc::new(local_client); - let address = deploy_factory_contract(client.clone(), 15, provider) + let address = deploy_factory_contract(client.clone(), 15, provider, client.address()) .await .unwrap(); diff --git a/foundry.toml b/foundry.toml index a936d8e..6fadd3a 100644 --- a/foundry.toml +++ b/foundry.toml @@ -3,9 +3,9 @@ src = 'src' out = 'out' libs = ['lib'] fs_permissions = [{ access = "read", path = "./"}] -solc-version = "0.8.17" +solc-version = "0.8.21" optimizer = true optimizer-runs = 10_000_000 [rpc_endpoints] -hyperspace = "${HYPERSPACE_RPC_URL}" \ No newline at end of file +calibration = "https://api.calibration.node.glif.io/rpc/v1" \ No newline at end of file diff --git a/src/Measure.sol b/src/Measure.sol index c3dda7e..383ef64 100644 --- a/src/Measure.sol +++ b/src/Measure.sol @@ -1,11 +1,31 @@ // SPDX-License-Identifier: (MIT or Apache-2.0) -pragma solidity ^0.8.17; +import "../lib/openzeppelin-contracts/contracts/access/AccessControl.sol"; +pragma solidity ^0.8.19; -contract Measure { - event Measurement(string data); +/** + * @title Measure Contract + * @dev This contract submits commitments of arbitrary data on chain. + */ +contract Measure is AccessControl { + event Measurement(string dataCommitment); + bytes32 public constant COMMITMENT_ROLE = keccak256("COMMITMENT_ROLE"); - function measure(string memory data) public { - emit Measurement(data); - } + /** + * @dev Creates a measure contract with an admin + * @param admin The address of the factory admin. + **/ + constructor(address admin) { + _grantRole(DEFAULT_ADMIN_ROLE, admin); + _grantRole(COMMITMENT_ROLE, admin); + } + + /** + * @dev Emmits a Measurement event with a commitment to some arbitrary data. + * @param dataCommitment An arbitrary commitment to some data (eg. Merkle Root, KZG Commitment, etc.) + **/ + function measure(string memory dataCommitment) public { + require(hasRole(COMMITMENT_ROLE, msg.sender)); + emit Measurement(dataCommitment); + } }