diff --git a/Cargo.lock b/Cargo.lock index 498c87f..62c5eec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1409,8 +1409,11 @@ dependencies = [ name = "gateway-types" version = "0.1.0" dependencies = [ + "ethers", + "jsonrpsee 0.22.0", "lib-didethresolver", "serde", + "thiserror", ] [[package]] @@ -2235,6 +2238,16 @@ checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "messaging" version = "0.1.0" +dependencies = [ + "async-trait", + "ethers", + "gateway-types", + "log", + "serde", + "thiserror", + "tokio", + "tracing", +] [[package]] name = "mime" @@ -4497,6 +4510,7 @@ dependencies = [ "jsonrpsee 0.22.0", "lib-didethresolver", "log", + "messaging", "rand", "registry", "serde", diff --git a/Cargo.toml b/Cargo.toml index 3fc3be0..eb9acd3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,8 @@ [workspace] -members = [ - "xps-gateway", - "messaging", - "inbox", - "registry", - "gateway-types", -] +members = ["xps-gateway", "messaging", "inbox", "registry", "gateway-types"] -exclude = [ ] +exclude = [] # Make the feature resolver explicit. # See https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html#details diff --git a/gateway-types/Cargo.toml b/gateway-types/Cargo.toml index 5aea0be..54e9643 100644 --- a/gateway-types/Cargo.toml +++ b/gateway-types/Cargo.toml @@ -8,3 +8,6 @@ edition = "2021" [dependencies] serde.workspace = true lib-didethresolver.workspace = true +ethers.workspace = true +thiserror.workspace = true +jsonrpsee.workspace = true diff --git a/gateway-types/src/error.rs b/gateway-types/src/error.rs new file mode 100644 index 0000000..21d714f --- /dev/null +++ b/gateway-types/src/error.rs @@ -0,0 +1,19 @@ +use ethers::{ + abi::EncodePackedError, + contract::ContractError, + providers::{Middleware, ProviderError}, + signers::WalletError, +}; +use thiserror::Error; + +#[derive(Error, Debug)] +pub enum ExtSignerError { + #[error(transparent)] + Encode(#[from] EncodePackedError), + #[error("{0}")] + ContractError(#[from] ContractError), + #[error(transparent)] + Provider(#[from] ProviderError), + #[error(transparent)] + Wallet(#[from] WalletError), +} diff --git a/gateway-types/src/lib.rs b/gateway-types/src/lib.rs index dac8247..fd114e5 100644 --- a/gateway-types/src/lib.rs +++ b/gateway-types/src/lib.rs @@ -1,26 +1,28 @@ //! Shared types between XPS Gateawy and client (libxmtp) +pub mod error; +use ethers::types::{Address, Bytes as EthersBytes, Signature}; use std::fmt; use serde::{Deserialize, Serialize}; /// Address of the did:ethr Registry on Sepolia pub const DID_ETH_REGISTRY: &str = "0xd1D374DDE031075157fDb64536eF5cC13Ae75000"; +// Address of the Converstion on Sepolia +pub const CONVERSATION: &str = "0x15aE865d0645816d8EEAB0b7496fdd24227d1801"; /// A message sent to a conversation #[derive(Serialize, Deserialize)] pub struct Message { // Unique identifier for a conversation #[serde(rename = "conversationId")] - pub conversation_id: Vec, + pub conversation_id: [u8; 32], /// message content in bytes - pub payload: Vec, - /// Signature of V - pub v: Vec, - /// Signature of R - pub r: Vec, - /// Signature of S - pub s: Vec, + pub payload: EthersBytes, + // Sender's identity + pub identity: Address, + // Signature by sender + pub signature: Signature, } pub type Bytes = Vec; @@ -46,6 +48,13 @@ pub struct GrantInstallationResult { pub transaction: String, } +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] +pub struct SendMessageResult { + pub status: Status, + pub message: String, + pub transaction: String, +} + #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] pub struct KeyPackageResult { /// Status of the operation diff --git a/messaging/Cargo.toml b/messaging/Cargo.toml index a2e3d86..e43cd1e 100644 --- a/messaging/Cargo.toml +++ b/messaging/Cargo.toml @@ -6,3 +6,11 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +log.workspace = true +tracing.workspace = true +tokio.workspace = true +async-trait.workspace = true +ethers = { workspace = true, features = ["ws"] } +serde.workspace = true +thiserror.workspace = true +gateway-types.workspace = true diff --git a/messaging/abi/Conversation.json b/messaging/abi/Conversation.json new file mode 100644 index 0000000..0b3fe5e --- /dev/null +++ b/messaging/abi/Conversation.json @@ -0,0 +1,3937 @@ +{ + "abi": [ + { + "type": "constructor", + "inputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "DEFAULT_ADMIN_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "INBOX_ADMIN_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "UPGRADE_INTERFACE_VERSION", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getRoleAdmin", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "grantRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "hasRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "initialize", + "inputs": [ + { + "name": "_roleAdmin", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "lastMessage", + "inputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "nonce", + "inputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "proxiableUUID", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "renounceRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "callerConfirmation", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "revokeRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "sendMessage", + "inputs": [ + { + "name": "conversationId", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "payload", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "sendMessageSigned", + "inputs": [ + { + "name": "conversationId", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "payload", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "identity", + "type": "address", + "internalType": "address" + }, + { + "name": "sigV", + "type": "uint8", + "internalType": "uint8" + }, + { + "name": "sigR", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "sigS", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "supportsInterface", + "inputs": [ + { + "name": "interfaceId", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "upgradeToAndCall", + "inputs": [ + { + "name": "newImplementation", + "type": "address", + "internalType": "address" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "event", + "name": "Initialized", + "inputs": [ + { + "name": "version", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "PayloadSent", + "inputs": [ + { + "name": "conversationId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "payload", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + }, + { + "name": "lastMessage", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleAdminChanged", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "previousAdminRole", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "newAdminRole", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleGranted", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleRevoked", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Upgraded", + "inputs": [ + { + "name": "implementation", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AccessControlBadConfirmation", + "inputs": [] + }, + { + "type": "error", + "name": "AccessControlUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + }, + { + "name": "neededRole", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "AddressEmptyCode", + "inputs": [ + { + "name": "target", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ERC1967InvalidImplementation", + "inputs": [ + { + "name": "implementation", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ERC1967NonPayable", + "inputs": [] + }, + { + "type": "error", + "name": "FailedInnerCall", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidInitialization", + "inputs": [] + }, + { + "type": "error", + "name": "NotInitializing", + "inputs": [] + }, + { + "type": "error", + "name": "SignatureValidationFailed", + "inputs": [ + { + "name": "identity", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "UUPSUnauthorizedCallContext", + "inputs": [] + }, + { + "type": "error", + "name": "UUPSUnsupportedProxiableUUID", + "inputs": [ + { + "name": "slot", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ], + "bytecode": { + "object": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100d4565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff16156100725760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b03908116146100d15780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b6080516110336100fd600039600081816108740152818161089d0152610a0201526110336000f3fe6080604052600436106100f35760003560e01c80635c1e40161161008a578063ad3cb1cc11610059578063ad3cb1cc146102ab578063c4d66de8146102e9578063cca0a22714610309578063d547741f1461033657600080fd5b80635c1e40161461021557806370ae92d21461024957806391d1485414610276578063a217fddf1461029657600080fd5b806336568abe116100c657806336568abe146101ad5780634f1ef286146101cd57806352d1902d146101e0578063559efc88146101f557600080fd5b806301ffc9a7146100f857806323c640e71461012d578063248a9ca31461014f5780632f2ff15d1461018d575b600080fd5b34801561010457600080fd5b50610118610113366004610c51565b610356565b60405190151581526020015b60405180910390f35b34801561013957600080fd5b5061014d610148366004610d1e565b61039c565b005b34801561015b57600080fd5b5061017f61016a366004610d65565b60009081526020819052604090206001015490565b604051908152602001610124565b34801561019957600080fd5b5061014d6101a8366004610d9a565b6103fd565b3480156101b957600080fd5b5061014d6101c8366004610d9a565b610428565b61014d6101db366004610dc6565b610460565b3480156101ec57600080fd5b5061017f61047f565b34801561020157600080fd5b5061014d610210366004610dfe565b61049c565b34801561022157600080fd5b5061017f7f8d5056aeb79a6b07f63ee707a19b263637ccb9ccdc7ea724d0d89fdf7acd558f81565b34801561025557600080fd5b5061017f610264366004610e80565b60026020526000908152604090205481565b34801561028257600080fd5b50610118610291366004610d9a565b6105c9565b3480156102a257600080fd5b5061017f600081565b3480156102b757600080fd5b506102dc604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516101249190610eeb565b3480156102f557600080fd5b5061014d610304366004610e80565b6105f2565b34801561031557600080fd5b5061017f610324366004610d65565b60016020526000908152604090205481565b34801561034257600080fd5b5061014d610351366004610d9a565b610705565b60006001600160e01b0319821663175f03c960e31b148061038757506001600160e01b03198216637965db0b60e01b145b8061039657506103968261072a565b92915050565b6000828152600160205260409081902054905183907fd2afa7ef453ac5d62ebf3223422dd06627763d7b5573e14b9312be7efb214dcd906103e09085908590610efe565b60405180910390a250506000908152600160205260409020439055565b6000828152602081905260409020600101546104188161075f565b610422838361076c565b50505050565b6001600160a01b03811633146104515760405163334bd91960e11b815260040160405180910390fd5b61045b82826107fe565b505050565b610468610869565b61047182610910565b61047b828261093a565b5050565b60006104896109f7565b50600080516020610fde83398151915290565b6001600160a01b03841660009081526002602090815260408083205490519092916104d791601960f81b9184918c918c918c91899101610f20565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610542573d6000803e3d6000fd5b505050602060405103519050866001600160a01b0316816001600160a01b0316146105905760405163086a9f7560e41b81526001600160a01b03881660048201526024015b60405180910390fd5b61059b836001610f87565b6001600160a01b0388166000908152600260205260409020556105be898961039c565b505050505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff166000811580156106385750825b905060008267ffffffffffffffff1660011480156106555750303b155b905081158015610663575080155b156106815760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156106ab57845460ff60401b1916600160401b1785555b6106b660008761076c565b5083156106fd57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b6000828152602081905260409020600101546107208161075f565b61042283836107fe565b60006001600160e01b03198216637965db0b60e01b148061039657506301ffc9a760e01b6001600160e01b0319831614610396565b6107698133610a40565b50565b600061077883836105c9565b6107f6576000838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556107ae3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610396565b506000610396565b600061080a83836105c9565b156107f6576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610396565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806108f057507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108e4600080516020610fde833981519152546001600160a01b031690565b6001600160a01b031614155b1561090e5760405163703e46dd60e11b815260040160405180910390fd5b565b7f8d5056aeb79a6b07f63ee707a19b263637ccb9ccdc7ea724d0d89fdf7acd558f61047b8161075f565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610994575060408051601f3d908101601f1916820190925261099191810190610fa8565b60015b6109bc57604051634c9c8ce360e01b81526001600160a01b0383166004820152602401610587565b600080516020610fde83398151915281146109ed57604051632a87526960e21b815260048101829052602401610587565b61045b8383610a79565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461090e5760405163703e46dd60e11b815260040160405180910390fd5b610a4a82826105c9565b61047b5760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610587565b610a8282610acf565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115610ac75761045b8282610b34565b61047b610baa565b806001600160a01b03163b600003610b0557604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610587565b600080516020610fde83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b031684604051610b519190610fc1565b600060405180830381855af49150503d8060008114610b8c576040519150601f19603f3d011682016040523d82523d6000602084013e610b91565b606091505b5091509150610ba1858383610bc9565b95945050505050565b341561090e5760405163b398979f60e01b815260040160405180910390fd5b606082610bde57610bd982610c28565b610c21565b8151158015610bf557506001600160a01b0384163b155b15610c1e57604051639996b31560e01b81526001600160a01b0385166004820152602401610587565b50805b9392505050565b805115610c385780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b600060208284031215610c6357600080fd5b81356001600160e01b031981168114610c2157600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f830112610ca257600080fd5b813567ffffffffffffffff80821115610cbd57610cbd610c7b565b604051601f8301601f19908116603f01168101908282118183101715610ce557610ce5610c7b565b81604052838152866020858801011115610cfe57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215610d3157600080fd5b82359150602083013567ffffffffffffffff811115610d4f57600080fd5b610d5b85828601610c91565b9150509250929050565b600060208284031215610d7757600080fd5b5035919050565b80356001600160a01b0381168114610d9557600080fd5b919050565b60008060408385031215610dad57600080fd5b82359150610dbd60208401610d7e565b90509250929050565b60008060408385031215610dd957600080fd5b610de283610d7e565b9150602083013567ffffffffffffffff811115610d4f57600080fd5b60008060008060008060c08789031215610e1757600080fd5b86359550602087013567ffffffffffffffff811115610e3557600080fd5b610e4189828a01610c91565b955050610e5060408801610d7e565b9350606087013560ff81168114610e6657600080fd5b9598949750929560808101359460a0909101359350915050565b600060208284031215610e9257600080fd5b610c2182610d7e565b60005b83811015610eb6578181015183820152602001610e9e565b50506000910152565b60008151808452610ed7816020860160208601610e9b565b601f01601f19169290920160200192915050565b602081526000610c216020830184610ebf565b604081526000610f116040830185610ebf565b90508260208301529392505050565b6001600160f81b0319878116825286166001820152600281018590528351600090610f52816022850160208901610e9b565b80830190506bffffffffffffffffffffffff198560601b16602282015283603682015260568101915050979650505050505050565b8082018082111561039657634e487b7160e01b600052601160045260246000fd5b600060208284031215610fba57600080fd5b5051919050565b60008251610fd3818460208701610e9b565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca264697066735822122029b90bdef6517673dae36e7e0daa09911bab163f762dc626d41d787a5af9384b64736f6c63430008140033", + "sourceMap": "895:2657:0:-:0;;;1060:4:31;1017:48;;1229:53:0;;;;;;;;;-1:-1:-1;1253:22:0;:20;:22::i;:::-;895:2657;;7711:422:30;8870:21;7900:15;;;;;;;7896:76;;;7938:23;;-1:-1:-1;;;7938:23:30;;;;;;;;;;;7896:76;7985:14;;-1:-1:-1;;;;;7985:14:30;;;:34;7981:146;;8035:33;;-1:-1:-1;;;;;;8035:33:30;-1:-1:-1;;;;;8035:33:30;;;;;8087:29;;158:50:39;;;8087:29:30;;146:2:39;131:18;8087:29:30;;;;;;;7981:146;7760:373;7711:422::o;14:200:39:-;895:2657:0;;;;;;;;;;;;;;;;;;;;;;", + "linkReferences": {} + }, + "deployedBytecode": { + "object": "0x6080604052600436106100f35760003560e01c80635c1e40161161008a578063ad3cb1cc11610059578063ad3cb1cc146102ab578063c4d66de8146102e9578063cca0a22714610309578063d547741f1461033657600080fd5b80635c1e40161461021557806370ae92d21461024957806391d1485414610276578063a217fddf1461029657600080fd5b806336568abe116100c657806336568abe146101ad5780634f1ef286146101cd57806352d1902d146101e0578063559efc88146101f557600080fd5b806301ffc9a7146100f857806323c640e71461012d578063248a9ca31461014f5780632f2ff15d1461018d575b600080fd5b34801561010457600080fd5b50610118610113366004610c51565b610356565b60405190151581526020015b60405180910390f35b34801561013957600080fd5b5061014d610148366004610d1e565b61039c565b005b34801561015b57600080fd5b5061017f61016a366004610d65565b60009081526020819052604090206001015490565b604051908152602001610124565b34801561019957600080fd5b5061014d6101a8366004610d9a565b6103fd565b3480156101b957600080fd5b5061014d6101c8366004610d9a565b610428565b61014d6101db366004610dc6565b610460565b3480156101ec57600080fd5b5061017f61047f565b34801561020157600080fd5b5061014d610210366004610dfe565b61049c565b34801561022157600080fd5b5061017f7f8d5056aeb79a6b07f63ee707a19b263637ccb9ccdc7ea724d0d89fdf7acd558f81565b34801561025557600080fd5b5061017f610264366004610e80565b60026020526000908152604090205481565b34801561028257600080fd5b50610118610291366004610d9a565b6105c9565b3480156102a257600080fd5b5061017f600081565b3480156102b757600080fd5b506102dc604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516101249190610eeb565b3480156102f557600080fd5b5061014d610304366004610e80565b6105f2565b34801561031557600080fd5b5061017f610324366004610d65565b60016020526000908152604090205481565b34801561034257600080fd5b5061014d610351366004610d9a565b610705565b60006001600160e01b0319821663175f03c960e31b148061038757506001600160e01b03198216637965db0b60e01b145b8061039657506103968261072a565b92915050565b6000828152600160205260409081902054905183907fd2afa7ef453ac5d62ebf3223422dd06627763d7b5573e14b9312be7efb214dcd906103e09085908590610efe565b60405180910390a250506000908152600160205260409020439055565b6000828152602081905260409020600101546104188161075f565b610422838361076c565b50505050565b6001600160a01b03811633146104515760405163334bd91960e11b815260040160405180910390fd5b61045b82826107fe565b505050565b610468610869565b61047182610910565b61047b828261093a565b5050565b60006104896109f7565b50600080516020610fde83398151915290565b6001600160a01b03841660009081526002602090815260408083205490519092916104d791601960f81b9184918c918c918c91899101610f20565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610542573d6000803e3d6000fd5b505050602060405103519050866001600160a01b0316816001600160a01b0316146105905760405163086a9f7560e41b81526001600160a01b03881660048201526024015b60405180910390fd5b61059b836001610f87565b6001600160a01b0388166000908152600260205260409020556105be898961039c565b505050505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff166000811580156106385750825b905060008267ffffffffffffffff1660011480156106555750303b155b905081158015610663575080155b156106815760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156106ab57845460ff60401b1916600160401b1785555b6106b660008761076c565b5083156106fd57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b6000828152602081905260409020600101546107208161075f565b61042283836107fe565b60006001600160e01b03198216637965db0b60e01b148061039657506301ffc9a760e01b6001600160e01b0319831614610396565b6107698133610a40565b50565b600061077883836105c9565b6107f6576000838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556107ae3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610396565b506000610396565b600061080a83836105c9565b156107f6576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610396565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806108f057507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166108e4600080516020610fde833981519152546001600160a01b031690565b6001600160a01b031614155b1561090e5760405163703e46dd60e11b815260040160405180910390fd5b565b7f8d5056aeb79a6b07f63ee707a19b263637ccb9ccdc7ea724d0d89fdf7acd558f61047b8161075f565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610994575060408051601f3d908101601f1916820190925261099191810190610fa8565b60015b6109bc57604051634c9c8ce360e01b81526001600160a01b0383166004820152602401610587565b600080516020610fde83398151915281146109ed57604051632a87526960e21b815260048101829052602401610587565b61045b8383610a79565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461090e5760405163703e46dd60e11b815260040160405180910390fd5b610a4a82826105c9565b61047b5760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610587565b610a8282610acf565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115610ac75761045b8282610b34565b61047b610baa565b806001600160a01b03163b600003610b0557604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610587565b600080516020610fde83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b031684604051610b519190610fc1565b600060405180830381855af49150503d8060008114610b8c576040519150601f19603f3d011682016040523d82523d6000602084013e610b91565b606091505b5091509150610ba1858383610bc9565b95945050505050565b341561090e5760405163b398979f60e01b815260040160405180910390fd5b606082610bde57610bd982610c28565b610c21565b8151158015610bf557506001600160a01b0384163b155b15610c1e57604051639996b31560e01b81526001600160a01b0385166004820152602401610587565b50805b9392505050565b805115610c385780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b600060208284031215610c6357600080fd5b81356001600160e01b031981168114610c2157600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f830112610ca257600080fd5b813567ffffffffffffffff80821115610cbd57610cbd610c7b565b604051601f8301601f19908116603f01168101908282118183101715610ce557610ce5610c7b565b81604052838152866020858801011115610cfe57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215610d3157600080fd5b82359150602083013567ffffffffffffffff811115610d4f57600080fd5b610d5b85828601610c91565b9150509250929050565b600060208284031215610d7757600080fd5b5035919050565b80356001600160a01b0381168114610d9557600080fd5b919050565b60008060408385031215610dad57600080fd5b82359150610dbd60208401610d7e565b90509250929050565b60008060408385031215610dd957600080fd5b610de283610d7e565b9150602083013567ffffffffffffffff811115610d4f57600080fd5b60008060008060008060c08789031215610e1757600080fd5b86359550602087013567ffffffffffffffff811115610e3557600080fd5b610e4189828a01610c91565b955050610e5060408801610d7e565b9350606087013560ff81168114610e6657600080fd5b9598949750929560808101359460a0909101359350915050565b600060208284031215610e9257600080fd5b610c2182610d7e565b60005b83811015610eb6578181015183820152602001610e9e565b50506000910152565b60008151808452610ed7816020860160208601610e9b565b601f01601f19169290920160200192915050565b602081526000610c216020830184610ebf565b604081526000610f116040830185610ebf565b90508260208301529392505050565b6001600160f81b0319878116825286166001820152600281018590528351600090610f52816022850160208901610e9b565b80830190506bffffffffffffffffffffffff198560601b16602282015283603682015260568101915050979650505050505050565b8082018082111561039657634e487b7160e01b600052601160045260246000fd5b600060208284031215610fba57600080fd5b5051919050565b60008251610fd3818460208701610e9b565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca264697066735822122029b90bdef6517673dae36e7e0daa09911bab163f762dc626d41d787a5af9384b64736f6c63430008140033", + "sourceMap": "895:2657:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3247:303;;;;;;;;;;-1:-1:-1;3247:303:0;;;;;:::i;:::-;;:::i;:::-;;;470:14:39;;463:22;445:41;;433:2;418:18;3247:303:0;;;;;;;;1619:243;;;;;;;;;;-1:-1:-1;1619:243:0;;;;;:::i;:::-;;:::i;:::-;;3810:120:22;;;;;;;;;;-1:-1:-1;3810:120:22;;;;;:::i;:::-;3875:7;3901:12;;;;;;;;;;:22;;;;3810:120;;;;2076:25:39;;;2064:2;2049:18;3810:120:22;1930:177:39;4226:136:22;;;;;;;;;;-1:-1:-1;4226:136:22;;;;;:::i;:::-;;:::i;5328:245::-;;;;;;;;;;-1:-1:-1;5328:245:22;;;;;:::i;:::-;;:::i;3892:214:31:-;;;;;;:::i;:::-;;:::i;3439:134::-;;;;;;;;;;;;;:::i;2256:609:0:-;;;;;;;;;;-1:-1:-1;2256:609:0;;;;;:::i;:::-;;:::i;987:72::-;;;;;;;;;;;;1030:29;987:72;;1118:40;;;;;;;;;;-1:-1:-1;1118:40:0;;;;;:::i;:::-;;;;;;;;;;;;;;2854:136:22;;;;;;;;;;-1:-1:-1;2854:136:22;;;;;:::i;:::-;;:::i;2187:49::-;;;;;;;;;;-1:-1:-1;2187:49:22;2232:4;2187:49;;1708:58:31;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;1708:58:31;;;;;;;;;;;;:::i;1345:118:0:-;;;;;;;;;;-1:-1:-1;1345:118:0;;;;;:::i;:::-;;:::i;1066:46::-;;;;;;;;;;-1:-1:-1;1066:46:0;;;;;:::i;:::-;;;;;;;;;;;;;;4642:138:22;;;;;;;;;;-1:-1:-1;4642:138:22;;;;;:::i;:::-;;:::i;3247:303:0:-;3347:4;-1:-1:-1;;;;;;3382:46:0;;-1:-1:-1;;;3382:46:0;;:109;;-1:-1:-1;;;;;;;3444:47:0;;-1:-1:-1;;;3444:47:0;3382:109;:161;;;;3507:36;3531:11;3507:23;:36::i;:::-;3363:180;3247:303;-1:-1:-1;;3247:303:0:o;1619:243::-;1703:11;1717:27;;;:11;:27;;;;;;;;1759:44;;1729:14;;1759:44;;;;1787:7;;1717:27;;1759:44;:::i;:::-;;;;;;;;-1:-1:-1;;1813:27:0;;;;:11;:27;;;;;1843:12;1813:42;;1619:243::o;4226:136:22:-;3875:7;3901:12;;;;;;;;;;:22;;;2464:16;2475:4;2464:10;:16::i;:::-;4330:25:::1;4341:4;4347:7;4330:10;:25::i;:::-;;4226:136:::0;;;:::o;5328:245::-;-1:-1:-1;;;;;5421:34:22;;735:10:33;5421:34:22;5417:102;;5478:30;;-1:-1:-1;;;5478:30:22;;;;;;;;;;;5417:102;5529:37;5541:4;5547:18;5529:11;:37::i;:::-;;5328:245;;:::o;3892:214:31:-;2542:13;:11;:13::i;:::-;4007:36:::1;4025:17;4007;:36::i;:::-;4053:46;4075:17;4094:4;4053:21;:46::i;:::-;3892:214:::0;;:::o;3439:134::-;3508:7;2813:20;:18;:20::i;:::-;-1:-1:-1;;;;;;;;;;;;3439:134:31;:::o;2256:609:0:-;-1:-1:-1;;;;;2477:15:0;;2460:14;2477:15;;;:5;:15;;;;;;;;;2542:84;;2477:15;;2460:14;2542:84;;-1:-1:-1;;;2559:12:0;2460:14;;2584;;2600:7;;2483:8;;2477:15;;2542:84;;:::i;:::-;;;;-1:-1:-1;;2542:84:0;;;;;;;;;2519:117;;2542:84;2519:117;;;;2646:14;2663:35;;;;;;;;;6097:25:39;;;6170:4;6158:17;;6138:18;;;6131:45;;;;6192:18;;;6185:34;;;6235:18;;;6228:34;;;2519:117:0;;-1:-1:-1;2646:14:0;2663:35;;6069:19:39;;2663:35:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2646:52;;2722:8;-1:-1:-1;;;;;2712:18:0;:6;-1:-1:-1;;;;;2712:18:0;;2708:66;;2739:35;;-1:-1:-1;;;2739:35:0;;-1:-1:-1;;;;;6437:32:39;;2739:35:0;;;6419:51:39;6392:18;;2739:35:0;;;;;;;;2708:66;2802:10;:6;2811:1;2802:10;:::i;:::-;-1:-1:-1;;;;;2784:15:0;;;;;;:5;:15;;;;;:28;2822:36;2834:14;2850:7;2822:11;:36::i;:::-;2450:415;;;2256:609;;;;;;:::o;2854:136:22:-;2931:4;2954:12;;;;;;;;;;;-1:-1:-1;;;;;2954:29:22;;;;;;;;;;;;;;;2854:136::o;1345:118:0:-;8870:21:30;4302:15;;-1:-1:-1;;;4302:15:30;;;;4301:16;;4348:14;;4158:30;4726:16;;:34;;;;;4746:14;4726:34;4706:54;;4770:17;4790:11;:16;;4805:1;4790:16;:50;;;;-1:-1:-1;4818:4:30;4810:25;:30;4790:50;4770:70;;4856:12;4855:13;:30;;;;;4873:12;4872:13;4855:30;4851:91;;;4908:23;;-1:-1:-1;;;4908:23:30;;;;;;;;;;;4851:91;4951:18;;-1:-1:-1;;4951:18:30;4968:1;4951:18;;;4979:67;;;;5013:22;;-1:-1:-1;;;;5013:22:30;-1:-1:-1;;;5013:22:30;;;4979:67;1414:42:0::1;2232:4:22;1445:10:0::0;1414::::1;:42::i;:::-;;5070:14:30::0;5066:101;;;5100:23;;-1:-1:-1;;;;5100:23:30;;;5142:14;;-1:-1:-1;6861:50:39;;5142:14:30;;6849:2:39;6834:18;5142:14:30;;;;;;;5066:101;4092:1081;;;;;1345:118:0;:::o;4642:138:22:-;3875:7;3901:12;;;;;;;;;;:22;;;2464:16;2475:4;2464:10;:16::i;:::-;4747:26:::1;4759:4;4765:7;4747:11;:26::i;2565:202::-:0;2650:4;-1:-1:-1;;;;;;2673:47:22;;-1:-1:-1;;;2673:47:22;;:87;;-1:-1:-1;;;;;;;;;;861:40:35;;;2724:36:22;762:146:35;3199:103:22;3265:30;3276:4;735:10:33;3265::22;:30::i;:::-;3199:103;:::o;6179:316::-;6256:4;6277:22;6285:4;6291:7;6277;:22::i;:::-;6272:217;;6315:6;:12;;;;;;;;;;;-1:-1:-1;;;;;6315:29:22;;;;;;;;;:36;;-1:-1:-1;;6315:36:22;6347:4;6315:36;;;6397:12;735:10:33;;656:96;6397:12:22;-1:-1:-1;;;;;6370:40:22;6388:7;-1:-1:-1;;;;;6370:40:22;6382:4;6370:40;;;;;;;;;;-1:-1:-1;6431:4:22;6424:11;;6272:217;-1:-1:-1;6473:5:22;6466:12;;6730:317;6808:4;6828:22;6836:4;6842:7;6828;:22::i;:::-;6824:217;;;6898:5;6866:12;;;;;;;;;;;-1:-1:-1;;;;;6866:29:22;;;;;;;;;;:37;;-1:-1:-1;;6866:37:22;;;6922:40;735:10:33;;6866:12:22;;6922:40;;6898:5;6922:40;-1:-1:-1;6983:4:22;6976:11;;4333:312:31;4413:4;-1:-1:-1;;;;;4422:6:31;4405:23;;;:120;;;4519:6;-1:-1:-1;;;;;4483:42:31;:32;-1:-1:-1;;;;;;;;;;;2035:53:27;-1:-1:-1;;;;;2035:53:27;;1957:138;4483:32:31;-1:-1:-1;;;;;4483:42:31;;;4405:120;4388:251;;;4599:29;;-1:-1:-1;;;4599:29:31;;;;;;;;;;;4388:251;4333:312::o;3024:170:0:-;1030:29;2464:16:22;2475:4;2464:10;:16::i;5786:538:31:-;5903:17;-1:-1:-1;;;;;5885:50:31;;:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5885:52:31;;;;;;;;-1:-1:-1;;5885:52:31;;;;;;;;;;;;:::i;:::-;;;5881:437;;6247:60;;-1:-1:-1;;;6247:60:31;;-1:-1:-1;;;;;6437:32:39;;6247:60:31;;;6419:51:39;6392:18;;6247:60:31;6273:203:39;5881:437:31;-1:-1:-1;;;;;;;;;;;5979:40:31;;5975:120;;6046:34;;-1:-1:-1;;;6046:34:31;;;;;2076:25:39;;;2049:18;;6046:34:31;1930:177:39;5975:120:31;6108:54;6138:17;6157:4;6108:29;:54::i;4762:213::-;4836:4;-1:-1:-1;;;;;4845:6:31;4828:23;;4824:145;;4929:29;;-1:-1:-1;;;4929:29:31;;;;;;;;;;;3432:197:22;3520:22;3528:4;3534:7;3520;:22::i;:::-;3515:108;;3565:47;;-1:-1:-1;;;3565:47:22;;-1:-1:-1;;;;;7303:32:39;;3565:47:22;;;7285:51:39;7352:18;;;7345:34;;;7258:18;;3565:47:22;7111:274:39;2779:335:27;2870:37;2889:17;2870:18;:37::i;:::-;2922:27;;-1:-1:-1;;;;;2922:27:27;;;;;;;;2964:11;;:15;2960:148;;2995:53;3024:17;3043:4;2995:28;:53::i;2960:148::-;3079:18;:16;:18::i;2186:281::-;2263:17;-1:-1:-1;;;;;2263:29:27;;2296:1;2263:34;2259:119;;2320:47;;-1:-1:-1;;;2320:47:27;;-1:-1:-1;;;;;6437:32:39;;2320:47:27;;;6419:51:39;6392:18;;2320:47:27;6273:203:39;2259:119:27;-1:-1:-1;;;;;;;;;;;2387:73:27;;-1:-1:-1;;;;;;2387:73:27;-1:-1:-1;;;;;2387:73:27;;;;;;;;;;2186:281::o;4106:253:32:-;4189:12;4214;4228:23;4255:6;-1:-1:-1;;;;;4255:19:32;4275:4;4255:25;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4213:67;;;;4297:55;4324:6;4332:7;4341:10;4297:26;:55::i;:::-;4290:62;4106:253;-1:-1:-1;;;;;4106:253:32:o;6598:122:27:-;6648:9;:13;6644:70;;6684:19;;-1:-1:-1;;;6684:19:27;;;;;;;;;;;4625:582:32;4769:12;4798:7;4793:408;;4821:19;4829:10;4821:7;:19::i;:::-;4793:408;;;5045:17;;:22;:49;;;;-1:-1:-1;;;;;;5071:18:32;;;:23;5045:49;5041:119;;;5121:24;;-1:-1:-1;;;5121:24:32;;-1:-1:-1;;;;;6437:32:39;;5121:24:32;;;6419:51:39;6392:18;;5121:24:32;6273:203:39;5041:119:32;-1:-1:-1;5180:10:32;4793:408;4625:582;;;;;:::o;5743:516::-;5874:17;;:21;5870:383;;6102:10;6096:17;6158:15;6145:10;6141:2;6137:19;6130:44;5870:383;6225:17;;-1:-1:-1;;;6225:17:32;;;;;;;;;;;14:286:39;72:6;125:2;113:9;104:7;100:23;96:32;93:52;;;141:1;138;131:12;93:52;167:23;;-1:-1:-1;;;;;;219:32:39;;209:43;;199:71;;266:1;263;256:12;497:127;558:10;553:3;549:20;546:1;539:31;589:4;586:1;579:15;613:4;610:1;603:15;629:718;671:5;724:3;717:4;709:6;705:17;701:27;691:55;;742:1;739;732:12;691:55;778:6;765:20;804:18;841:2;837;834:10;831:36;;;847:18;;:::i;:::-;922:2;916:9;890:2;976:13;;-1:-1:-1;;972:22:39;;;996:2;968:31;964:40;952:53;;;1020:18;;;1040:22;;;1017:46;1014:72;;;1066:18;;:::i;:::-;1106:10;1102:2;1095:22;1141:2;1133:6;1126:18;1187:3;1180:4;1175:2;1167:6;1163:15;1159:26;1156:35;1153:55;;;1204:1;1201;1194:12;1153:55;1268:2;1261:4;1253:6;1249:17;1242:4;1234:6;1230:17;1217:54;1315:1;1308:4;1303:2;1295:6;1291:15;1287:26;1280:37;1335:6;1326:15;;;;;;629:718;;;;:::o;1352:388::-;1429:6;1437;1490:2;1478:9;1469:7;1465:23;1461:32;1458:52;;;1506:1;1503;1496:12;1458:52;1542:9;1529:23;1519:33;;1603:2;1592:9;1588:18;1575:32;1630:18;1622:6;1619:30;1616:50;;;1662:1;1659;1652:12;1616:50;1685:49;1726:7;1717:6;1706:9;1702:22;1685:49;:::i;:::-;1675:59;;;1352:388;;;;;:::o;1745:180::-;1804:6;1857:2;1845:9;1836:7;1832:23;1828:32;1825:52;;;1873:1;1870;1863:12;1825:52;-1:-1:-1;1896:23:39;;1745:180;-1:-1:-1;1745:180:39:o;2112:173::-;2180:20;;-1:-1:-1;;;;;2229:31:39;;2219:42;;2209:70;;2275:1;2272;2265:12;2209:70;2112:173;;;:::o;2290:254::-;2358:6;2366;2419:2;2407:9;2398:7;2394:23;2390:32;2387:52;;;2435:1;2432;2425:12;2387:52;2471:9;2458:23;2448:33;;2500:38;2534:2;2523:9;2519:18;2500:38;:::i;:::-;2490:48;;2290:254;;;;;:::o;2549:394::-;2626:6;2634;2687:2;2675:9;2666:7;2662:23;2658:32;2655:52;;;2703:1;2700;2693:12;2655:52;2726:29;2745:9;2726:29;:::i;:::-;2716:39;;2806:2;2795:9;2791:18;2778:32;2833:18;2825:6;2822:30;2819:50;;;2865:1;2862;2855:12;2948:758;3059:6;3067;3075;3083;3091;3099;3152:3;3140:9;3131:7;3127:23;3123:33;3120:53;;;3169:1;3166;3159:12;3120:53;3205:9;3192:23;3182:33;;3266:2;3255:9;3251:18;3238:32;3293:18;3285:6;3282:30;3279:50;;;3325:1;3322;3315:12;3279:50;3348:49;3389:7;3380:6;3369:9;3365:22;3348:49;:::i;:::-;3338:59;;;3416:38;3450:2;3439:9;3435:18;3416:38;:::i;:::-;3406:48;;3504:2;3493:9;3489:18;3476:32;3548:4;3541:5;3537:16;3530:5;3527:27;3517:55;;3568:1;3565;3558:12;3517:55;2948:758;;;;-1:-1:-1;2948:758:39;;3643:3;3628:19;;3615:33;;3695:3;3680:19;;;3667:33;;-1:-1:-1;2948:758:39;-1:-1:-1;;2948:758:39:o;3711:186::-;3770:6;3823:2;3811:9;3802:7;3798:23;3794:32;3791:52;;;3839:1;3836;3829:12;3791:52;3862:29;3881:9;3862:29;:::i;4084:250::-;4169:1;4179:113;4193:6;4190:1;4187:13;4179:113;;;4269:11;;;4263:18;4250:11;;;4243:39;4215:2;4208:10;4179:113;;;-1:-1:-1;;4326:1:39;4308:16;;4301:27;4084:250::o;4339:271::-;4381:3;4419:5;4413:12;4446:6;4441:3;4434:19;4462:76;4531:6;4524:4;4519:3;4515:14;4508:4;4501:5;4497:16;4462:76;:::i;:::-;4592:2;4571:15;-1:-1:-1;;4567:29:39;4558:39;;;;4599:4;4554:50;;4339:271;-1:-1:-1;;4339:271:39:o;4615:220::-;4764:2;4753:9;4746:21;4727:4;4784:45;4825:2;4814:9;4810:18;4802:6;4784:45;:::i;4840:289::-;5015:2;5004:9;4997:21;4978:4;5035:45;5076:2;5065:9;5061:18;5053:6;5035:45;:::i;:::-;5027:53;;5116:6;5111:2;5100:9;5096:18;5089:34;4840:289;;;;;:::o;5134:731::-;-1:-1:-1;;;;;;5461:15:39;;;5449:28;;5506:15;;5502:1;5493:11;;5486:36;5547:1;5538:11;;5531:27;;;5581:13;;5399:3;;5603:75;5581:13;5666:2;5657:12;;5650:4;5638:17;;5603:75;:::i;:::-;5706:6;5701:3;5697:16;5687:26;;5767;5763:31;5754:6;5750:2;5746:15;5742:53;5737:2;5733;5729:11;5722:74;5825:6;5820:2;5816;5812:11;5805:27;5856:2;5852;5848:11;5841:18;;;5134:731;;;;;;;;;:::o;6481:222::-;6546:9;;;6567:10;;;6564:133;;;6619:10;6614:3;6610:20;6607:1;6600:31;6654:4;6651:1;6644:15;6682:4;6679:1;6672:15;6922:184;6992:6;7045:2;7033:9;7024:7;7020:23;7016:32;7013:52;;;7061:1;7058;7051:12;7013:52;-1:-1:-1;7084:16:39;;6922:184;-1:-1:-1;6922:184:39:o;7390:287::-;7519:3;7557:6;7551:13;7573:66;7632:6;7627:3;7620:4;7612:6;7608:17;7573:66;:::i;:::-;7655:16;;;;;7390:287;-1:-1:-1;;7390:287:39:o", + "linkReferences": {}, + "immutableReferences": { + "44753": [ + { + "start": 2164, + "length": 32 + }, + { + "start": 2205, + "length": 32 + }, + { + "start": 2562, + "length": 32 + } + ] + } + }, + "methodIdentifiers": { + "DEFAULT_ADMIN_ROLE()": "a217fddf", + "INBOX_ADMIN_ROLE()": "5c1e4016", + "UPGRADE_INTERFACE_VERSION()": "ad3cb1cc", + "getRoleAdmin(bytes32)": "248a9ca3", + "grantRole(bytes32,address)": "2f2ff15d", + "hasRole(bytes32,address)": "91d14854", + "initialize(address)": "c4d66de8", + "lastMessage(bytes32)": "cca0a227", + "nonce(address)": "70ae92d2", + "proxiableUUID()": "52d1902d", + "renounceRole(bytes32,address)": "36568abe", + "revokeRole(bytes32,address)": "d547741f", + "sendMessage(bytes32,bytes)": "23c640e7", + "sendMessageSigned(bytes32,bytes,address,uint8,bytes32,bytes32)": "559efc88", + "supportsInterface(bytes4)": "01ffc9a7", + "upgradeToAndCall(address,bytes)": "4f1ef286" + }, + "rawMetadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"AddressEmptyCode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"ERC1967InvalidImplementation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ERC1967NonPayable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedInnerCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInitialization\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"identity\",\"type\":\"address\"}],\"name\":\"SignatureValidationFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UUPSUnauthorizedCallContext\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"slot\",\"type\":\"bytes32\"}],\"name\":\"UUPSUnsupportedProxiableUUID\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"conversationId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lastMessage\",\"type\":\"uint256\"}],\"name\":\"PayloadSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"INBOX_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"UPGRADE_INTERFACE_VERSION\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_roleAdmin\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"lastMessage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"conversationId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"name\":\"sendMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"conversationId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"identity\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"sigV\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"sigR\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"sigS\",\"type\":\"bytes32\"}],\"name\":\"sendMessageSigned\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"AccessControlBadConfirmation()\":[{\"details\":\"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\"}],\"AccessControlUnauthorizedAccount(address,bytes32)\":[{\"details\":\"The `account` is missing a role.\"}],\"AddressEmptyCode(address)\":[{\"details\":\"There's no code at `target` (it is not a contract).\"}],\"ERC1967InvalidImplementation(address)\":[{\"details\":\"The `implementation` of the proxy is invalid.\"}],\"ERC1967NonPayable()\":[{\"details\":\"An upgrade function sees `msg.value > 0` that may be lost.\"}],\"FailedInnerCall()\":[{\"details\":\"A call to an address target failed. The target may have reverted.\"}],\"InvalidInitialization()\":[{\"details\":\"The contract is already initialized.\"}],\"NotInitializing()\":[{\"details\":\"The contract is not initializing.\"}],\"UUPSUnauthorizedCallContext()\":[{\"details\":\"The call is from an unauthorized context.\"}],\"UUPSUnsupportedProxiableUUID(bytes32)\":[{\"details\":\"The storage `slot` is unsupported as a UUID.\"}]},\"events\":{\"Initialized(uint64)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"PayloadSent(bytes32,bytes,uint256)\":{\"params\":{\"conversationId\":\"the conversation id\",\"lastMessage\":\"the latest change block number of this inbox for the conversation\",\"payload\":\"the message payload\"}},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this.\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"},\"Upgraded(address)\":{\"details\":\"Emitted when the implementation is upgraded.\"}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"constructor is forbidden for upgradeable contracts\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"initialize(address)\":{\"details\":\"initializer is required for proxy contracts\"},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"sendMessage(bytes32,bytes)\":{\"params\":{\"conversationId\":\"the conversation id\",\"payload\":\"the message payload\"}},\"sendMessageSigned(bytes32,bytes,address,uint8,bytes32,bytes32)\":{\"details\":\"revert on signature validation failure\",\"params\":{\"conversationId\":\"the conversation id\",\"identity\":\"the identity of the signer\",\"payload\":\"the message payload\",\"sigR\":\"the signature R\",\"sigS\":\"the signature S\",\"sigV\":\"the signature V\"}},\"supportsInterface(bytes4)\":{\"details\":\"required by ERC165\"},\"upgradeToAndCall(address,bytes)\":{\"custom:oz-upgrades-unsafe-allow-reachable\":\"delegatecall\",\"details\":\"Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"}},\"stateVariables\":{\"lastMessage\":{\"params\":{\"conversationId\":\"the conversation id\"},\"return\":\"the latest change block number of this inbox for the conversation\",\"returns\":{\"_0\":\"the latest change block number of this inbox for the conversation\"}}},\"version\":1},\"userdoc\":{\"events\":{\"PayloadSent(bytes32,bytes,uint256)\":{\"notice\":\"emitted when a message is sent\"}},\"kind\":\"user\",\"methods\":{\"lastMessage(bytes32)\":{\"notice\":\"get the latest message block number of this inbox for the conversation\"},\"sendMessage(bytes32,bytes)\":{\"notice\":\"send a message to the inbox\"},\"sendMessageSigned(bytes32,bytes,address,uint8,bytes32,bytes32)\":{\"notice\":\"send a message to the inbox, confirming the signed payload.\"}},\"notice\":\"Conversation is a contract for sending messages to an inbox. Each inbox is identified by a conversationId. The conversationId is a hash of the internal id known to participants in a group chat. The internal id is not known or shared in this contract.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Conversation.sol\":\"Conversation\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/\",\":@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/\",\":forge-std/=lib/forge-std/src/\",\":openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/\"]},\"sources\":{\"contracts/Conversation.sol\":{\"keccak256\":\"0x0931537a5bfa0fc22e8b7d88b61c6ee9d973ff931014c9b88d5dfaa1c5d153c7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e5fb70d4de17566300cbda5deff011fbe1ad6ec466fb4775447a2c7127c06da1\",\"dweb:/ipfs/QmR4UziYRWp9C9UejumkBnjaC9nhcu18XfCAUKRayEd1UU\"]},\"contracts/MessageSender.sol\":{\"keccak256\":\"0x42d409a75c4f1d9fc93ed7b7b5b034d7361cdbdcb713f74926cdbbe0ded3cacc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ae9d3e51f92529913cec6f441e3019991e8f5aa3db1e22139a2ff7129a18ace1\",\"dweb:/ipfs/QmYiPwSV3wF3c1opnvN3nYUdHxt1wh34pF43cfB6vafZaA\"]},\"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/access/AccessControl.sol\":{\"keccak256\":\"0xa0e92d42942f4f57c5be50568dac11e9d00c93efcb458026e18d2d9b9b2e7308\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://46326c0bb1e296b67185e81c918e0b40501b8b6386165855df0a3f3c634b6a80\",\"dweb:/ipfs/QmTwyrDYtsxsk6pymJTK94PnEpzsmkpUxFuzEiakDopy4Z\"]},\"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/access/IAccessControl.sol\":{\"keccak256\":\"0xb6b36edd6a2999fd243ff226d6cbf84bd71af2432bbd0dfe19392996a1d9cb41\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1fd2f35495652e57e3f99bc6c510bc5f7dd398a176ea2e72d8ed730aebc6ca26\",\"dweb:/ipfs/QmTQV6X4gkikTib49cho5iDX3JvSQbdsoEChoDwrk3CbbH\"]},\"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol\":{\"keccak256\":\"0xde7e9fd9aee8d4f40772f96bb3b58836cbc6dfc0227014a061947f8821ea9724\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://11fea9f8bc98949ac6709f0c1699db7430d2948137aa94d5a9e95a91f61a710a\",\"dweb:/ipfs/QmQdfRXxQjwP6yn3DVo1GHPpriKNcFghSPi94Z1oKEFUNS\"]},\"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/interfaces/draft-IERC1822.sol\":{\"keccak256\":\"0x2a1f9944df2015c081d89cd41ba22ffaf10aa6285969f0dc612b235cc448999c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ef381843676aec64421200ee85eaa0b1356a35f28b9fc67e746a6bbb832077d9\",\"dweb:/ipfs/QmY8aorMYA2TeTCnu6ejDjzb4rW4t7TCtW4GZ6LoxTFm7v\"]},\"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol\":{\"keccak256\":\"0x06a78f9b3ee3e6d0eb4e4cd635ba49960bea34cac1db8c0a27c75f2319f1fd65\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://547d21aa17f4f3f1a1a7edf7167beff8dd9496a0348d5588f15cc8a4b29d052a\",\"dweb:/ipfs/QmT16JtRQSWNpLo9W23jr6CzaMuTAcQcjJJcdRd8HLJ6cE\"]},\"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol\":{\"keccak256\":\"0xc59a78b07b44b2cf2e8ab4175fca91e8eca1eee2df7357b8d2a8833e5ea1f64c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5aa4f07e65444784c29cd7bfcc2341b34381e4e5b5da9f0c5bd00d7f430e66fa\",\"dweb:/ipfs/QmWRMh4Q9DpaU9GvsiXmDdoNYMyyece9if7hnfLz7uqzWM\"]},\"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x631188737069917d2f909d29ce62c4d48611d326686ba6683e26b72a23bfac0b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7a61054ae84cd6c4d04c0c4450ba1d6de41e27e0a2c4f1bcdf58f796b401c609\",\"dweb:/ipfs/QmUvtdp7X1mRVyC3CsHrtPbgoqWaXHp3S1ZR24tpAQYJWM\"]},\"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/utils/UUPSUpgradeable.sol\":{\"keccak256\":\"0x3ffb56bcb175984a10b1167e2eba560876bfe96a435f5d62ffed8b1bb4ebc4c7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7db94af56aa20efb57c3f9003eacd884faad04118967d8e35cdffe07790bbdcd\",\"dweb:/ipfs/QmXtAshRWFjcQ1kL7gpC5CiLUZgJ9uzrZyeHp2Sux9ojPF\"]},\"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/Address.sol\":{\"keccak256\":\"0xaf28a975a78550e45f65e559a3ad6a5ad43b9b8a37366999abd1b7084eb70721\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b7bd24e224f67f65bfadf85dc2929fa965456bb2415478bd0125471b5ce35245\",\"dweb:/ipfs/QmRaydGr8BTHs1kvaZfsNU69pKzUAGFrvABn1KiRSbE51y\"]},\"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/Context.sol\":{\"keccak256\":\"0x75a4ee64c68dbd5f38bddd06e664a64c8271b4caa554fb6f0607dfd672bb4bf3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0c4e6cb30d3601e2f7af5af09e265508147cb275a8dcd99d6f7363645cc56867\",\"dweb:/ipfs/QmNgFkoXNWoUbAyw71rr1sKQ95Rj2GfvYiWg79xEYDn2NY\"]},\"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol\":{\"keccak256\":\"0x32ba59b4b7299237c8ba56319110989d7978a039faf754793064e967e5894418\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1ae50c8b562427df610cc4540c9bf104acca7ef8e2dcae567ae7e52272281e9c\",\"dweb:/ipfs/QmTHiadFCSJUPpRjNegc5SahmeU8bAoY8i9Aq6tVscbcKR\"]},\"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol\":{\"keccak256\":\"0x9e8778b14317ba9e256c30a76fd6c32b960af621987f56069e1e819c77c6a133\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1777404f1dcd0fac188e55a288724ec3c67b45288e49cc64723e95e702b49ab8\",\"dweb:/ipfs/QmZFdC626GButBApwDUvvTnUzdinevC3B24d7yyh57XkiA\"]},\"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://87b3541437c8c443ccd36795e56a338ed12855eec17f8da624511b8d1a7e14df\",\"dweb:/ipfs/QmeJQCtZrQjtJLr6u7ZHWeH3pBnjtLWzvRrKViAi7UZqxL\"]}},\"version\":1}", + "metadata": { + "compiler": { + "version": "0.8.20+commit.a1b79de6" + }, + "language": "Solidity", + "output": { + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "type": "error", + "name": "AccessControlBadConfirmation" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "neededRole", + "type": "bytes32" + } + ], + "type": "error", + "name": "AccessControlUnauthorizedAccount" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "type": "error", + "name": "AddressEmptyCode" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "type": "error", + "name": "ERC1967InvalidImplementation" + }, + { + "inputs": [], + "type": "error", + "name": "ERC1967NonPayable" + }, + { + "inputs": [], + "type": "error", + "name": "FailedInnerCall" + }, + { + "inputs": [], + "type": "error", + "name": "InvalidInitialization" + }, + { + "inputs": [], + "type": "error", + "name": "NotInitializing" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "identity", + "type": "address" + } + ], + "type": "error", + "name": "SignatureValidationFailed" + }, + { + "inputs": [], + "type": "error", + "name": "UUPSUnauthorizedCallContext" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "type": "error", + "name": "UUPSUnsupportedProxiableUUID" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "version", + "type": "uint64", + "indexed": false + } + ], + "type": "event", + "name": "Initialized", + "anonymous": false + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "conversationId", + "type": "bytes32", + "indexed": true + }, + { + "internalType": "bytes", + "name": "payload", + "type": "bytes", + "indexed": false + }, + { + "internalType": "uint256", + "name": "lastMessage", + "type": "uint256", + "indexed": false + } + ], + "type": "event", + "name": "PayloadSent", + "anonymous": false + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32", + "indexed": true + }, + { + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32", + "indexed": true + }, + { + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32", + "indexed": true + } + ], + "type": "event", + "name": "RoleAdminChanged", + "anonymous": false + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32", + "indexed": true + }, + { + "internalType": "address", + "name": "account", + "type": "address", + "indexed": true + }, + { + "internalType": "address", + "name": "sender", + "type": "address", + "indexed": true + } + ], + "type": "event", + "name": "RoleGranted", + "anonymous": false + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32", + "indexed": true + }, + { + "internalType": "address", + "name": "account", + "type": "address", + "indexed": true + }, + { + "internalType": "address", + "name": "sender", + "type": "address", + "indexed": true + } + ], + "type": "event", + "name": "RoleRevoked", + "anonymous": false + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address", + "indexed": true + } + ], + "type": "event", + "name": "Upgraded", + "anonymous": false + }, + { + "inputs": [], + "stateMutability": "view", + "type": "function", + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ] + }, + { + "inputs": [], + "stateMutability": "view", + "type": "function", + "name": "INBOX_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ] + }, + { + "inputs": [], + "stateMutability": "view", + "type": "function", + "name": "UPGRADE_INTERFACE_VERSION", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ] + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function", + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ] + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function", + "name": "grantRole" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function", + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ] + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_roleAdmin", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function", + "name": "initialize" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function", + "name": "lastMessage", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ] + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function", + "name": "nonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ] + }, + { + "inputs": [], + "stateMutability": "view", + "type": "function", + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ] + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "callerConfirmation", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function", + "name": "renounceRole" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function", + "name": "revokeRole" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "conversationId", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "payload", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function", + "name": "sendMessage" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "conversationId", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "payload", + "type": "bytes" + }, + { + "internalType": "address", + "name": "identity", + "type": "address" + }, + { + "internalType": "uint8", + "name": "sigV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "sigR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sigS", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function", + "name": "sendMessageSigned" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function", + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ] + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "function", + "name": "upgradeToAndCall" + } + ], + "devdoc": { + "kind": "dev", + "methods": { + "constructor": { + "details": "constructor is forbidden for upgradeable contracts" + }, + "getRoleAdmin(bytes32)": { + "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." + }, + "grantRole(bytes32,address)": { + "details": "Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event." + }, + "hasRole(bytes32,address)": { + "details": "Returns `true` if `account` has been granted `role`." + }, + "initialize(address)": { + "details": "initializer is required for proxy contracts" + }, + "proxiableUUID()": { + "details": "Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier." + }, + "renounceRole(bytes32,address)": { + "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event." + }, + "revokeRole(bytes32,address)": { + "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event." + }, + "sendMessage(bytes32,bytes)": { + "params": { + "conversationId": "the conversation id", + "payload": "the message payload" + } + }, + "sendMessageSigned(bytes32,bytes,address,uint8,bytes32,bytes32)": { + "details": "revert on signature validation failure", + "params": { + "conversationId": "the conversation id", + "identity": "the identity of the signer", + "payload": "the message payload", + "sigR": "the signature R", + "sigS": "the signature S", + "sigV": "the signature V" + } + }, + "supportsInterface(bytes4)": { + "details": "required by ERC165" + }, + "upgradeToAndCall(address,bytes)": { + "custom:oz-upgrades-unsafe-allow-reachable": "delegatecall", + "details": "Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "lastMessage(bytes32)": { + "notice": "get the latest message block number of this inbox for the conversation" + }, + "sendMessage(bytes32,bytes)": { + "notice": "send a message to the inbox" + }, + "sendMessageSigned(bytes32,bytes,address,uint8,bytes32,bytes32)": { + "notice": "send a message to the inbox, confirming the signed payload." + } + }, + "version": 1 + } + }, + "settings": { + "remappings": [ + "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", + "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/", + "ds-test/=lib/forge-std/lib/ds-test/src/", + "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", + "forge-std/=lib/forge-std/src/", + "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", + "openzeppelin-contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/" + ], + "optimizer": { + "enabled": true, + "runs": 200 + }, + "metadata": { + "bytecodeHash": "ipfs" + }, + "compilationTarget": { + "contracts/Conversation.sol": "Conversation" + }, + "evmVersion": "paris", + "libraries": {} + }, + "sources": { + "contracts/Conversation.sol": { + "keccak256": "0x0931537a5bfa0fc22e8b7d88b61c6ee9d973ff931014c9b88d5dfaa1c5d153c7", + "urls": [ + "bzz-raw://e5fb70d4de17566300cbda5deff011fbe1ad6ec466fb4775447a2c7127c06da1", + "dweb:/ipfs/QmR4UziYRWp9C9UejumkBnjaC9nhcu18XfCAUKRayEd1UU" + ], + "license": "MIT" + }, + "contracts/MessageSender.sol": { + "keccak256": "0x42d409a75c4f1d9fc93ed7b7b5b034d7361cdbdcb713f74926cdbbe0ded3cacc", + "urls": [ + "bzz-raw://ae9d3e51f92529913cec6f441e3019991e8f5aa3db1e22139a2ff7129a18ace1", + "dweb:/ipfs/QmYiPwSV3wF3c1opnvN3nYUdHxt1wh34pF43cfB6vafZaA" + ], + "license": "MIT" + }, + "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/access/AccessControl.sol": { + "keccak256": "0xa0e92d42942f4f57c5be50568dac11e9d00c93efcb458026e18d2d9b9b2e7308", + "urls": [ + "bzz-raw://46326c0bb1e296b67185e81c918e0b40501b8b6386165855df0a3f3c634b6a80", + "dweb:/ipfs/QmTwyrDYtsxsk6pymJTK94PnEpzsmkpUxFuzEiakDopy4Z" + ], + "license": "MIT" + }, + "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/access/IAccessControl.sol": { + "keccak256": "0xb6b36edd6a2999fd243ff226d6cbf84bd71af2432bbd0dfe19392996a1d9cb41", + "urls": [ + "bzz-raw://1fd2f35495652e57e3f99bc6c510bc5f7dd398a176ea2e72d8ed730aebc6ca26", + "dweb:/ipfs/QmTQV6X4gkikTib49cho5iDX3JvSQbdsoEChoDwrk3CbbH" + ], + "license": "MIT" + }, + "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol": { + "keccak256": "0xde7e9fd9aee8d4f40772f96bb3b58836cbc6dfc0227014a061947f8821ea9724", + "urls": [ + "bzz-raw://11fea9f8bc98949ac6709f0c1699db7430d2948137aa94d5a9e95a91f61a710a", + "dweb:/ipfs/QmQdfRXxQjwP6yn3DVo1GHPpriKNcFghSPi94Z1oKEFUNS" + ], + "license": "MIT" + }, + "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/interfaces/draft-IERC1822.sol": { + "keccak256": "0x2a1f9944df2015c081d89cd41ba22ffaf10aa6285969f0dc612b235cc448999c", + "urls": [ + "bzz-raw://ef381843676aec64421200ee85eaa0b1356a35f28b9fc67e746a6bbb832077d9", + "dweb:/ipfs/QmY8aorMYA2TeTCnu6ejDjzb4rW4t7TCtW4GZ6LoxTFm7v" + ], + "license": "MIT" + }, + "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol": { + "keccak256": "0x06a78f9b3ee3e6d0eb4e4cd635ba49960bea34cac1db8c0a27c75f2319f1fd65", + "urls": [ + "bzz-raw://547d21aa17f4f3f1a1a7edf7167beff8dd9496a0348d5588f15cc8a4b29d052a", + "dweb:/ipfs/QmT16JtRQSWNpLo9W23jr6CzaMuTAcQcjJJcdRd8HLJ6cE" + ], + "license": "MIT" + }, + "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol": { + "keccak256": "0xc59a78b07b44b2cf2e8ab4175fca91e8eca1eee2df7357b8d2a8833e5ea1f64c", + "urls": [ + "bzz-raw://5aa4f07e65444784c29cd7bfcc2341b34381e4e5b5da9f0c5bd00d7f430e66fa", + "dweb:/ipfs/QmWRMh4Q9DpaU9GvsiXmDdoNYMyyece9if7hnfLz7uqzWM" + ], + "license": "MIT" + }, + "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/utils/Initializable.sol": { + "keccak256": "0x631188737069917d2f909d29ce62c4d48611d326686ba6683e26b72a23bfac0b", + "urls": [ + "bzz-raw://7a61054ae84cd6c4d04c0c4450ba1d6de41e27e0a2c4f1bcdf58f796b401c609", + "dweb:/ipfs/QmUvtdp7X1mRVyC3CsHrtPbgoqWaXHp3S1ZR24tpAQYJWM" + ], + "license": "MIT" + }, + "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/utils/UUPSUpgradeable.sol": { + "keccak256": "0x3ffb56bcb175984a10b1167e2eba560876bfe96a435f5d62ffed8b1bb4ebc4c7", + "urls": [ + "bzz-raw://7db94af56aa20efb57c3f9003eacd884faad04118967d8e35cdffe07790bbdcd", + "dweb:/ipfs/QmXtAshRWFjcQ1kL7gpC5CiLUZgJ9uzrZyeHp2Sux9ojPF" + ], + "license": "MIT" + }, + "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/Address.sol": { + "keccak256": "0xaf28a975a78550e45f65e559a3ad6a5ad43b9b8a37366999abd1b7084eb70721", + "urls": [ + "bzz-raw://b7bd24e224f67f65bfadf85dc2929fa965456bb2415478bd0125471b5ce35245", + "dweb:/ipfs/QmRaydGr8BTHs1kvaZfsNU69pKzUAGFrvABn1KiRSbE51y" + ], + "license": "MIT" + }, + "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/Context.sol": { + "keccak256": "0x75a4ee64c68dbd5f38bddd06e664a64c8271b4caa554fb6f0607dfd672bb4bf3", + "urls": [ + "bzz-raw://0c4e6cb30d3601e2f7af5af09e265508147cb275a8dcd99d6f7363645cc56867", + "dweb:/ipfs/QmNgFkoXNWoUbAyw71rr1sKQ95Rj2GfvYiWg79xEYDn2NY" + ], + "license": "MIT" + }, + "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol": { + "keccak256": "0x32ba59b4b7299237c8ba56319110989d7978a039faf754793064e967e5894418", + "urls": [ + "bzz-raw://1ae50c8b562427df610cc4540c9bf104acca7ef8e2dcae567ae7e52272281e9c", + "dweb:/ipfs/QmTHiadFCSJUPpRjNegc5SahmeU8bAoY8i9Aq6tVscbcKR" + ], + "license": "MIT" + }, + "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol": { + "keccak256": "0x9e8778b14317ba9e256c30a76fd6c32b960af621987f56069e1e819c77c6a133", + "urls": [ + "bzz-raw://1777404f1dcd0fac188e55a288724ec3c67b45288e49cc64723e95e702b49ab8", + "dweb:/ipfs/QmZFdC626GButBApwDUvvTnUzdinevC3B24d7yyh57XkiA" + ], + "license": "MIT" + }, + "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": { + "keccak256": "0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b", + "urls": [ + "bzz-raw://87b3541437c8c443ccd36795e56a338ed12855eec17f8da624511b8d1a7e14df", + "dweb:/ipfs/QmeJQCtZrQjtJLr6u7ZHWeH3pBnjtLWzvRrKViAi7UZqxL" + ], + "license": "MIT" + } + }, + "version": 1 + }, + "ast": { + "absolutePath": "contracts/Conversation.sol", + "id": 203, + "exportedSymbols": { + "AccessControl": [ + 43999 + ], + "Conversation": [ + 202 + ], + "ERC165": [ + 45312 + ], + "IAccessControl": [ + 44082 + ], + "IERC165": [ + 45324 + ], + "Initializable": [ + 44737 + ], + "MessageSender": [ + 251 + ], + "UUPSUpgradeable": [ + 44903 + ] + }, + "nodeType": "SourceUnit", + "src": "32:3521:0", + "nodes": [ + { + "id": 1, + "nodeType": "PragmaDirective", + "src": "32:24:0", + "nodes": [], + "literals": [ + "solidity", + "^", + "0.8", + ".20" + ] + }, + { + "id": 3, + "nodeType": "ImportDirective", + "src": "58:83:0", + "nodes": [], + "absolutePath": "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/access/IAccessControl.sol", + "file": "@openzeppelin/contracts/access/IAccessControl.sol", + "nameLocation": "-1:-1:-1", + "scope": 203, + "sourceUnit": 44083, + "symbolAliases": [ + { + "foreign": { + "id": 2, + "name": "IAccessControl", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44082, + "src": "67:14:0", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "id": 5, + "nodeType": "ImportDirective", + "src": "142:81:0", + "nodes": [], + "absolutePath": "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/access/AccessControl.sol", + "file": "@openzeppelin/contracts/access/AccessControl.sol", + "nameLocation": "-1:-1:-1", + "scope": 203, + "sourceUnit": 44000, + "symbolAliases": [ + { + "foreign": { + "id": 4, + "name": "AccessControl", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 43999, + "src": "151:13:0", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "id": 7, + "nodeType": "ImportDirective", + "src": "224:86:0", + "nodes": [], + "absolutePath": "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/utils/Initializable.sol", + "file": "@openzeppelin/contracts/proxy/utils/Initializable.sol", + "nameLocation": "-1:-1:-1", + "scope": 203, + "sourceUnit": 44738, + "symbolAliases": [ + { + "foreign": { + "id": 6, + "name": "Initializable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44737, + "src": "233:13:0", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "id": 9, + "nodeType": "ImportDirective", + "src": "311:90:0", + "nodes": [], + "absolutePath": "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/proxy/utils/UUPSUpgradeable.sol", + "file": "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol", + "nameLocation": "-1:-1:-1", + "scope": 203, + "sourceUnit": 44904, + "symbolAliases": [ + { + "foreign": { + "id": 8, + "name": "UUPSUpgradeable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44903, + "src": "320:15:0", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "id": 11, + "nodeType": "ImportDirective", + "src": "402:73:0", + "nodes": [], + "absolutePath": "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol", + "file": "@openzeppelin/contracts/interfaces/IERC165.sol", + "nameLocation": "-1:-1:-1", + "scope": 203, + "sourceUnit": 44087, + "symbolAliases": [ + { + "foreign": { + "id": 10, + "name": "IERC165", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 45324, + "src": "411:7:0", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "id": 13, + "nodeType": "ImportDirective", + "src": "476:80:0", + "nodes": [], + "absolutePath": "lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol", + "file": "@openzeppelin/contracts/utils/introspection/ERC165.sol", + "nameLocation": "-1:-1:-1", + "scope": 203, + "sourceUnit": 45313, + "symbolAliases": [ + { + "foreign": { + "id": 12, + "name": "ERC165", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 45312, + "src": "485:6:0", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "id": 15, + "nodeType": "ImportDirective", + "src": "558:52:0", + "nodes": [], + "absolutePath": "contracts/MessageSender.sol", + "file": "./MessageSender.sol", + "nameLocation": "-1:-1:-1", + "scope": 203, + "sourceUnit": 252, + "symbolAliases": [ + { + "foreign": { + "id": 14, + "name": "MessageSender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 251, + "src": "567:13:0", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "id": 202, + "nodeType": "ContractDefinition", + "src": "895:2657:0", + "nodes": [ + { + "id": 29, + "nodeType": "VariableDeclaration", + "src": "987:72:0", + "nodes": [], + "constant": true, + "functionSelector": "5c1e4016", + "mutability": "constant", + "name": "INBOX_ADMIN_ROLE", + "nameLocation": "1011:16:0", + "scope": 202, + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 25, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "987:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": { + "arguments": [ + { + "hexValue": "494e424f585f41444d494e5f524f4c45", + "id": 27, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1040:18:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_8d5056aeb79a6b07f63ee707a19b263637ccb9ccdc7ea724d0d89fdf7acd558f", + "typeString": "literal_string \"INBOX_ADMIN_ROLE\"" + }, + "value": "INBOX_ADMIN_ROLE" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_8d5056aeb79a6b07f63ee707a19b263637ccb9ccdc7ea724d0d89fdf7acd558f", + "typeString": "literal_string \"INBOX_ADMIN_ROLE\"" + } + ], + "id": 26, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "1030:9:0", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 28, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1030:29:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "public" + }, + { + "id": 33, + "nodeType": "VariableDeclaration", + "src": "1066:46:0", + "nodes": [], + "baseFunctions": [ + 250 + ], + "constant": false, + "functionSelector": "cca0a227", + "mutability": "mutable", + "name": "lastMessage", + "nameLocation": "1101:11:0", + "scope": 202, + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$", + "typeString": "mapping(bytes32 => uint256)" + }, + "typeName": { + "id": 32, + "keyName": "", + "keyNameLocation": "-1:-1:-1", + "keyType": { + "id": 30, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1074:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Mapping", + "src": "1066:27:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$", + "typeString": "mapping(bytes32 => uint256)" + }, + "valueName": "", + "valueNameLocation": "-1:-1:-1", + "valueType": { + "id": 31, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1085:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + "visibility": "public" + }, + { + "id": 37, + "nodeType": "VariableDeclaration", + "src": "1118:40:0", + "nodes": [], + "constant": false, + "functionSelector": "70ae92d2", + "mutability": "mutable", + "name": "nonce", + "nameLocation": "1153:5:0", + "scope": 202, + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + }, + "typeName": { + "id": 36, + "keyName": "", + "keyNameLocation": "-1:-1:-1", + "keyType": { + "id": 34, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1126:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "1118:27:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + }, + "valueName": "", + "valueNameLocation": "-1:-1:-1", + "valueType": { + "id": 35, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1137:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + "visibility": "public" + }, + { + "id": 45, + "nodeType": "FunctionDefinition", + "src": "1229:53:0", + "nodes": [], + "body": { + "id": 44, + "nodeType": "Block", + "src": "1243:39:0", + "nodes": [], + "statements": [ + { + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 41, + "name": "_disableInitializers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44705, + "src": "1253:20:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$__$returns$__$", + "typeString": "function ()" + } + }, + "id": 42, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1253:22:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 43, + "nodeType": "ExpressionStatement", + "src": "1253:22:0" + } + ] + }, + "documentation": { + "id": 38, + "nodeType": "StructuredDocumentation", + "src": "1165:59:0", + "text": "@dev constructor is forbidden for upgradeable contracts" + }, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "parameters": { + "id": 39, + "nodeType": "ParameterList", + "parameters": [], + "src": "1240:2:0" + }, + "returnParameters": { + "id": 40, + "nodeType": "ParameterList", + "parameters": [], + "src": "1243:0:0" + }, + "scope": 202, + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "id": 59, + "nodeType": "FunctionDefinition", + "src": "1345:118:0", + "nodes": [], + "body": { + "id": 58, + "nodeType": "Block", + "src": "1404:59:0", + "nodes": [], + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 54, + "name": "DEFAULT_ADMIN_ROLE", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 43733, + "src": "1425:18:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 55, + "name": "_roleAdmin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 48, + "src": "1445:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 53, + "name": "_grantRole", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 43960, + "src": "1414:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_address_$returns$_t_bool_$", + "typeString": "function (bytes32,address) returns (bool)" + } + }, + "id": 56, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1414:42:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 57, + "nodeType": "ExpressionStatement", + "src": "1414:42:0" + } + ] + }, + "documentation": { + "id": 46, + "nodeType": "StructuredDocumentation", + "src": "1288:52:0", + "text": "@dev initializer is required for proxy contracts" + }, + "functionSelector": "c4d66de8", + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 51, + "kind": "modifierInvocation", + "modifierName": { + "id": 50, + "name": "initializer", + "nameLocations": [ + "1392:11:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 44591, + "src": "1392:11:0" + }, + "nodeType": "ModifierInvocation", + "src": "1392:11:0" + } + ], + "name": "initialize", + "nameLocation": "1354:10:0", + "parameters": { + "id": 49, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 48, + "mutability": "mutable", + "name": "_roleAdmin", + "nameLocation": "1373:10:0", + "nodeType": "VariableDeclaration", + "scope": 59, + "src": "1365:18:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 47, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1365:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1364:20:0" + }, + "returnParameters": { + "id": 52, + "nodeType": "ParameterList", + "parameters": [], + "src": "1404:0:0" + }, + "scope": 202, + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "id": 87, + "nodeType": "FunctionDefinition", + "src": "1619:243:0", + "nodes": [], + "body": { + "id": 86, + "nodeType": "Block", + "src": "1693:169:0", + "nodes": [], + "statements": [ + { + "assignments": [ + 68 + ], + "declarations": [ + { + "constant": false, + "id": 68, + "mutability": "mutable", + "name": "latest", + "nameLocation": "1708:6:0", + "nodeType": "VariableDeclaration", + "scope": 86, + "src": "1703:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 67, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1703:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 72, + "initialValue": { + "baseExpression": { + "id": 69, + "name": "lastMessage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1717:11:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$", + "typeString": "mapping(bytes32 => uint256)" + } + }, + "id": 71, + "indexExpression": { + "id": 70, + "name": "conversationId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 62, + "src": "1729:14:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1717:27:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1703:41:0" + }, + { + "eventCall": { + "arguments": [ + { + "id": 74, + "name": "conversationId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 62, + "src": "1771:14:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 75, + "name": "payload", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 64, + "src": "1787:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 76, + "name": "latest", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 68, + "src": "1796:6:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 73, + "name": "PayloadSent", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 214, + "src": "1759:11:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_bytes_memory_ptr_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,bytes memory,uint256)" + } + }, + "id": 77, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1759:44:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 78, + "nodeType": "EmitStatement", + "src": "1754:49:0" + }, + { + "expression": { + "id": 84, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 79, + "name": "lastMessage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 33, + "src": "1813:11:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_uint256_$", + "typeString": "mapping(bytes32 => uint256)" + } + }, + "id": 81, + "indexExpression": { + "id": 80, + "name": "conversationId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 62, + "src": "1825:14:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1813:27:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "expression": { + "id": 82, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -4, + "src": "1843:5:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 83, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1849:6:0", + "memberName": "number", + "nodeType": "MemberAccess", + "src": "1843:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1813:42:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 85, + "nodeType": "ExpressionStatement", + "src": "1813:42:0" + } + ] + }, + "baseFunctions": [ + 226 + ], + "documentation": { + "id": 60, + "nodeType": "StructuredDocumentation", + "src": "1469:145:0", + "text": " @notice send a message to the inbox\n @param conversationId the conversation id\n @param payload the message payload" + }, + "functionSelector": "23c640e7", + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "sendMessage", + "nameLocation": "1628:11:0", + "parameters": { + "id": 65, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 62, + "mutability": "mutable", + "name": "conversationId", + "nameLocation": "1648:14:0", + "nodeType": "VariableDeclaration", + "scope": 87, + "src": "1640:22:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 61, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1640:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 64, + "mutability": "mutable", + "name": "payload", + "nameLocation": "1677:7:0", + "nodeType": "VariableDeclaration", + "scope": 87, + "src": "1664:20:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 63, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1664:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "1639:46:0" + }, + "returnParameters": { + "id": 66, + "nodeType": "ParameterList", + "parameters": [], + "src": "1693:0:0" + }, + "scope": 202, + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "id": 160, + "nodeType": "FunctionDefinition", + "src": "2256:609:0", + "nodes": [], + "body": { + "id": 159, + "nodeType": "Block", + "src": "2450:415:0", + "nodes": [], + "statements": [ + { + "assignments": [ + 104 + ], + "declarations": [ + { + "constant": false, + "id": 104, + "mutability": "mutable", + "name": "_nonce", + "nameLocation": "2468:6:0", + "nodeType": "VariableDeclaration", + "scope": 159, + "src": "2460:14:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 103, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2460:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 108, + "initialValue": { + "baseExpression": { + "id": 105, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 37, + "src": "2477:5:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + } + }, + "id": 107, + "indexExpression": { + "id": 106, + "name": "identity", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 94, + "src": "2483:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2477:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2460:32:0" + }, + { + "assignments": [ + 110 + ], + "declarations": [ + { + "constant": false, + "id": 110, + "mutability": "mutable", + "name": "digest", + "nameLocation": "2510:6:0", + "nodeType": "VariableDeclaration", + "scope": 159, + "src": "2502:14:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 109, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2502:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 128, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "hexValue": "30783139", + "id": 116, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2566:4:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_25_by_1", + "typeString": "int_const 25" + }, + "value": "0x19" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_25_by_1", + "typeString": "int_const 25" + } + ], + "id": 115, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2559:6:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 114, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "2559:6:0", + "typeDescriptions": {} + } + }, + "id": 117, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2559:12:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 120, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2580:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 119, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2573:6:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes1_$", + "typeString": "type(bytes1)" + }, + "typeName": { + "id": 118, + "name": "bytes1", + "nodeType": "ElementaryTypeName", + "src": "2573:6:0", + "typeDescriptions": {} + } + }, + "id": 121, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2573:9:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + { + "id": 122, + "name": "conversationId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "2584:14:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 123, + "name": "payload", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "2600:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "id": 124, + "name": "identity", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 94, + "src": "2609:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 125, + "name": "_nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "2619:6:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 112, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "2542:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 113, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "2546:12:0", + "memberName": "encodePacked", + "nodeType": "MemberAccess", + "src": "2542:16:0", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 126, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2542:84:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 111, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "2519:9:0", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 127, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2519:117:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2502:134:0" + }, + { + "assignments": [ + 130 + ], + "declarations": [ + { + "constant": false, + "id": 130, + "mutability": "mutable", + "name": "signer", + "nameLocation": "2654:6:0", + "nodeType": "VariableDeclaration", + "scope": 159, + "src": "2646:14:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 129, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2646:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 137, + "initialValue": { + "arguments": [ + { + "id": 132, + "name": "digest", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 110, + "src": "2673:6:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 133, + "name": "sigV", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 96, + "src": "2681:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "id": 134, + "name": "sigR", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 98, + "src": "2687:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 135, + "name": "sigS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "2693:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 131, + "name": "ecrecover", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -6, + "src": "2663:9:0", + "typeDescriptions": { + "typeIdentifier": "t_function_ecrecover_pure$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) pure returns (address)" + } + }, + "id": 136, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2663:35:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2646:52:0" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 140, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 138, + "name": "signer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 130, + "src": "2712:6:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 139, + "name": "identity", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 94, + "src": "2722:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2712:18:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 145, + "nodeType": "IfStatement", + "src": "2708:66:0", + "trueBody": { + "errorCall": { + "arguments": [ + { + "id": 142, + "name": "identity", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 94, + "src": "2765:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 141, + "name": "SignatureValidationFailed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 218, + "src": "2739:25:0", + "typeDescriptions": { + "typeIdentifier": "t_function_error_pure$_t_address_$returns$__$", + "typeString": "function (address) pure" + } + }, + "id": 143, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2739:35:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 144, + "nodeType": "RevertStatement", + "src": "2732:42:0" + } + }, + { + "expression": { + "id": 152, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 146, + "name": "nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 37, + "src": "2784:5:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + } + }, + "id": 148, + "indexExpression": { + "id": 147, + "name": "identity", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 94, + "src": "2790:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2784:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 151, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 149, + "name": "_nonce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "2802:6:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "hexValue": "31", + "id": 150, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2811:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2802:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2784:28:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 153, + "nodeType": "ExpressionStatement", + "src": "2784:28:0" + }, + { + "expression": { + "arguments": [ + { + "id": 155, + "name": "conversationId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "2834:14:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 156, + "name": "payload", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "2850:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 154, + "name": "sendMessage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 87, + "src": "2822:11:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes_memory_ptr_$returns$__$", + "typeString": "function (bytes32,bytes memory)" + } + }, + "id": 157, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2822:36:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 158, + "nodeType": "ExpressionStatement", + "src": "2822:36:0" + } + ] + }, + "baseFunctions": [ + 242 + ], + "documentation": { + "id": 88, + "nodeType": "StructuredDocumentation", + "src": "1868:383:0", + "text": " @notice send a message to the inbox, confirming the signed payload.\n @dev revert on signature validation failure\n @param conversationId the conversation id\n @param payload the message payload\n @param identity the identity of the signer\n @param sigV the signature V\n @param sigR the signature R\n @param sigS the signature S" + }, + "functionSelector": "559efc88", + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "sendMessageSigned", + "nameLocation": "2265:17:0", + "parameters": { + "id": 101, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 90, + "mutability": "mutable", + "name": "conversationId", + "nameLocation": "2300:14:0", + "nodeType": "VariableDeclaration", + "scope": 160, + "src": "2292:22:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 89, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2292:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 92, + "mutability": "mutable", + "name": "payload", + "nameLocation": "2337:7:0", + "nodeType": "VariableDeclaration", + "scope": 160, + "src": "2324:20:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 91, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2324:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 94, + "mutability": "mutable", + "name": "identity", + "nameLocation": "2362:8:0", + "nodeType": "VariableDeclaration", + "scope": 160, + "src": "2354:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 93, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2354:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 96, + "mutability": "mutable", + "name": "sigV", + "nameLocation": "2386:4:0", + "nodeType": "VariableDeclaration", + "scope": 160, + "src": "2380:10:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 95, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "2380:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 98, + "mutability": "mutable", + "name": "sigR", + "nameLocation": "2408:4:0", + "nodeType": "VariableDeclaration", + "scope": 160, + "src": "2400:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 97, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2400:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 100, + "mutability": "mutable", + "name": "sigS", + "nameLocation": "2430:4:0", + "nodeType": "VariableDeclaration", + "scope": 160, + "src": "2422:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 99, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2422:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2282:158:0" + }, + "returnParameters": { + "id": 102, + "nodeType": "ParameterList", + "parameters": [], + "src": "2450:0:0" + }, + "scope": 202, + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "id": 171, + "nodeType": "FunctionDefinition", + "src": "3024:170:0", + "nodes": [], + "body": { + "id": 170, + "nodeType": "Block", + "src": "3192:2:0", + "nodes": [], + "statements": [] + }, + "baseFunctions": [ + 44857 + ], + "documentation": { + "id": 161, + "nodeType": "StructuredDocumentation", + "src": "2871:99:0", + "text": " @notice authorize code upgrade or revert\n @dev required by UUPSUpgradeable" + }, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "arguments": [ + { + "id": 167, + "name": "INBOX_ADMIN_ROLE", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 29, + "src": "3125:16:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 168, + "kind": "modifierInvocation", + "modifierName": { + "id": 166, + "name": "onlyRole", + "nameLocations": [ + "3116:8:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 43744, + "src": "3116:8:0" + }, + "nodeType": "ModifierInvocation", + "src": "3116:26:0" + } + ], + "name": "_authorizeUpgrade", + "nameLocation": "3033:17:0", + "overrides": { + "id": 165, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "3099:8:0" + }, + "parameters": { + "id": 164, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 163, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 171, + "src": "3060:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 162, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3060:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "3050:23:0" + }, + "returnParameters": { + "id": 169, + "nodeType": "ParameterList", + "parameters": [], + "src": "3192:0:0" + }, + "scope": 202, + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "id": 201, + "nodeType": "FunctionDefinition", + "src": "3247:303:0", + "nodes": [], + "body": { + "id": 200, + "nodeType": "Block", + "src": "3353:197:0", + "nodes": [], + "statements": [ + { + "expression": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 198, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 193, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 186, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 181, + "name": "interfaceId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 174, + "src": "3382:11:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 183, + "name": "MessageSender", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 251, + "src": "3402:13:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_MessageSender_$251_$", + "typeString": "type(contract MessageSender)" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_contract$_MessageSender_$251_$", + "typeString": "type(contract MessageSender)" + } + ], + "id": 182, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "3397:4:0", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 184, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3397:19:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_contract$_MessageSender_$251", + "typeString": "type(contract MessageSender)" + } + }, + "id": 185, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3417:11:0", + "memberName": "interfaceId", + "nodeType": "MemberAccess", + "src": "3397:31:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "src": "3382:46:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "id": 192, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 187, + "name": "interfaceId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 174, + "src": "3444:11:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "arguments": [ + { + "id": 189, + "name": "IAccessControl", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44082, + "src": "3464:14:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IAccessControl_$44082_$", + "typeString": "type(contract IAccessControl)" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_contract$_IAccessControl_$44082_$", + "typeString": "type(contract IAccessControl)" + } + ], + "id": 188, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "3459:4:0", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 190, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3459:20:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_contract$_IAccessControl_$44082", + "typeString": "type(contract IAccessControl)" + } + }, + "id": 191, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "3480:11:0", + "memberName": "interfaceId", + "nodeType": "MemberAccess", + "src": "3459:32:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "src": "3444:47:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3382:109:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "arguments": [ + { + "id": 196, + "name": "interfaceId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 174, + "src": "3531:11:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + ], + "expression": { + "id": 194, + "name": "super", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -25, + "src": "3507:5:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_super$_Conversation_$202_$", + "typeString": "type(contract super Conversation)" + } + }, + "id": 195, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "3513:17:0", + "memberName": "supportsInterface", + "nodeType": "MemberAccess", + "referencedDeclaration": 43766, + "src": "3507:23:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes4_$returns$_t_bool_$", + "typeString": "function (bytes4) view returns (bool)" + } + }, + "id": 197, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "3507:36:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3382:161:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 180, + "id": 199, + "nodeType": "Return", + "src": "3363:180:0" + } + ] + }, + "baseFunctions": [ + 43766 + ], + "documentation": { + "id": 172, + "nodeType": "StructuredDocumentation", + "src": "3200:42:0", + "text": " @dev required by ERC165" + }, + "functionSelector": "01ffc9a7", + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "supportsInterface", + "nameLocation": "3256:17:0", + "overrides": { + "id": 177, + "nodeType": "OverrideSpecifier", + "overrides": [ + { + "id": 176, + "name": "AccessControl", + "nameLocations": [ + "3323:13:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 43999, + "src": "3323:13:0" + } + ], + "src": "3314:23:0" + }, + "parameters": { + "id": 175, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 174, + "mutability": "mutable", + "name": "interfaceId", + "nameLocation": "3281:11:0", + "nodeType": "VariableDeclaration", + "scope": 201, + "src": "3274:18:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + }, + "typeName": { + "id": 173, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "3274:6:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "visibility": "internal" + } + ], + "src": "3273:20:0" + }, + "returnParameters": { + "id": 180, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 179, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 201, + "src": "3347:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 178, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3347:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "3346:6:0" + }, + "scope": 202, + "stateMutability": "view", + "virtual": true, + "visibility": "public" + } + ], + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 17, + "name": "MessageSender", + "nameLocations": [ + "920:13:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 251, + "src": "920:13:0" + }, + "id": 18, + "nodeType": "InheritanceSpecifier", + "src": "920:13:0" + }, + { + "baseName": { + "id": 19, + "name": "Initializable", + "nameLocations": [ + "935:13:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 44737, + "src": "935:13:0" + }, + "id": 20, + "nodeType": "InheritanceSpecifier", + "src": "935:13:0" + }, + { + "baseName": { + "id": 21, + "name": "UUPSUpgradeable", + "nameLocations": [ + "950:15:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 44903, + "src": "950:15:0" + }, + "id": 22, + "nodeType": "InheritanceSpecifier", + "src": "950:15:0" + }, + { + "baseName": { + "id": 23, + "name": "AccessControl", + "nameLocations": [ + "967:13:0" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 43999, + "src": "967:13:0" + }, + "id": 24, + "nodeType": "InheritanceSpecifier", + "src": "967:13:0" + } + ], + "canonicalName": "Conversation", + "contractDependencies": [], + "contractKind": "contract", + "documentation": { + "id": 16, + "nodeType": "StructuredDocumentation", + "src": "612:282:0", + "text": " @notice Conversation is a contract for sending messages to an inbox. Each inbox\n is identified by a conversationId. The conversationId is a hash of the internal id\n known to participants in a group chat. The internal id is not known or shared in this\n contract." + }, + "fullyImplemented": true, + "linearizedBaseContracts": [ + 202, + 43999, + 45312, + 45324, + 44082, + 45178, + 44903, + 44096, + 44737, + 251 + ], + "name": "Conversation", + "nameLocation": "904:12:0", + "scope": 203, + "usedErrors": [ + 218, + 44009, + 44012, + 44169, + 44182, + 44500, + 44503, + 44760, + 44765, + 44916, + 44919 + ], + "usedEvents": [ + 214, + 44021, + 44030, + 44039, + 44148, + 44508 + ] + } + ], + "license": "MIT" + }, + "id": 0 +} \ No newline at end of file diff --git a/messaging/src/error.rs b/messaging/src/error.rs new file mode 100644 index 0000000..8273999 --- /dev/null +++ b/messaging/src/error.rs @@ -0,0 +1,17 @@ +use ethers::{ + contract::ContractError, + providers::{Middleware, ProviderError}, +}; +use thiserror::Error; + +use std::num::TryFromIntError; + +#[derive(Error, Debug)] +pub enum MessagingOperationError { + #[error(transparent)] + ContractError(#[from] ContractError), + #[error(transparent)] + ProviderError(#[from] ProviderError), + #[error("Error converting from int: {0}")] + IntConversion(#[from] TryFromIntError), +} diff --git a/messaging/src/lib.rs b/messaging/src/lib.rs index 7d12d9a..e9d6e44 100644 --- a/messaging/src/lib.rs +++ b/messaging/src/lib.rs @@ -1,14 +1,99 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right +pub mod error; + +use error::MessagingOperationError; +use ethers::{ + abi::{Address, Token}, + contract::abigen, + core::abi::encode_packed, + core::types::{Bytes, Signature}, + providers::Middleware, + signers::LocalWallet, + types::H256, + utils::keccak256, +}; +use gateway_types::{error::ExtSignerError, Message, SendMessageResult, Status}; + +abigen!( + Conversation, + "./abi/Conversation.json", + derives(serde::Serialize, serde::Deserialize) +); + +pub struct MessagingOperations { + contract: Conversation, +} + +impl MessagingOperations +where + M: Middleware + 'static, +{ + /// Creates a new MessagingOperations instance + pub fn new(contract: Conversation) -> Self { + Self { contract } + } + + pub async fn send_message( + &self, + m: Message, + ) -> Result> { + let transaction_receipt = self + .contract + .send_message_signed( + m.conversation_id, + m.payload, + m.identity, + m.signature.v.try_into()?, + m.signature.r.into(), + m.signature.s.into(), + ) + .send() + .await? + .await?; + Ok(SendMessageResult { + status: Status::Success, + message: "Message sent.".to_string(), + transaction: transaction_receipt.unwrap().transaction_hash.to_string(), + }) + } +} + +/// Signer for data that is externally signed to be processed by the Conversation Contract. +#[async_trait::async_trait] +pub trait ConversationSignerExt { + /// Sign hash of the data for [`Conversation::send_message_signed`] + async fn sign_xmtp_message( + &self, + conversation: &Conversation, + conversation_id: [u8; 32], + payload: Bytes, + identity: Address, + ) -> Result>; } -#[cfg(test)] -mod tests { - use super::*; +#[async_trait::async_trait] +impl ConversationSignerExt for LocalWallet { + async fn sign_xmtp_message( + &self, + conversation: &Conversation, + conversation_id: [u8; 32], + payload: Bytes, + identity: Address, + ) -> Result> { + let nonce = conversation.nonce(identity).call().await?; + let mut nonce_bytes = [0; 32]; + nonce.to_big_endian(&mut nonce_bytes); + let tokens = vec![ + Token::FixedBytes(vec![0x19]), + Token::FixedBytes(vec![0x0]), + Token::FixedBytes(conversation_id[0..32].to_vec()), + Token::Bytes(payload.to_vec()), + Token::Address(identity), + Token::Bytes(nonce_bytes[0..32].to_vec()), + ]; - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); + let encoded = encode_packed(tokens.as_slice())?; + let digest = H256(keccak256(encoded)); + let signature = self.sign_hash(digest)?; + Ok(signature) } } diff --git a/xps-gateway/Cargo.toml b/xps-gateway/Cargo.toml index 7f777b8..aa01e00 100644 --- a/xps-gateway/Cargo.toml +++ b/xps-gateway/Cargo.toml @@ -25,10 +25,10 @@ clap = { version = "4.4.18", features = ["derive"] } rand = "0.8.5" tokio-stream = { version = "0.1", features = ["net"] } registry = { path = "../registry" } +messaging = { path = "../messaging" } [dev-dependencies] -jsonrpsee = { workspace = true, features = ["macros", "server", "client"]} -tokio = { workspace = true, features = ["macros", "rt", "time"]} +jsonrpsee = { workspace = true, features = ["macros", "server", "client"] } +tokio = { workspace = true, features = ["macros", "rt", "time"] } futures = "0.3" serde_json.workspace = true - diff --git a/xps-gateway/src/lib.rs b/xps-gateway/src/lib.rs index c6b3e8a..0530979 100644 --- a/xps-gateway/src/lib.rs +++ b/xps-gateway/src/lib.rs @@ -7,7 +7,7 @@ use ethers::{ abi::Address, providers::{Provider, Ws}, }; -use gateway_types::DID_ETH_REGISTRY; +use gateway_types::{CONVERSATION, DID_ETH_REGISTRY}; use jsonrpsee::server::Server; use std::str::FromStr; @@ -25,11 +25,12 @@ pub async fn run(host: String, port: u16) -> Result<()> { let addr = server.local_addr()?; let registry_contract = Address::from_str(DID_ETH_REGISTRY)?; + let conversation_contract = Address::from_str(CONVERSATION)?; let provider = Provider::::connect("wss://ethereum-sepolia.publicnode.com") .await .unwrap(); - let context = GatewayContext::new(registry_contract, provider).await?; + let context = GatewayContext::new(registry_contract, conversation_contract, provider).await?; let xps_methods = rpc::XpsMethods::new(&context); let handle = server.start(xps_methods.into_rpc()); diff --git a/xps-gateway/src/rpc/api.rs b/xps-gateway/src/rpc/api.rs index 85abf69..8db35f3 100644 --- a/xps-gateway/src/rpc/api.rs +++ b/xps-gateway/src/rpc/api.rs @@ -4,16 +4,134 @@ use ethers::core::types::Signature; use ethers::prelude::*; use jsonrpsee::{proc_macros::rpc, types::ErrorObjectOwned}; -use gateway_types::Message; use gateway_types::{GrantInstallationResult, KeyPackageResult}; +use gateway_types::{Message, SendMessageResult}; use lib_didethresolver::types::XmtpAttribute; /// XPS JSON-RPC Interface Methods #[rpc(server, client, namespace = "xps")] pub trait Xps { - // Placeholder for send_message, see [the discussion](https://github.com/xmtp/xps-gateway/discussions/11) + /// # Documentation for JSON RPC Endpoint: `sendGroupMessage` + /// + /// ## Overview + /// + /// The `sendGroupMessage` method is used to send a message within a specified conversation. It is an external function that is part of a larger system managing communications between users or entities. This method requires two parameters: a unique identifier for the conversation (`conversationId`) and the message content (`payload`). + /// + /// ## JSON RPC Endpoint Specification + /// + /// ### Request: + /// + /// - **Method:** `POST` + /// - **URL:** `/rpc/v1/sendGroupMessage` + /// - **Headers:** + /// - `Content-Type: application/json` + /// - **Body:** + /// - **JSON Object:** + /// - `jsonrpc`: `"2.0"` + /// - `method`: `"sendGroupMessage"` + /// - `params`: Array (optional parameters as required) + /// - `id`: Request identifier (integer or string) + /// + /// ### Method Name + /// `sendGroupMessage` + /// + /// ### Request Parameters + /// 1. `conversationId`: A unique identifier for the conversation. This is a 32-byte string, typically in hexadecimal format. + /// 2. `payload`: The content of the message. This is a variable-length byte array that can hold any form of data, such as text, images, or other binary formats. + /// 3. `identity`: Message sender address. + /// 4. `sigV`: The signature V + /// 5. `sigR`: The signature R + /// 6. `sigS`: The signature S + /// + /// ### Request Format + /// ```json + /// { + /// "jsonrpc": "2.0", + /// "method": "sendGroupMessage", + /// "params": { + /// "conversationId": "", + /// "payload": "", + /// "identity": "", + /// "V": "", + /// "R": "", + /// "S": "" + /// }, + /// "id": 1 + /// } + /// ``` + /// + /// - `jsonrpc`: Specifies the version of the JSON RPC protocol being used. Always "2.0". + /// - `method`: The name of the method being called. Here it is "sendMessage". + /// - `params`: A structured value holding the parameters necessary for the method. It contains: + /// - `conversationId`: The unique identifier for the conversation. + /// - `payload`: The message content in bytes. + /// - `identity`: The identity of the sender. + /// - `V`: The signature V + /// - `R`: The signature R + /// - `S`: The signature S + /// - `id`: A unique identifier established by the client that must be number or string. Used for correlating the response with the request. + /// + /// ### Response Format + /// The response will typically include the result of the operation or an error if the operation was unsuccessful. + /// + /// #### Success Response + /// ```json + /// { + /// "jsonrpc": "2.0", + /// "result": "status", + /// "tx": "", + /// "id": 1 + /// } + /// ``` + /// + /// - `result`: Contains data related to the success of the operation. The nature of this data can vary based on the implementation. + /// + /// #### Error Response + /// ```json + /// { + /// "jsonrpc": "2.0", + /// "error": { + /// "code": , + /// "message": "" + /// }, + /// "id": 1 + /// } + /// ``` + /// + /// - `error`: An object containing details about the error. + /// - `code`: A numeric error code. + /// - `message`: A human-readable string describing the error. + /// + /// ### Example Usage + /// + /// #### Request + /// ```json + /// { + /// "jsonrpc": "2.0", + /// "method": "sendGroupMessage", + /// "params": { + /// "conversationId": "0x1234abcd...", + /// "payload": "SGVsbG8sIHdvcmxkIQ==", + /// "identity": "0xAddress", + /// "V": "####", + /// "R": "#####", + /// "S": "#####" + /// }, + /// "id": 42 + /// } + /// ``` + /// + /// #### Response + /// ```json + /// { + /// "jsonrpc": "2.0", + /// "result": "Message sent successfully", + /// "tx": "", + /// "id": 42 + /// } + /// ``` #[method(name = "sendMessage")] - async fn send_message(&self, _message: Message) -> Result<(), ErrorObjectOwned>; + async fn send_message(&self, _message: Message) -> Result; /// # Documentation for JSON RPC Endpoint: `grantInstallation` /// diff --git a/xps-gateway/src/rpc/methods.rs b/xps-gateway/src/rpc/methods.rs index 25f3ce6..20b41c7 100644 --- a/xps-gateway/src/rpc/methods.rs +++ b/xps-gateway/src/rpc/methods.rs @@ -3,19 +3,20 @@ use crate::types::{GatewayContext, GatewaySigner}; use super::api::*; -use jsonrpsee::types::error::ErrorCode; use async_trait::async_trait; use ethers::prelude::*; use ethers::{core::types::Signature, providers::Middleware}; -use gateway_types::{GrantInstallationResult, KeyPackageResult}; +use gateway_types::{GrantInstallationResult, KeyPackageResult, SendMessageResult}; use jsonrpsee::types::ErrorObjectOwned; use lib_didethresolver::types::XmtpAttribute; +use messaging::MessagingOperations; use rand::{rngs::StdRng, SeedableRng}; use std::sync::Arc; use thiserror::Error; use gateway_types::Message; +use messaging::error::MessagingOperationError; use registry::{error::ContactOperationError, ContactOperations}; // DEFAULT_ATTRIBUTE_VALIDITY is the hard-coded value we use for the validity of the attributes we set. @@ -24,6 +25,7 @@ pub const DEFAULT_ATTRIBUTE_VALIDITY: u64 = 60 * 60 * 24 * 365; /// Gateway Methods for XPS pub struct XpsMethods { + message_operations: MessagingOperations>, contact_operations: ContactOperations>, pub wallet: LocalWallet, pub signer: Arc>, @@ -32,6 +34,7 @@ pub struct XpsMethods { impl XpsMethods

{ pub fn new(context: &GatewayContext

) -> Self { Self { + message_operations: MessagingOperations::new(context.conversation.clone()), contact_operations: ContactOperations::new(context.registry.clone()), wallet: LocalWallet::new(&mut StdRng::from_entropy()), signer: context.signer.clone(), @@ -41,10 +44,14 @@ impl XpsMethods

{ #[async_trait] impl XpsServer for XpsMethods

{ - async fn send_message(&self, _message: Message) -> Result<(), ErrorObjectOwned> { - //TODO: Stub for sendMessage, ref: [discussion](https://github.com/xmtp/xps-gateway/discussions/11) - log::debug!("xps_sendMessage called"); - Err(ErrorCode::MethodNotFound.into()) + async fn send_message(&self, message: Message) -> Result { + let result = self + .message_operations + .send_message(message) + .await + .map_err(RpcError::from)?; + + Ok(result) } async fn status(&self) -> Result { @@ -113,6 +120,8 @@ enum RpcError { /// A public key parameter was invalid #[error(transparent)] ContactOperation(#[from] ContactOperationError), + #[error(transparent)] + MessagingOperation(#[from] MessagingOperationError), } impl From> for ErrorObjectOwned { @@ -121,6 +130,9 @@ impl From> for ErrorObjectOwned { RpcError::ContactOperation(c) => { ErrorObjectOwned::owned(-31999, c.to_string(), None::<()>) } + RpcError::MessagingOperation(m) => { + ErrorObjectOwned::owned(-31999, m.to_string(), None::<()>) + } } } } diff --git a/xps-gateway/src/types.rs b/xps-gateway/src/types.rs index 7d8eac2..3badfbd 100644 --- a/xps-gateway/src/types.rs +++ b/xps-gateway/src/types.rs @@ -5,22 +5,29 @@ use ethers::{ middleware::SignerMiddleware, providers::Middleware, signers::LocalWallet, types::Address, }; use lib_didethresolver::did_registry::DIDRegistry; +use messaging::Conversation; use rand::{rngs::StdRng, SeedableRng}; pub type GatewaySigner

= SignerMiddleware; pub struct GatewayContext { pub registry: DIDRegistry>, + pub conversation: Conversation>, pub signer: Arc>, } impl GatewayContext

{ - pub async fn new(registry: Address, provider: P) -> Result { + pub async fn new(registry: Address, conversation: Address, provider: P) -> Result { let wallet = LocalWallet::new(&mut StdRng::from_entropy()); let signer = Arc::new(SignerMiddleware::new_with_provider_chain(provider, wallet.clone()).await?); let registry = DIDRegistry::new(registry, signer.clone()); - Ok(Self { registry, signer }) + let conversation = Conversation::new(conversation, signer.clone()); + Ok(Self { + registry, + conversation, + signer, + }) } } @@ -37,6 +44,7 @@ mod tests { mock.push(U64::from(2)).unwrap(); let gateway = GatewayContext::new( + Address::from_str("0x0000000000000000000000000000000000000000").unwrap(), Address::from_str("0x0000000000000000000000000000000000000000").unwrap(), provider, ) @@ -44,6 +52,7 @@ mod tests { .unwrap(); assert!(gateway.registry.address().is_zero()); + assert!(gateway.conversation.address().is_zero()); assert!(gateway.signer.is_signer().await); } } diff --git a/xps-gateway/tests/integration_test.rs b/xps-gateway/tests/integration_test.rs index 9abab96..aa5e578 100644 --- a/xps-gateway/tests/integration_test.rs +++ b/xps-gateway/tests/integration_test.rs @@ -4,13 +4,18 @@ use std::str::FromStr; use anyhow::Error; -use ethers::{signers::LocalWallet, signers::Signer}; +use ethers::{ + signers::{LocalWallet, Signer}, + types::Bytes, + utils::keccak256, +}; use jsonrpsee::core::ClientError; use lib_didethresolver::{ did_registry::RegistrySignerExt, types::{DidUrl, KeyEncoding, XmtpAttribute, XmtpKeyPurpose, NULL_ADDRESS}, }; -use xps_gateway::rpc::*; +use messaging::ConversationSignerExt; +use xps_gateway::rpc::{XpsClient, DEFAULT_ATTRIBUTE_VALIDITY}; use ethers::types::{Address, U256}; use gateway_types::{Message, Status}; @@ -28,17 +33,80 @@ async fn test_say_hello() -> Result<(), Error> { } #[tokio::test] -async fn test_fail_send_message() -> Result<(), Error> { - with_xps_client(None, |client, _, _, _| async move { +async fn test_send_message() -> Result<(), Error> { + with_xps_client(None, |client, context, _resolver, anvil| async move { + let wallet: LocalWallet = anvil.keys()[3].clone().into(); + let me = get_user(&anvil, 3).await; + + let conversation_id = keccak256(b"conversation_id"); + let payload = Bytes::from_static(b"payload"); + + let signature = wallet + .sign_xmtp_message( + &context.conversation, + conversation_id, + payload.clone(), + me.address(), + ) + .await?; + + let message = Message { + conversation_id: conversation_id, + payload: payload, + identity: me.address(), + signature: signature, + }; + + let pre_nonce = context.conversation.nonce(me.address()).call().await?; + assert!(pre_nonce == U256::zero()); + + let result = client.send_message(message).await; + assert!(result.is_ok()); + assert!(result.unwrap().status == Status::Success); + + // post-nonce should be same as pre-nonce + 1 + let post_nonce = context.conversation.nonce(me.address()).call().await?; + assert!(post_nonce == pre_nonce + 1); + Ok(()) + }) + .await +} + +#[tokio::test] +async fn test_send_message_fail() -> Result<(), Error> { + with_xps_client(None, |client, context, _resolver, anvil| async move { + let wallet: LocalWallet = anvil.keys()[3].clone().into(); + let me = get_user(&anvil, 3).await; + + let conversation_id = keccak256(b"conversation_id"); + let payload = Bytes::from_static(b"payload"); + + let signature = wallet + .sign_xmtp_message( + &context.conversation, + keccak256(b"unmatched_conversation_id"), + payload.clone(), + me.address(), + ) + .await?; + let message = Message { - conversation_id: (b"abcdefg").to_vec(), - payload: (b"Hello World").to_vec(), - v: vec![], - r: vec![], - s: vec![], + conversation_id: conversation_id, + payload: payload, + identity: me.address(), + signature: signature, }; + + let pre_nonce = context.conversation.nonce(me.address()).call().await?; + assert!(pre_nonce == U256::zero()); + let result = client.send_message(message).await; assert!(result.is_err()); + println!("{:?}", result.err()); + + // post-nonce should be same as pre-nonce + let post_nonce = context.conversation.nonce(me.address()).call().await?; + assert!(post_nonce == pre_nonce); Ok(()) }) .await @@ -312,8 +380,6 @@ async fn test_revoke_installation() -> Result<(), Error> { .unwrap() .document; - log::debug!("{}", serde_json::to_string_pretty(&doc).unwrap()); - assert_eq!( doc.verification_method[0].id, DidUrl::parse(format!( diff --git a/xps-gateway/tests/integration_util/mod.rs b/xps-gateway/tests/integration_util/mod.rs index 25a6232..ea6f3a5 100644 --- a/xps-gateway/tests/integration_util/mod.rs +++ b/xps-gateway/tests/integration_util/mod.rs @@ -19,6 +19,7 @@ use lib_didethresolver::{ did_registry::{DIDRegistry, RegistrySignerExt}, Resolver, }; +use messaging::Conversation; use std::{ future::Future, sync::{Arc, Once}, @@ -50,14 +51,15 @@ where init_test_logging(); let anvil = Anvil::new().args(vec!["--base-fee", "100"]).spawn(); log::debug!("Anvil spawned at {}", anvil.ws_endpoint()); - let registry_address = deploy_to_anvil(&anvil).await; - log::debug!("Contract deployed at {}", registry_address); + let (registry_address, conversation_address) = deploy_to_anvil(&anvil).await; + log::debug!("Registry contract deployed at {}", registry_address); + log::debug!("Conversation contract deployed at {}", conversation_address); let provider = Provider::::connect(anvil.ws_endpoint()) .await .unwrap() .interval(std::time::Duration::from_millis(10u64)); - let context = GatewayContext::new(registry_address, provider).await?; + let context = GatewayContext::new(registry_address, conversation_address, provider).await?; let accounts = context.signer.get_accounts().await?; let from = accounts[0]; @@ -102,7 +104,7 @@ where } } -async fn deploy_to_anvil(anvil: &AnvilInstance) -> Address { +async fn deploy_to_anvil(anvil: &AnvilInstance) -> (Address, Address) { let wallet: LocalWallet = anvil.keys()[0].clone().into(); let client = client(&anvil, wallet).await; @@ -113,7 +115,14 @@ async fn deploy_to_anvil(anvil: &AnvilInstance) -> Address { .await .unwrap(); - registry.address() + let conversation = Conversation::deploy(client.clone(), ()) + .unwrap() + .gas_price(100) + .send() + .await + .unwrap(); + + (registry.address(), conversation.address()) } async fn client(