pub use conditional_escrow::*;
/// This module was auto-generated with ethers-rs Abigen.
/// More information at: <https://github.com/gakonst/ethers-rs>
#[allow(
clippy::enum_variant_names,
clippy::too_many_arguments,
clippy::upper_case_acronyms,
clippy::type_complexity,
dead_code,
non_camel_case_types,
)]
pub mod conditional_escrow {
#[rustfmt::skip]
const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"payee\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"uint256\",\"name\":\"weiAmount\",\"type\":\"uint256\",\"components\":[],\"indexed\":false}],\"type\":\"event\",\"name\":\"Deposited\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\",\"components\":[],\"indexed\":true}],\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"payee\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"uint256\",\"name\":\"weiAmount\",\"type\":\"uint256\",\"components\":[],\"indexed\":false}],\"type\":\"event\",\"name\":\"Withdrawn\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"payee\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"payable\",\"type\":\"function\",\"name\":\"deposit\",\"outputs\":[]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"payee\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"depositsOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\",\"components\":[]}]},{\"inputs\":[],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\",\"components\":[]}]},{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"renounceOwnership\",\"outputs\":[]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"transferOwnership\",\"outputs\":[]},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"payee\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"withdraw\",\"outputs\":[]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"payee\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"withdrawalAllowed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\",\"components\":[]}]}]";
///The parsed JSON ABI of the contract.
pub static CONDITIONALESCROW_ABI: ::ethers_contract::Lazy<::ethers_core::abi::Abi> = ::ethers_contract::Lazy::new(||
::ethers_core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid"));
pub struct ConditionalEscrow<M>(::ethers_contract::Contract<M>);
impl<M> ::core::clone::Clone for ConditionalEscrow<M> {
fn clone(&self) -> Self {
Self(::core::clone::Clone::clone(&self.0))
}
}
impl<M> ::core::ops::Deref for ConditionalEscrow<M> {
type Target = ::ethers_contract::Contract<M>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl<M> ::core::ops::DerefMut for ConditionalEscrow<M> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl<M> ::core::fmt::Debug for ConditionalEscrow<M> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_tuple(stringify!(ConditionalEscrow)).field(&self.address()).finish()
}
}
impl<M: ::ethers_providers::Middleware> ConditionalEscrow<M> {
/// Creates a new contract instance with the specified `ethers` client at
/// `address`. The contract derefs to a `ethers::Contract` object.
pub fn new<T: Into<::ethers_core::types::Address>>(
address: T,
client: ::std::sync::Arc<M>,
) -> Self {
Self(
::ethers_contract::Contract::new(
address.into(),
CONDITIONALESCROW_ABI.clone(),
client,
),
)
}
///Calls the contract's `deposit` (0xf340fa01) function
pub fn deposit(
&self,
payee: ::ethers_core::types::Address,
) -> ::ethers_contract::builders::ContractCall<M, ()> {
self.0
.method_hash([243, 64, 250, 1], payee)
.expect("method not found (this should never happen)")
}
///Calls the contract's `depositsOf` (0xe3a9db1a) function
pub fn deposits_of(
&self,
payee: ::ethers_core::types::Address,
) -> ::ethers_contract::builders::ContractCall<M, ::ethers_core::types::U256> {
self.0
.method_hash([227, 169, 219, 26], payee)
.expect("method not found (this should never happen)")
}
///Calls the contract's `owner` (0x8da5cb5b) function
pub fn owner(
&self,
) -> ::ethers_contract::builders::ContractCall<
M,
::ethers_core::types::Address,
> {
self.0
.method_hash([141, 165, 203, 91], ())
.expect("method not found (this should never happen)")
}
///Calls the contract's `renounceOwnership` (0x715018a6) function
pub fn renounce_ownership(
&self,
) -> ::ethers_contract::builders::ContractCall<M, ()> {
self.0
.method_hash([113, 80, 24, 166], ())
.expect("method not found (this should never happen)")
}
///Calls the contract's `transferOwnership` (0xf2fde38b) function
pub fn transfer_ownership(
&self,
new_owner: ::ethers_core::types::Address,
) -> ::ethers_contract::builders::ContractCall<M, ()> {
self.0
.method_hash([242, 253, 227, 139], new_owner)
.expect("method not found (this should never happen)")
}
///Calls the contract's `withdraw` (0x51cff8d9) function
pub fn withdraw(
&self,
payee: ::ethers_core::types::Address,
) -> ::ethers_contract::builders::ContractCall<M, ()> {
self.0
.method_hash([81, 207, 248, 217], payee)
.expect("method not found (this should never happen)")
}
///Calls the contract's `withdrawalAllowed` (0x685ca194) function
pub fn withdrawal_allowed(
&self,
payee: ::ethers_core::types::Address,
) -> ::ethers_contract::builders::ContractCall<M, bool> {
self.0
.method_hash([104, 92, 161, 148], payee)
.expect("method not found (this should never happen)")
}
///Gets the contract's `Deposited` event
pub fn deposited_filter(
&self,
) -> ::ethers_contract::builders::Event<
::std::sync::Arc<M>,
M,
DepositedFilter,
> {
self.0.event()
}
///Gets the contract's `OwnershipTransferred` event
pub fn ownership_transferred_filter(
&self,
) -> ::ethers_contract::builders::Event<
::std::sync::Arc<M>,
M,
OwnershipTransferredFilter,
> {
self.0.event()
}
///Gets the contract's `Withdrawn` event
pub fn withdrawn_filter(
&self,
) -> ::ethers_contract::builders::Event<
::std::sync::Arc<M>,
M,
WithdrawnFilter,
> {
self.0.event()
}
/// Returns an `Event` builder for all the events of this contract.
pub fn events(
&self,
) -> ::ethers_contract::builders::Event<
::std::sync::Arc<M>,
M,
ConditionalEscrowEvents,
> {
self.0.event_with_filter(::core::default::Default::default())
}
}
impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
for ConditionalEscrow<M> {
fn from(contract: ::ethers_contract::Contract<M>) -> Self {
Self::new(contract.address(), contract.client())
}
}
#[derive(
Clone,
::ethers_contract::EthEvent,
::ethers_contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethevent(name = "Deposited", abi = "Deposited(address,uint256)")]
pub struct DepositedFilter {
#[ethevent(indexed)]
pub payee: ::ethers_core::types::Address,
pub wei_amount: ::ethers_core::types::U256,
}
#[derive(
Clone,
::ethers_contract::EthEvent,
::ethers_contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethevent(
name = "OwnershipTransferred",
abi = "OwnershipTransferred(address,address)"
)]
pub struct OwnershipTransferredFilter {
#[ethevent(indexed)]
pub previous_owner: ::ethers_core::types::Address,
#[ethevent(indexed)]
pub new_owner: ::ethers_core::types::Address,
}
#[derive(
Clone,
::ethers_contract::EthEvent,
::ethers_contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethevent(name = "Withdrawn", abi = "Withdrawn(address,uint256)")]
pub struct WithdrawnFilter {
#[ethevent(indexed)]
pub payee: ::ethers_core::types::Address,
pub wei_amount: ::ethers_core::types::U256,
}
///Container type for all of the contract's events
#[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
pub enum ConditionalEscrowEvents {
DepositedFilter(DepositedFilter),
OwnershipTransferredFilter(OwnershipTransferredFilter),
WithdrawnFilter(WithdrawnFilter),
}
impl ::ethers_contract::EthLogDecode for ConditionalEscrowEvents {
fn decode_log(
log: &::ethers_core::abi::RawLog,
) -> ::core::result::Result<Self, ::ethers_core::abi::Error> {
if let Ok(decoded) = DepositedFilter::decode_log(log) {
return Ok(ConditionalEscrowEvents::DepositedFilter(decoded));
}
if let Ok(decoded) = OwnershipTransferredFilter::decode_log(log) {
return Ok(ConditionalEscrowEvents::OwnershipTransferredFilter(decoded));
}
if let Ok(decoded) = WithdrawnFilter::decode_log(log) {
return Ok(ConditionalEscrowEvents::WithdrawnFilter(decoded));
}
Err(::ethers_core::abi::Error::InvalidData)
}
}
impl ::core::fmt::Display for ConditionalEscrowEvents {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
match self {
Self::DepositedFilter(element) => ::core::fmt::Display::fmt(element, f),
Self::OwnershipTransferredFilter(element) => {
::core::fmt::Display::fmt(element, f)
}
Self::WithdrawnFilter(element) => ::core::fmt::Display::fmt(element, f),
}
}
}
impl ::core::convert::From<DepositedFilter> for ConditionalEscrowEvents {
fn from(value: DepositedFilter) -> Self {
Self::DepositedFilter(value)
}
}
impl ::core::convert::From<OwnershipTransferredFilter> for ConditionalEscrowEvents {
fn from(value: OwnershipTransferredFilter) -> Self {
Self::OwnershipTransferredFilter(value)
}
}
impl ::core::convert::From<WithdrawnFilter> for ConditionalEscrowEvents {
fn from(value: WithdrawnFilter) -> Self {
Self::WithdrawnFilter(value)
}
}
///Container type for all input parameters for the `deposit` function with signature `deposit(address)` and selector `0xf340fa01`
#[derive(
Clone,
::ethers_contract::EthCall,
::ethers_contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "deposit", abi = "deposit(address)")]
pub struct DepositCall {
pub payee: ::ethers_core::types::Address,
}
///Container type for all input parameters for the `depositsOf` function with signature `depositsOf(address)` and selector `0xe3a9db1a`
#[derive(
Clone,
::ethers_contract::EthCall,
::ethers_contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "depositsOf", abi = "depositsOf(address)")]
pub struct DepositsOfCall {
pub payee: ::ethers_core::types::Address,
}
///Container type for all input parameters for the `owner` function with signature `owner()` and selector `0x8da5cb5b`
#[derive(
Clone,
::ethers_contract::EthCall,
::ethers_contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "owner", abi = "owner()")]
pub struct OwnerCall;
///Container type for all input parameters for the `renounceOwnership` function with signature `renounceOwnership()` and selector `0x715018a6`
#[derive(
Clone,
::ethers_contract::EthCall,
::ethers_contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "renounceOwnership", abi = "renounceOwnership()")]
pub struct RenounceOwnershipCall;
///Container type for all input parameters for the `transferOwnership` function with signature `transferOwnership(address)` and selector `0xf2fde38b`
#[derive(
Clone,
::ethers_contract::EthCall,
::ethers_contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "transferOwnership", abi = "transferOwnership(address)")]
pub struct TransferOwnershipCall {
pub new_owner: ::ethers_core::types::Address,
}
///Container type for all input parameters for the `withdraw` function with signature `withdraw(address)` and selector `0x51cff8d9`
#[derive(
Clone,
::ethers_contract::EthCall,
::ethers_contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "withdraw", abi = "withdraw(address)")]
pub struct WithdrawCall {
pub payee: ::ethers_core::types::Address,
}
///Container type for all input parameters for the `withdrawalAllowed` function with signature `withdrawalAllowed(address)` and selector `0x685ca194`
#[derive(
Clone,
::ethers_contract::EthCall,
::ethers_contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "withdrawalAllowed", abi = "withdrawalAllowed(address)")]
pub struct WithdrawalAllowedCall {
pub payee: ::ethers_core::types::Address,
}
///Container type for all of the contract's call
#[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
pub enum ConditionalEscrowCalls {
Deposit(DepositCall),
DepositsOf(DepositsOfCall),
Owner(OwnerCall),
RenounceOwnership(RenounceOwnershipCall),
TransferOwnership(TransferOwnershipCall),
Withdraw(WithdrawCall),
WithdrawalAllowed(WithdrawalAllowedCall),
}
impl ::ethers_core::abi::AbiDecode for ConditionalEscrowCalls {
fn decode(
data: impl AsRef<[u8]>,
) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
let data = data.as_ref();
if let Ok(decoded)
= <DepositCall as ::ethers_core::abi::AbiDecode>::decode(data) {
return Ok(Self::Deposit(decoded));
}
if let Ok(decoded)
= <DepositsOfCall as ::ethers_core::abi::AbiDecode>::decode(data) {
return Ok(Self::DepositsOf(decoded));
}
if let Ok(decoded)
= <OwnerCall as ::ethers_core::abi::AbiDecode>::decode(data) {
return Ok(Self::Owner(decoded));
}
if let Ok(decoded)
= <RenounceOwnershipCall as ::ethers_core::abi::AbiDecode>::decode(
data,
) {
return Ok(Self::RenounceOwnership(decoded));
}
if let Ok(decoded)
= <TransferOwnershipCall as ::ethers_core::abi::AbiDecode>::decode(
data,
) {
return Ok(Self::TransferOwnership(decoded));
}
if let Ok(decoded)
= <WithdrawCall as ::ethers_core::abi::AbiDecode>::decode(data) {
return Ok(Self::Withdraw(decoded));
}
if let Ok(decoded)
= <WithdrawalAllowedCall as ::ethers_core::abi::AbiDecode>::decode(
data,
) {
return Ok(Self::WithdrawalAllowed(decoded));
}
Err(::ethers_core::abi::Error::InvalidData.into())
}
}
impl ::ethers_core::abi::AbiEncode for ConditionalEscrowCalls {
fn encode(self) -> Vec<u8> {
match self {
Self::Deposit(element) => ::ethers_core::abi::AbiEncode::encode(element),
Self::DepositsOf(element) => {
::ethers_core::abi::AbiEncode::encode(element)
}
Self::Owner(element) => ::ethers_core::abi::AbiEncode::encode(element),
Self::RenounceOwnership(element) => {
::ethers_core::abi::AbiEncode::encode(element)
}
Self::TransferOwnership(element) => {
::ethers_core::abi::AbiEncode::encode(element)
}
Self::Withdraw(element) => ::ethers_core::abi::AbiEncode::encode(element),
Self::WithdrawalAllowed(element) => {
::ethers_core::abi::AbiEncode::encode(element)
}
}
}
}
impl ::core::fmt::Display for ConditionalEscrowCalls {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
match self {
Self::Deposit(element) => ::core::fmt::Display::fmt(element, f),
Self::DepositsOf(element) => ::core::fmt::Display::fmt(element, f),
Self::Owner(element) => ::core::fmt::Display::fmt(element, f),
Self::RenounceOwnership(element) => ::core::fmt::Display::fmt(element, f),
Self::TransferOwnership(element) => ::core::fmt::Display::fmt(element, f),
Self::Withdraw(element) => ::core::fmt::Display::fmt(element, f),
Self::WithdrawalAllowed(element) => ::core::fmt::Display::fmt(element, f),
}
}
}
impl ::core::convert::From<DepositCall> for ConditionalEscrowCalls {
fn from(value: DepositCall) -> Self {
Self::Deposit(value)
}
}
impl ::core::convert::From<DepositsOfCall> for ConditionalEscrowCalls {
fn from(value: DepositsOfCall) -> Self {
Self::DepositsOf(value)
}
}
impl ::core::convert::From<OwnerCall> for ConditionalEscrowCalls {
fn from(value: OwnerCall) -> Self {
Self::Owner(value)
}
}
impl ::core::convert::From<RenounceOwnershipCall> for ConditionalEscrowCalls {
fn from(value: RenounceOwnershipCall) -> Self {
Self::RenounceOwnership(value)
}
}
impl ::core::convert::From<TransferOwnershipCall> for ConditionalEscrowCalls {
fn from(value: TransferOwnershipCall) -> Self {
Self::TransferOwnership(value)
}
}
impl ::core::convert::From<WithdrawCall> for ConditionalEscrowCalls {
fn from(value: WithdrawCall) -> Self {
Self::Withdraw(value)
}
}
impl ::core::convert::From<WithdrawalAllowedCall> for ConditionalEscrowCalls {
fn from(value: WithdrawalAllowedCall) -> Self {
Self::WithdrawalAllowed(value)
}
}
///Container type for all return fields from the `depositsOf` function with signature `depositsOf(address)` and selector `0xe3a9db1a`
#[derive(
Clone,
::ethers_contract::EthAbiType,
::ethers_contract::EthAbiCodec,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
pub struct DepositsOfReturn(pub ::ethers_core::types::U256);
///Container type for all return fields from the `owner` function with signature `owner()` and selector `0x8da5cb5b`
#[derive(
Clone,
::ethers_contract::EthAbiType,
::ethers_contract::EthAbiCodec,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
pub struct OwnerReturn(pub ::ethers_core::types::Address);
///Container type for all return fields from the `withdrawalAllowed` function with signature `withdrawalAllowed(address)` and selector `0x685ca194`
#[derive(
Clone,
::ethers_contract::EthAbiType,
::ethers_contract::EthAbiCodec,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
pub struct WithdrawalAllowedReturn(pub bool);
}