/**
Generated by the following Solidity interface...
```solidity
interface SafeERC20Transfer {
error SafeERC20FailedOperation(address token);
function safeTransfer(address token, address to, uint256 value) external;
}
```
...which was generated by the following JSON ABI:
```json
[
{
"type": "function",
"name": "safeTransfer",
"inputs": [
{
"name": "token",
"type": "address",
"internalType": "contract IERC20"
},
{
"name": "to",
"type": "address",
"internalType": "address"
},
{
"name": "value",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "error",
"name": "SafeERC20FailedOperation",
"inputs": [
{
"name": "token",
"type": "address",
"internalType": "address"
}
]
}
]
```*/
#[allow(
non_camel_case_types,
non_snake_case,
clippy::pub_underscore_fields,
clippy::style,
clippy::empty_structs_with_brackets
)]
pub mod SafeERC20Transfer {
use super::*;
use alloy::sol_types as alloy_sol_types;
/// The creation / init bytecode of the contract.
///
/// ```text
///0x60808060405234601557610122908161001a8239f35b5f80fdfe60806004361015600d575f80fd5b5f3560e01c63d1660f9914601f575f80fd5b3460e857606036600319011260e8576004356001600160a01b0381169182820360e8576024356001600160a01b038116929083900360e857602082019263a9059cbb60e01b84526024830152604435604483015260448252608082019282841067ffffffffffffffff85111760d4575f809360209560405251925af11560c9575f513d60c15750803b155b60af57005b635274afe760e01b5f5260045260245ffd5b6001141560aa565b6040513d5f823e3d90fd5b634e487b7160e01b5f52604160045260245ffd5b5f80fdfea26469706673582212201f2464b868d98866e9e58ce5c4b04e43a2ed9f8f5b23d6f4d5821fb154fb917764736f6c634300081e0033
/// ```
#[rustfmt::skip]
#[allow(clippy::all)]
pub static BYTECODE: alloy_sol_types::private::Bytes = alloy_sol_types::private::Bytes::from_static(
b"`\x80\x80`@R4`\x15Wa\x01\"\x90\x81a\0\x1A\x829\xF3[_\x80\xFD\xFE`\x80`\x046\x10\x15`\rW_\x80\xFD[_5`\xE0\x1Cc\xD1f\x0F\x99\x14`\x1FW_\x80\xFD[4`\xE8W``6`\x03\x19\x01\x12`\xE8W`\x045`\x01`\x01`\xA0\x1B\x03\x81\x16\x91\x82\x82\x03`\xE8W`$5`\x01`\x01`\xA0\x1B\x03\x81\x16\x92\x90\x83\x90\x03`\xE8W` \x82\x01\x92c\xA9\x05\x9C\xBB`\xE0\x1B\x84R`$\x83\x01R`D5`D\x83\x01R`D\x82R`\x80\x82\x01\x92\x82\x84\x10g\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x85\x11\x17`\xD4W_\x80\x93` \x95`@RQ\x92Z\xF1\x15`\xC9W_Q=`\xC1WP\x80;\x15[`\xAFW\0[cRt\xAF\xE7`\xE0\x1B_R`\x04R`$_\xFD[`\x01\x14\x15`\xAAV[`@Q=_\x82>=\x90\xFD[cNH{q`\xE0\x1B_R`A`\x04R`$_\xFD[_\x80\xFD\xFE\xA2dipfsX\"\x12 \x1F$d\xB8h\xD9\x88f\xE9\xE5\x8C\xE5\xC4\xB0NC\xA2\xED\x9F\x8F[#\xD6\xF4\xD5\x82\x1F\xB1T\xFB\x91wdsolcC\0\x08\x1E\x003",
);
/// The runtime bytecode of the contract, as deployed on the network.
///
/// ```text
///0x60806004361015600d575f80fd5b5f3560e01c63d1660f9914601f575f80fd5b3460e857606036600319011260e8576004356001600160a01b0381169182820360e8576024356001600160a01b038116929083900360e857602082019263a9059cbb60e01b84526024830152604435604483015260448252608082019282841067ffffffffffffffff85111760d4575f809360209560405251925af11560c9575f513d60c15750803b155b60af57005b635274afe760e01b5f5260045260245ffd5b6001141560aa565b6040513d5f823e3d90fd5b634e487b7160e01b5f52604160045260245ffd5b5f80fdfea26469706673582212201f2464b868d98866e9e58ce5c4b04e43a2ed9f8f5b23d6f4d5821fb154fb917764736f6c634300081e0033
/// ```
#[rustfmt::skip]
#[allow(clippy::all)]
pub static DEPLOYED_BYTECODE: alloy_sol_types::private::Bytes = alloy_sol_types::private::Bytes::from_static(
b"`\x80`\x046\x10\x15`\rW_\x80\xFD[_5`\xE0\x1Cc\xD1f\x0F\x99\x14`\x1FW_\x80\xFD[4`\xE8W``6`\x03\x19\x01\x12`\xE8W`\x045`\x01`\x01`\xA0\x1B\x03\x81\x16\x91\x82\x82\x03`\xE8W`$5`\x01`\x01`\xA0\x1B\x03\x81\x16\x92\x90\x83\x90\x03`\xE8W` \x82\x01\x92c\xA9\x05\x9C\xBB`\xE0\x1B\x84R`$\x83\x01R`D5`D\x83\x01R`D\x82R`\x80\x82\x01\x92\x82\x84\x10g\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x85\x11\x17`\xD4W_\x80\x93` \x95`@RQ\x92Z\xF1\x15`\xC9W_Q=`\xC1WP\x80;\x15[`\xAFW\0[cRt\xAF\xE7`\xE0\x1B_R`\x04R`$_\xFD[`\x01\x14\x15`\xAAV[`@Q=_\x82>=\x90\xFD[cNH{q`\xE0\x1B_R`A`\x04R`$_\xFD[_\x80\xFD\xFE\xA2dipfsX\"\x12 \x1F$d\xB8h\xD9\x88f\xE9\xE5\x8C\xE5\xC4\xB0NC\xA2\xED\x9F\x8F[#\xD6\xF4\xD5\x82\x1F\xB1T\xFB\x91wdsolcC\0\x08\x1E\x003",
);
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Default, Debug, PartialEq, Eq, Hash)]
/**Custom error with signature `SafeERC20FailedOperation(address)` and selector `0x5274afe7`.
```solidity
error SafeERC20FailedOperation(address token);
```*/
#[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)]
#[derive(Clone)]
pub struct SafeERC20FailedOperation {
#[allow(missing_docs)]
pub token: alloy::sol_types::private::Address,
}
#[allow(
non_camel_case_types,
non_snake_case,
clippy::pub_underscore_fields,
clippy::style
)]
const _: () = {
use alloy::sol_types as alloy_sol_types;
#[doc(hidden)]
#[allow(dead_code)]
type UnderlyingSolTuple<'a> = (alloy::sol_types::sol_data::Address,);
#[doc(hidden)]
type UnderlyingRustTuple<'a> = (alloy::sol_types::private::Address,);
#[cfg(test)]
#[allow(dead_code, unreachable_patterns)]
fn _type_assertion(
_t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>,
) {
match _t {
alloy_sol_types::private::AssertTypeEq::<
<UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
>(_) => {}
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<SafeERC20FailedOperation>
for UnderlyingRustTuple<'_> {
fn from(value: SafeERC20FailedOperation) -> Self {
(value.token,)
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<UnderlyingRustTuple<'_>>
for SafeERC20FailedOperation {
fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
Self { token: tuple.0 }
}
}
#[automatically_derived]
impl alloy_sol_types::SolError for SafeERC20FailedOperation {
type Parameters<'a> = UnderlyingSolTuple<'a>;
type Token<'a> = <Self::Parameters<
'a,
> as alloy_sol_types::SolType>::Token<'a>;
const SIGNATURE: &'static str = "SafeERC20FailedOperation(address)";
const SELECTOR: [u8; 4] = [82u8, 116u8, 175u8, 231u8];
#[inline]
fn new<'a>(
tuple: <Self::Parameters<'a> as alloy_sol_types::SolType>::RustType,
) -> Self {
tuple.into()
}
#[inline]
fn tokenize(&self) -> Self::Token<'_> {
(
<alloy::sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize(
&self.token,
),
)
}
#[inline]
fn abi_decode_raw_validate(data: &[u8]) -> alloy_sol_types::Result<Self> {
<Self::Parameters<
'_,
> as alloy_sol_types::SolType>::abi_decode_sequence_validate(data)
.map(Self::new)
}
}
};
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Default, Debug, PartialEq, Eq, Hash)]
/**Function with signature `safeTransfer(address,address,uint256)` and selector `0xd1660f99`.
```solidity
function safeTransfer(address token, address to, uint256 value) external;
```*/
#[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)]
#[derive(Clone)]
pub struct safeTransferCall {
#[allow(missing_docs)]
pub token: alloy::sol_types::private::Address,
#[allow(missing_docs)]
pub to: alloy::sol_types::private::Address,
#[allow(missing_docs)]
pub value: alloy::sol_types::private::primitives::aliases::U256,
}
///Container type for the return parameters of the [`safeTransfer(address,address,uint256)`](safeTransferCall) function.
#[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)]
#[derive(Clone)]
pub struct safeTransferReturn {}
#[allow(
non_camel_case_types,
non_snake_case,
clippy::pub_underscore_fields,
clippy::style
)]
const _: () = {
use alloy::sol_types as alloy_sol_types;
{
#[doc(hidden)]
#[allow(dead_code)]
type UnderlyingSolTuple<'a> = (
alloy::sol_types::sol_data::Address,
alloy::sol_types::sol_data::Address,
alloy::sol_types::sol_data::Uint<256>,
);
#[doc(hidden)]
type UnderlyingRustTuple<'a> = (
alloy::sol_types::private::Address,
alloy::sol_types::private::Address,
alloy::sol_types::private::primitives::aliases::U256,
);
#[cfg(test)]
#[allow(dead_code, unreachable_patterns)]
fn _type_assertion(
_t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>,
) {
match _t {
alloy_sol_types::private::AssertTypeEq::<
<UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
>(_) => {}
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<safeTransferCall> for UnderlyingRustTuple<'_> {
fn from(value: safeTransferCall) -> Self {
(value.token, value.to, value.value)
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<UnderlyingRustTuple<'_>> for safeTransferCall {
fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
Self {
token: tuple.0,
to: tuple.1,
value: tuple.2,
}
}
}
}
{
#[doc(hidden)]
#[allow(dead_code)]
type UnderlyingSolTuple<'a> = ();
#[doc(hidden)]
type UnderlyingRustTuple<'a> = ();
#[cfg(test)]
#[allow(dead_code, unreachable_patterns)]
fn _type_assertion(
_t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>,
) {
match _t {
alloy_sol_types::private::AssertTypeEq::<
<UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
>(_) => {}
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<safeTransferReturn> for UnderlyingRustTuple<'_> {
fn from(value: safeTransferReturn) -> Self {
()
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<UnderlyingRustTuple<'_>> for safeTransferReturn {
fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
Self {}
}
}
}
impl safeTransferReturn {
fn _tokenize(
&self,
) -> <safeTransferCall as alloy_sol_types::SolCall>::ReturnToken<'_> {
()
}
}
#[automatically_derived]
impl alloy_sol_types::SolCall for safeTransferCall {
type Parameters<'a> = (
alloy::sol_types::sol_data::Address,
alloy::sol_types::sol_data::Address,
alloy::sol_types::sol_data::Uint<256>,
);
type Token<'a> = <Self::Parameters<
'a,
> as alloy_sol_types::SolType>::Token<'a>;
type Return = safeTransferReturn;
type ReturnTuple<'a> = ();
type ReturnToken<'a> = <Self::ReturnTuple<
'a,
> as alloy_sol_types::SolType>::Token<'a>;
const SIGNATURE: &'static str = "safeTransfer(address,address,uint256)";
const SELECTOR: [u8; 4] = [209u8, 102u8, 15u8, 153u8];
#[inline]
fn new<'a>(
tuple: <Self::Parameters<'a> as alloy_sol_types::SolType>::RustType,
) -> Self {
tuple.into()
}
#[inline]
fn tokenize(&self) -> Self::Token<'_> {
(
<alloy::sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize(
&self.token,
),
<alloy::sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize(
&self.to,
),
<alloy::sol_types::sol_data::Uint<
256,
> as alloy_sol_types::SolType>::tokenize(&self.value),
)
}
#[inline]
fn tokenize_returns(ret: &Self::Return) -> Self::ReturnToken<'_> {
safeTransferReturn::_tokenize(ret)
}
#[inline]
fn abi_decode_returns(data: &[u8]) -> alloy_sol_types::Result<Self::Return> {
<Self::ReturnTuple<
'_,
> as alloy_sol_types::SolType>::abi_decode_sequence(data)
.map(Into::into)
}
#[inline]
fn abi_decode_returns_validate(
data: &[u8],
) -> alloy_sol_types::Result<Self::Return> {
<Self::ReturnTuple<
'_,
> as alloy_sol_types::SolType>::abi_decode_sequence_validate(data)
.map(Into::into)
}
}
};
///Container for all the [`SafeERC20Transfer`](self) function calls.
#[derive(Clone)]
#[derive(serde::Serialize, serde::Deserialize)]
#[derive()]
pub enum SafeERC20TransferCalls {
#[allow(missing_docs)]
safeTransfer(safeTransferCall),
}
impl SafeERC20TransferCalls {
/// All the selectors of this enum.
///
/// Note that the selectors might not be in the same order as the variants.
/// No guarantees are made about the order of the selectors.
///
/// Prefer using `SolInterface` methods instead.
pub const SELECTORS: &'static [[u8; 4usize]] = &[[209u8, 102u8, 15u8, 153u8]];
/// The names of the variants in the same order as `SELECTORS`.
pub const VARIANT_NAMES: &'static [&'static str] = &[
::core::stringify!(safeTransfer),
];
/// The signatures in the same order as `SELECTORS`.
pub const SIGNATURES: &'static [&'static str] = &[
<safeTransferCall as alloy_sol_types::SolCall>::SIGNATURE,
];
/// Returns the signature for the given selector, if known.
#[inline]
pub fn signature_by_selector(
selector: [u8; 4usize],
) -> ::core::option::Option<&'static str> {
match Self::SELECTORS.binary_search(&selector) {
::core::result::Result::Ok(idx) => {
::core::option::Option::Some(Self::SIGNATURES[idx])
}
::core::result::Result::Err(_) => ::core::option::Option::None,
}
}
/// Returns the enum variant name for the given selector, if known.
#[inline]
pub fn name_by_selector(
selector: [u8; 4usize],
) -> ::core::option::Option<&'static str> {
let sig = Self::signature_by_selector(selector)?;
sig.split_once('(').map(|(name, _)| name)
}
}
#[automatically_derived]
impl alloy_sol_types::SolInterface for SafeERC20TransferCalls {
const NAME: &'static str = "SafeERC20TransferCalls";
const MIN_DATA_LENGTH: usize = 96usize;
const COUNT: usize = 1usize;
#[inline]
fn selector(&self) -> [u8; 4] {
match self {
Self::safeTransfer(_) => {
<safeTransferCall as alloy_sol_types::SolCall>::SELECTOR
}
}
}
#[inline]
fn selector_at(i: usize) -> ::core::option::Option<[u8; 4]> {
Self::SELECTORS.get(i).copied()
}
#[inline]
fn valid_selector(selector: [u8; 4]) -> bool {
Self::SELECTORS.binary_search(&selector).is_ok()
}
#[inline]
#[allow(non_snake_case)]
fn abi_decode_raw(
selector: [u8; 4],
data: &[u8],
) -> alloy_sol_types::Result<Self> {
static DECODE_SHIMS: &[fn(
&[u8],
) -> alloy_sol_types::Result<SafeERC20TransferCalls>] = &[
{
fn safeTransfer(
data: &[u8],
) -> alloy_sol_types::Result<SafeERC20TransferCalls> {
<safeTransferCall as alloy_sol_types::SolCall>::abi_decode_raw(
data,
)
.map(SafeERC20TransferCalls::safeTransfer)
}
safeTransfer
},
];
let Ok(idx) = Self::SELECTORS.binary_search(&selector) else {
return Err(
alloy_sol_types::Error::unknown_selector(
<Self as alloy_sol_types::SolInterface>::NAME,
selector,
),
);
};
DECODE_SHIMS[idx](data)
}
#[inline]
#[allow(non_snake_case)]
fn abi_decode_raw_validate(
selector: [u8; 4],
data: &[u8],
) -> alloy_sol_types::Result<Self> {
static DECODE_VALIDATE_SHIMS: &[fn(
&[u8],
) -> alloy_sol_types::Result<SafeERC20TransferCalls>] = &[
{
fn safeTransfer(
data: &[u8],
) -> alloy_sol_types::Result<SafeERC20TransferCalls> {
<safeTransferCall as alloy_sol_types::SolCall>::abi_decode_raw_validate(
data,
)
.map(SafeERC20TransferCalls::safeTransfer)
}
safeTransfer
},
];
let Ok(idx) = Self::SELECTORS.binary_search(&selector) else {
return Err(
alloy_sol_types::Error::unknown_selector(
<Self as alloy_sol_types::SolInterface>::NAME,
selector,
),
);
};
DECODE_VALIDATE_SHIMS[idx](data)
}
#[inline]
fn abi_encoded_size(&self) -> usize {
match self {
Self::safeTransfer(inner) => {
<safeTransferCall as alloy_sol_types::SolCall>::abi_encoded_size(
inner,
)
}
}
}
#[inline]
fn abi_encode_raw(&self, out: &mut alloy_sol_types::private::Vec<u8>) {
match self {
Self::safeTransfer(inner) => {
<safeTransferCall as alloy_sol_types::SolCall>::abi_encode_raw(
inner,
out,
)
}
}
}
}
///Container for all the [`SafeERC20Transfer`](self) custom errors.
#[derive(Clone)]
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Debug, PartialEq, Eq, Hash)]
pub enum SafeERC20TransferErrors {
#[allow(missing_docs)]
SafeERC20FailedOperation(SafeERC20FailedOperation),
}
impl SafeERC20TransferErrors {
/// All the selectors of this enum.
///
/// Note that the selectors might not be in the same order as the variants.
/// No guarantees are made about the order of the selectors.
///
/// Prefer using `SolInterface` methods instead.
pub const SELECTORS: &'static [[u8; 4usize]] = &[[82u8, 116u8, 175u8, 231u8]];
/// The names of the variants in the same order as `SELECTORS`.
pub const VARIANT_NAMES: &'static [&'static str] = &[
::core::stringify!(SafeERC20FailedOperation),
];
/// The signatures in the same order as `SELECTORS`.
pub const SIGNATURES: &'static [&'static str] = &[
<SafeERC20FailedOperation as alloy_sol_types::SolError>::SIGNATURE,
];
/// Returns the signature for the given selector, if known.
#[inline]
pub fn signature_by_selector(
selector: [u8; 4usize],
) -> ::core::option::Option<&'static str> {
match Self::SELECTORS.binary_search(&selector) {
::core::result::Result::Ok(idx) => {
::core::option::Option::Some(Self::SIGNATURES[idx])
}
::core::result::Result::Err(_) => ::core::option::Option::None,
}
}
/// Returns the enum variant name for the given selector, if known.
#[inline]
pub fn name_by_selector(
selector: [u8; 4usize],
) -> ::core::option::Option<&'static str> {
let sig = Self::signature_by_selector(selector)?;
sig.split_once('(').map(|(name, _)| name)
}
}
#[automatically_derived]
impl alloy_sol_types::SolInterface for SafeERC20TransferErrors {
const NAME: &'static str = "SafeERC20TransferErrors";
const MIN_DATA_LENGTH: usize = 32usize;
const COUNT: usize = 1usize;
#[inline]
fn selector(&self) -> [u8; 4] {
match self {
Self::SafeERC20FailedOperation(_) => {
<SafeERC20FailedOperation as alloy_sol_types::SolError>::SELECTOR
}
}
}
#[inline]
fn selector_at(i: usize) -> ::core::option::Option<[u8; 4]> {
Self::SELECTORS.get(i).copied()
}
#[inline]
fn valid_selector(selector: [u8; 4]) -> bool {
Self::SELECTORS.binary_search(&selector).is_ok()
}
#[inline]
#[allow(non_snake_case)]
fn abi_decode_raw(
selector: [u8; 4],
data: &[u8],
) -> alloy_sol_types::Result<Self> {
static DECODE_SHIMS: &[fn(
&[u8],
) -> alloy_sol_types::Result<SafeERC20TransferErrors>] = &[
{
fn SafeERC20FailedOperation(
data: &[u8],
) -> alloy_sol_types::Result<SafeERC20TransferErrors> {
<SafeERC20FailedOperation as alloy_sol_types::SolError>::abi_decode_raw(
data,
)
.map(SafeERC20TransferErrors::SafeERC20FailedOperation)
}
SafeERC20FailedOperation
},
];
let Ok(idx) = Self::SELECTORS.binary_search(&selector) else {
return Err(
alloy_sol_types::Error::unknown_selector(
<Self as alloy_sol_types::SolInterface>::NAME,
selector,
),
);
};
DECODE_SHIMS[idx](data)
}
#[inline]
#[allow(non_snake_case)]
fn abi_decode_raw_validate(
selector: [u8; 4],
data: &[u8],
) -> alloy_sol_types::Result<Self> {
static DECODE_VALIDATE_SHIMS: &[fn(
&[u8],
) -> alloy_sol_types::Result<SafeERC20TransferErrors>] = &[
{
fn SafeERC20FailedOperation(
data: &[u8],
) -> alloy_sol_types::Result<SafeERC20TransferErrors> {
<SafeERC20FailedOperation as alloy_sol_types::SolError>::abi_decode_raw_validate(
data,
)
.map(SafeERC20TransferErrors::SafeERC20FailedOperation)
}
SafeERC20FailedOperation
},
];
let Ok(idx) = Self::SELECTORS.binary_search(&selector) else {
return Err(
alloy_sol_types::Error::unknown_selector(
<Self as alloy_sol_types::SolInterface>::NAME,
selector,
),
);
};
DECODE_VALIDATE_SHIMS[idx](data)
}
#[inline]
fn abi_encoded_size(&self) -> usize {
match self {
Self::SafeERC20FailedOperation(inner) => {
<SafeERC20FailedOperation as alloy_sol_types::SolError>::abi_encoded_size(
inner,
)
}
}
}
#[inline]
fn abi_encode_raw(&self, out: &mut alloy_sol_types::private::Vec<u8>) {
match self {
Self::SafeERC20FailedOperation(inner) => {
<SafeERC20FailedOperation as alloy_sol_types::SolError>::abi_encode_raw(
inner,
out,
)
}
}
}
}
use alloy::contract as alloy_contract;
/**Creates a new wrapper around an on-chain [`SafeERC20Transfer`](self) contract instance.
See the [wrapper's documentation](`SafeERC20TransferInstance`) for more details.*/
#[inline]
pub const fn new<
P: alloy_contract::private::Provider<N>,
N: alloy_contract::private::Network,
>(
address: alloy_sol_types::private::Address,
__provider: P,
) -> SafeERC20TransferInstance<P, N> {
SafeERC20TransferInstance::<P, N>::new(address, __provider)
}
/**Deploys this contract using the given `provider` and constructor arguments, if any.
Returns a new instance of the contract, if the deployment was successful.
For more fine-grained control over the deployment process, use [`deploy_builder`] instead.*/
#[inline]
pub fn deploy<
P: alloy_contract::private::Provider<N>,
N: alloy_contract::private::Network,
>(
__provider: P,
) -> impl ::core::future::Future<
Output = alloy_contract::Result<SafeERC20TransferInstance<P, N>>,
> {
SafeERC20TransferInstance::<P, N>::deploy(__provider)
}
/**Creates a `RawCallBuilder` for deploying this contract using the given `provider`
and constructor arguments, if any.
This is a simple wrapper around creating a `RawCallBuilder` with the data set to
the bytecode concatenated with the constructor's ABI-encoded arguments.*/
#[inline]
pub fn deploy_builder<
P: alloy_contract::private::Provider<N>,
N: alloy_contract::private::Network,
>(__provider: P) -> alloy_contract::RawCallBuilder<P, N> {
SafeERC20TransferInstance::<P, N>::deploy_builder(__provider)
}
/**A [`SafeERC20Transfer`](self) instance.
Contains type-safe methods for interacting with an on-chain instance of the
[`SafeERC20Transfer`](self) contract located at a given `address`, using a given
provider `P`.
If the contract bytecode is available (see the [`sol!`](alloy_sol_types::sol!)
documentation on how to provide it), the `deploy` and `deploy_builder` methods can
be used to deploy a new instance of the contract.
See the [module-level documentation](self) for all the available methods.*/
#[derive(Clone)]
pub struct SafeERC20TransferInstance<P, N = alloy_contract::private::Ethereum> {
address: alloy_sol_types::private::Address,
provider: P,
_network: ::core::marker::PhantomData<N>,
}
#[automatically_derived]
impl<P, N> ::core::fmt::Debug for SafeERC20TransferInstance<P, N> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_tuple("SafeERC20TransferInstance").field(&self.address).finish()
}
}
/// Instantiation and getters/setters.
impl<
P: alloy_contract::private::Provider<N>,
N: alloy_contract::private::Network,
> SafeERC20TransferInstance<P, N> {
/**Creates a new wrapper around an on-chain [`SafeERC20Transfer`](self) contract instance.
See the [wrapper's documentation](`SafeERC20TransferInstance`) for more details.*/
#[inline]
pub const fn new(
address: alloy_sol_types::private::Address,
__provider: P,
) -> Self {
Self {
address,
provider: __provider,
_network: ::core::marker::PhantomData,
}
}
/**Deploys this contract using the given `provider` and constructor arguments, if any.
Returns a new instance of the contract, if the deployment was successful.
For more fine-grained control over the deployment process, use [`deploy_builder`] instead.*/
#[inline]
pub async fn deploy(
__provider: P,
) -> alloy_contract::Result<SafeERC20TransferInstance<P, N>> {
let call_builder = Self::deploy_builder(__provider);
let contract_address = call_builder.deploy().await?;
Ok(Self::new(contract_address, call_builder.provider))
}
/**Creates a `RawCallBuilder` for deploying this contract using the given `provider`
and constructor arguments, if any.
This is a simple wrapper around creating a `RawCallBuilder` with the data set to
the bytecode concatenated with the constructor's ABI-encoded arguments.*/
#[inline]
pub fn deploy_builder(__provider: P) -> alloy_contract::RawCallBuilder<P, N> {
alloy_contract::RawCallBuilder::new_raw_deploy(
__provider,
::core::clone::Clone::clone(&BYTECODE),
)
}
/// Returns a reference to the address.
#[inline]
pub const fn address(&self) -> &alloy_sol_types::private::Address {
&self.address
}
/// Sets the address.
#[inline]
pub fn set_address(&mut self, address: alloy_sol_types::private::Address) {
self.address = address;
}
/// Sets the address and returns `self`.
pub fn at(mut self, address: alloy_sol_types::private::Address) -> Self {
self.set_address(address);
self
}
/// Returns a reference to the provider.
#[inline]
pub const fn provider(&self) -> &P {
&self.provider
}
}
impl<P: ::core::clone::Clone, N> SafeERC20TransferInstance<&P, N> {
/// Clones the provider and returns a new instance with the cloned provider.
#[inline]
pub fn with_cloned_provider(self) -> SafeERC20TransferInstance<P, N> {
SafeERC20TransferInstance {
address: self.address,
provider: ::core::clone::Clone::clone(&self.provider),
_network: ::core::marker::PhantomData,
}
}
}
/// Function calls.
impl<
P: alloy_contract::private::Provider<N>,
N: alloy_contract::private::Network,
> SafeERC20TransferInstance<P, N> {
/// Creates a new call builder using this contract instance's provider and address.
///
/// Note that the call can be any function call, not just those defined in this
/// contract. Prefer using the other methods for building type-safe contract calls.
pub fn call_builder<C: alloy_sol_types::SolCall>(
&self,
call: &C,
) -> alloy_contract::SolCallBuilder<&P, C, N> {
alloy_contract::SolCallBuilder::new_sol(&self.provider, &self.address, call)
}
///Creates a new call builder for the [`safeTransfer`] function.
pub fn safeTransfer(
&self,
token: alloy::sol_types::private::Address,
to: alloy::sol_types::private::Address,
value: alloy::sol_types::private::primitives::aliases::U256,
) -> alloy_contract::SolCallBuilder<&P, safeTransferCall, N> {
self.call_builder(
&safeTransferCall {
token,
to,
value,
},
)
}
}
/// Event filters.
impl<
P: alloy_contract::private::Provider<N>,
N: alloy_contract::private::Network,
> SafeERC20TransferInstance<P, N> {
/// Creates a new event filter using this contract instance's provider and address.
///
/// Note that the type can be any event, not just those defined in this contract.
/// Prefer using the other methods for building type-safe event filters.
pub fn event_filter<E: alloy_sol_types::SolEvent>(
&self,
) -> alloy_contract::Event<&P, E, N> {
alloy_contract::Event::new_sol(&self.provider, &self.address)
}
}
}