Repository: OpenZeppelin/rust-contracts-stylus
Pull request #395 (2024-11-07 11:38:56)

chore: update CODEOWNERS

netlify[bot]: ### <span aria-hidden="true">👷</span> Deploy Preview for *contracts-stylus* processing.


|  Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | c19d24e4dae7c194d2cf5b0f2d7be0adef4bc040 |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/sites/contracts-stylus/deploys/672ca6d371ca910009b792c6 |

Patch:
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index da7375e..91d2efb 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -1,1 +1,1 @@
-*       @bidzyyys @qalisander
+*       @bidzyyys @qalisander @0xNeshi
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index b2ce1d6..0420c5e 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -127,4 +127,4 @@ jobs:
         uses: actions/checkout@v4
 
       - name: Check spelling of files in the workspace
-        uses: crate-ci/typos@v1.27.0
+        uses: crate-ci/typos@v1.27.2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e7a0f22..fd754d3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Added
 
+- `SafeErc20` Utility. #289
 - Finite Fields arithmetics. #376
 
 ### Changed
diff --git a/Cargo.lock b/Cargo.lock
index 114a982..6e23af6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2442,7 +2442,7 @@ dependencies = [
 
 [[package]]
 name = "motsu-proc"
-version = "0.1.0"
+version = "0.2.0"
 dependencies = [
  "alloy-primitives",
  "alloy-sol-types",
@@ -3242,6 +3242,19 @@ version = "1.0.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
 
+[[package]]
+name = "safe-erc20-example"
+version = "0.1.1"
+dependencies = [
+ "alloy",
+ "alloy-primitives",
+ "e2e",
+ "eyre",
+ "openzeppelin-stylus",
+ "stylus-sdk",
+ "tokio",
+]
+
 [[package]]
 name = "salsa20"
 version = "0.10.2"
diff --git a/Cargo.toml b/Cargo.toml
index cce0cb0..40e3291 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,6 +18,7 @@ members = [
   "examples/basic/token",
   "examples/basic/script",
   "examples/ecdsa",
+  "examples/safe-erc20",
   "benches",
 ]
 default-members = [
@@ -32,6 +33,7 @@ default-members = [
   "examples/erc721",
   "examples/erc721-consecutive",
   "examples/erc721-metadata",
+  "examples/safe-erc20",
   "examples/merkle-proofs",
   "examples/ownable",
   "examples/access-control",
@@ -111,7 +113,7 @@ openzeppelin-stylus = { path = "contracts" }
 openzeppelin-stylus-proc = { path = "contracts-proc", version = "0.1.0" }
 openzeppelin-crypto = { path = "lib/crypto" }
 motsu = { path = "lib/motsu" }
-motsu-proc = { path = "lib/motsu-proc", version = "0.1.0" }
+motsu-proc = { path = "lib/motsu-proc", version = ">=0.1, <0.3" }
 e2e = { path = "lib/e2e" }
 e2e-proc = { path = "lib/e2e-proc" }
 
diff --git a/contracts/src/token/erc20/mod.rs b/contracts/src/token/erc20/mod.rs
index 19fba1e..91399f4 100644
--- a/contracts/src/token/erc20/mod.rs
+++ b/contracts/src/token/erc20/mod.rs
@@ -16,6 +16,7 @@ use stylus_sdk::{
 use crate::utils::introspection::erc165::{Erc165, IErc165};
 
 pub mod extensions;
+pub mod utils;
 
 sol! {
     /// Emitted when `value` tokens are moved from one account (`from`) to
diff --git a/contracts/src/token/erc20/utils/mod.rs b/contracts/src/token/erc20/utils/mod.rs
new file mode 100644
index 0000000..955a3f6
--- /dev/null
+++ b/contracts/src/token/erc20/utils/mod.rs
@@ -0,0 +1,4 @@
+//! Utilities for the ERC-20 standard.
+pub mod safe_erc20;
+
+pub use safe_erc20::SafeErc20;
diff --git a/contracts/src/token/erc20/utils/safe_erc20.rs b/contracts/src/token/erc20/utils/safe_erc20.rs
new file mode 100644
index 0000000..1669a69
--- /dev/null
+++ b/contracts/src/token/erc20/utils/safe_erc20.rs
@@ -0,0 +1,433 @@
+//! Wrappers around ERC-20 operations that throw on failure (when the token
+//! contract returns false). Tokens that return no value (and instead revert or
+//! throw on failure) are also supported, non-reverting calls are assumed to be
+//! successful.
+//!
+//! To use this library, you can add a `#[inherit(SafeErc20)]` attribute to
+//! your contract, which allows you to call the safe operations as
+//! `contract.safe_transfer(token_addr, ...)`, etc.
+
+use alloy_primitives::{Address, U256};
+use alloy_sol_types::{sol, SolCall};
+use stylus_sdk::{
+    call::RawCall,
+    contract::address,
+    evm::gas_left,
+    function_selector,
+    storage::TopLevelStorage,
+    stylus_proc::{public, sol_storage, SolidityError},
+    types::AddressVM,
+};
+
+use crate::token::erc20;
+
+sol! {
+    /// An operation with an ERC-20 token failed.
+    ///
+    /// * `token` - Address of the ERC-20 token.
+    #[derive(Debug)]
+    #[allow(missing_docs)]
+    error SafeErc20FailedOperation(address token);
+
+    /// Indicates a failed [`ISafeErc20::safe_decrease_allowance`] request.
+    ///
+    /// * `spender` - Address of future tokens' spender.
+    /// * `current_allowance` - Current allowance of the `spender`.
+    /// * `requested_decrease` - Requested decrease in allowance for `spender`.
+    #[derive(Debug)]
+    #[allow(missing_docs)]
+    error SafeErc20FailedDecreaseAllowance(
+        address spender,
+        uint256 current_allowance,
+        uint256 requested_decrease
+    );
+}
+
+/// A [`SafeErc20`] error.
+#[derive(SolidityError, Debug)]
+pub enum Error {
+    /// Error type from [`erc20::Erc20`] contract [`erc20::Error`].
+    Erc20(erc20::Error),
+    /// An operation with an ERC-20 token failed.
+    SafeErc20FailedOperation(SafeErc20FailedOperation),
+    /// Indicates a failed [`ISafeErc20::safe_decrease_allowance`] request.
+    SafeErc20FailedDecreaseAllowance(SafeErc20FailedDecreaseAllowance),
+}
+
+pub use token::*;
+#[allow(missing_docs)]
+mod token {
+    alloy_sol_types::sol! {
+        /// Interface of the ERC-20 token.
+        interface IErc20 {
+            function allowance(address owner, address spender) external view returns (uint256);
+            function approve(address spender, uint256 value) external returns (bool);
+            function transfer(address to, uint256 value) external returns (bool);
+            function transferFrom(address from, address to, uint256 value) external returns (bool);
+        }
+    }
+}
+sol_storage! {
+    /// State of the [`SafeErc20`] Contract.
+    pub struct SafeErc20 {}
+}
+
+/// NOTE: Implementation of [`TopLevelStorage`] to be able use `&mut self` when
+/// calling other contracts and not `&mut (impl TopLevelStorage +
+/// BorrowMut<Self>)`. Should be fixed in the future by the Stylus team.
+unsafe impl TopLevelStorage for SafeErc20 {}
+
+/// Required interface of an [`SafeErc20`] utility contract.
+pub trait ISafeErc20 {
+    /// The error type associated to this trait implementation.
+    type Error: Into<alloc::vec::Vec<u8>>;
+
+    /// Transfer `value` amount of `token` from the calling contract to `to`. If
+    /// `token` returns no value, non-reverting calls are assumed to be
+    /// successful.
+    ///
+    /// # Arguments
+    ///
+    /// * `&mut self` - Write access to the contract's state.
+    /// * `token` - Address of the ERC-20 token contract.
+    /// * `to` - Account to transfer tokens to.
+    /// * `value` - Number of tokens to transfer.
+    ///
+    /// # Errors
+    ///
+    /// If the `token` address is not a contract, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    /// If the contract fails to execute the call, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    /// If the call returns value that is not `true`, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    fn safe_transfer(
+        &mut self,
+        token: Address,
+        to: Address,
+        value: U256,
+    ) -> Result<(), Self::Error>;
+
+    /// Transfer `value` amount of `token` from `from` to `to`, spending the
+    /// approval given by `from` to the calling contract. If `token` returns
+    /// no value, non-reverting calls are assumed to be successful.
+    ///
+    /// # Arguments
+    ///
+    /// * `&mut self` - Write access to the contract's state.
+    /// * `token` - Address of the ERC-20 token contract.
+    /// * `from` - Account to transfer tokens from.
+    /// * `to` - Account to transfer tokens to.
+    /// * `value` - Number of tokens to transfer.
+    ///
+    /// # Errors
+    ///
+    /// If the `token` address is not a contract, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    /// If the contract fails to execute the call, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    /// If the call returns value that is not `true`, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    fn safe_transfer_from(
+        &mut self,
+        token: Address,
+        from: Address,
+        to: Address,
+        value: U256,
+    ) -> Result<(), Self::Error>;
+
+    /// Increase the calling contract's allowance toward `spender` by `value`.
+    /// If `token` returns no value, non-reverting calls are assumed to be
+    /// successful.
+    ///
+    /// # Arguments
+    ///
+    /// * `&mut self` - Write access to the contract's state.
+    /// * `token` - Address of the ERC-20 token contract.
+    /// * `spender` - Account that will spend the tokens.
+    /// * `value` - Value to increase current allowance for `spender`.
+    ///
+    /// # Errors
+    ///
+    /// If the `token` address is not a contract, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    /// If the contract fails to execute the call, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    /// If the call returns value that is not `true`, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    ///
+    /// # Panics
+    ///
+    /// If increased allowance exceeds `U256::MAX`.
+    fn safe_increase_allowance(
+        &mut self,
+        token: Address,
+        spender: Address,
+        value: U256,
+    ) -> Result<(), Self::Error>;
+
+    /// Decrease the calling contract's allowance toward `spender` by
+    /// `requested_decrease`. If `token` returns no value, non-reverting
+    /// calls are assumed to be successful.
+    ///
+    /// # Arguments
+    ///
+    /// * `&mut self` - Write access to the contract's state.
+    /// * `token` - Address of the ERC-20 token contract.
+    /// * `spender` - Account that will spend the tokens.
+    /// * `requested_decrease` - Value allowed to be spent by `spender`.
+    ///
+    /// # Errors
+    ///
+    /// If the `token` address is not a contract, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    /// If the current allowance is less than `requested_decrease`, then the
+    /// error [`Error::SafeErc20FailedDecreaseAllowance`] is returned.
+    /// If the contract fails to execute the call, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    /// If the call returns value that is not `true`, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    fn safe_decrease_allowance(
+        &mut self,
+        token: Address,
+        spender: Address,
+        requested_decrease: U256,
+    ) -> Result<(), Self::Error>;
+
+    /// Set the calling contract's allowance toward `spender` to `value`. If
+    /// `token` returns no value, non-reverting calls are assumed to be
+    /// successful. Meant to be used with tokens that require the approval
+    /// to be set to zero before setting it to a non-zero value, such as USDT.
+    ///
+    /// # Arguments
+    ///
+    /// * `&mut self` - Write access to the contract's state.
+    /// * `token` - Address of the ERC-20 token contract.
+    /// * `spender` - Account that will spend the tokens.
+    /// * `value` - Value allowed to be spent by `spender`.
+    ///
+    /// # Errors
+    ///
+    /// If the `token` address is not a contract, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    /// If the contract fails to execute the call, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    /// If the call returns value that is not `true`, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    fn force_approve(
+        &mut self,
+        token: Address,
+        spender: Address,
+        value: U256,
+    ) -> Result<(), Self::Error>;
+}
+
+#[public]
+impl ISafeErc20 for SafeErc20 {
+    type Error = Error;
+
+    fn safe_transfer(
+        &mut self,
+        token: Address,
+        to: Address,
+        value: U256,
+    ) -> Result<(), Self::Error> {
+        let call = IErc20::transferCall { to, value };
+
+        Self::call_optional_return(token, &call)
+    }
+
+    fn safe_transfer_from(
+        &mut self,
+        token: Address,
+        from: Address,
+        to: Address,
+        value: U256,
+    ) -> Result<(), Self::Error> {
+        let call = IErc20::transferFromCall { from, to, value };
+
+        Self::call_optional_return(token, &call)
+    }
+
+    fn safe_increase_allowance(
+        &mut self,
+        token: Address,
+        spender: Address,
+        value: U256,
+    ) -> Result<(), Self::Error> {
+        let current_allowance = Self::allowance(token, spender)?;
+        let new_allowance = current_allowance
+            .checked_add(value)
+            .expect("should not exceed `U256::MAX` for allowance");
+        self.force_approve(token, spender, new_allowance)
+    }
+
+    fn safe_decrease_allowance(
+        &mut self,
+        token: Address,
+        spender: Address,
+        requested_decrease: U256,
+    ) -> Result<(), Self::Error> {
+        let current_allowance = Self::allowance(token, spender)?;
+
+        if current_allowance < requested_decrease {
+            return Err(SafeErc20FailedDecreaseAllowance {
+                spender,
+                current_allowance,
+                requested_decrease,
+            }
+            .into());
+        }
+
+        self.force_approve(
+            token,
+            spender,
+            current_allowance - requested_decrease,
+        )
+    }
+
+    fn force_approve(
+        &mut self,
+        token: Address,
+        spender: Address,
+        value: U256,
+    ) -> Result<(), Self::Error> {
+        let approve_call = IErc20::approveCall { spender, value };
+
+        // Try performing the approval with the desired value.
+        if Self::call_optional_return(token, &approve_call).is_ok() {
+            return Ok(());
+        }
+
+        // If that fails, reset the allowance to zero, then retry the desired
+        // approval.
+        let reset_approval_call =
+            IErc20::approveCall { spender, value: U256::ZERO };
+        Self::call_optional_return(token, &reset_approval_call)?;
+        Self::call_optional_return(token, &approve_call)
+    }
+}
+
+impl SafeErc20 {
+    /// Imitates a Stylus high-level call, relaxing the requirement on the
+    /// return value: if data is returned, it must not be `false`, otherwise
+    /// calls are assumed to be successful.
+    ///
+    /// # Arguments
+    ///
+    /// * `token` - Address of the ERC-20 token contract.
+    /// * `call` - [`IErc20`] call that implements [`SolCall`] trait.
+    ///
+    /// # Errors
+    ///
+    /// If the `token` address is not a contract, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    /// If the contract fails to execute the call, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    /// If the call returns value that is not `true`, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    fn call_optional_return(
+        token: Address,
+        call: &impl SolCall,
+    ) -> Result<(), Error> {
+        if !Address::has_code(&token) {
+            return Err(SafeErc20FailedOperation { token }.into());
+        }
+
+        match RawCall::new()
+            .gas(gas_left())
+            .limit_return_data(0, 32)
+            .call(token, &call.abi_encode())
+        {
+            Ok(data) if data.is_empty() || Self::encodes_true(&data) => Ok(()),
+            _ => Err(SafeErc20FailedOperation { token }.into()),
+        }
+    }
+
+    /// Returns the remaining number of ERC-20 tokens that `spender`
+    /// will be allowed to spend on behalf of an owner.
+    ///
+    /// # Arguments
+    ///
+    /// * `token` - Address of the ERC-20 token contract.
+    /// * `spender` - Account that will spend the tokens.
+    ///
+    /// # Errors
+    ///
+    /// If the `token` address is not a contract, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    /// If the contract fails to read `spender`'s allowance, then the error
+    /// [`Error::SafeErc20FailedOperation`] is returned.
+    fn allowance(token: Address, spender: Address) -> Result<U256, Error> {
+        if !Address::has_code(&token) {
+            return Err(SafeErc20FailedOperation { token }.into());
+        }
+
+        let call = IErc20::allowanceCall { owner: address(), spender };
+        let allowance = RawCall::new()
+            .gas(gas_left())
+            .limit_return_data(0, 32)
+            .call(token, &call.abi_encode())
+            .map_err(|_| {
+                Error::SafeErc20FailedOperation(SafeErc20FailedOperation {
+                    token,
+                })
+            })?;
+
+        Ok(U256::from_be_slice(&allowance))
+    }
+
+    /// Returns true if a slice of bytes is an ABI encoded `true` value.
+    ///
+    /// # Arguments
+    ///
+    /// * `data` - Slice of bytes.
+    fn encodes_true(data: &[u8]) -> bool {
+        data.split_last().map_or(false, |(last, rest)| {
+            *last == 1 && rest.iter().all(|&byte| byte == 0)
+        })
+    }
+}
+
+#[cfg(all(test, feature = "std"))]
+mod tests {
+    use super::SafeErc20;
+    #[test]
+    fn encodes_true_empty_slice() {
+        assert_eq!(false, SafeErc20::encodes_true(&vec![]));
+    }
+
+    #[test]
+    fn encodes_false_single_byte() {
+        assert_eq!(false, SafeErc20::encodes_true(&vec![0]));
+    }
+
+    #[test]
+    fn encodes_true_single_byte() {
+        assert_eq!(true, SafeErc20::encodes_true(&vec![1]));
+    }
+
+    #[test]
+    fn encodes_false_many_bytes() {
+        assert_eq!(
+            false,
+            SafeErc20::encodes_true(&vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
+        );
+    }
+
+    #[test]
+    fn encodes_true_many_bytes() {
+        assert_eq!(
+            true,
+            SafeErc20::encodes_true(&vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])
+        );
+    }
+
+    #[test]
+    fn encodes_true_wrong_bytes() {
+        assert_eq!(
+            false,
+            SafeErc20::encodes_true(&vec![0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1])
+        );
+    }
+}
diff --git a/examples/safe-erc20/Cargo.toml b/examples/safe-erc20/Cargo.toml
new file mode 100644
index 0000000..15408bd
--- /dev/null
+++ b/examples/safe-erc20/Cargo.toml
@@ -0,0 +1,24 @@
+[package]
+name = "safe-erc20-example"
+edition.workspace = true
+license.workspace = true
+repository.workspace = true
+publish = false
+version.workspace = true
+
+[dependencies]
+openzeppelin-stylus.workspace = true
+alloy-primitives.workspace = true
+stylus-sdk.workspace = true
+
+[dev-dependencies]
+alloy.workspace = true
+eyre.workspace = true
+tokio.workspace = true
+e2e.workspace = true
+
+[features]
+e2e = []
+
+[lib]
+crate-type = ["lib", "cdylib"]
diff --git a/examples/safe-erc20/src/lib.rs b/examples/safe-erc20/src/lib.rs
new file mode 100644
index 0000000..fcc64a9
--- /dev/null
+++ b/examples/safe-erc20/src/lib.rs
@@ -0,0 +1,17 @@
+#![cfg_attr(not(test), no_main)]
+extern crate alloc;
+
+use openzeppelin_stylus::token::erc20::utils::safe_erc20::SafeErc20;
+use stylus_sdk::prelude::{entrypoint, public, sol_storage};
+
+sol_storage! {
+    #[entrypoint]
+    struct SafeErc20Example {
+        #[borrow]
+        SafeErc20 safe_erc20;
+    }
+}
+
+#[public]
+#[inherit(SafeErc20)]
+impl SafeErc20Example {}
diff --git a/lib/motsu-proc/Cargo.toml b/lib/motsu-proc/Cargo.toml
index 99cbdb6..58375a3 100644
--- a/lib/motsu-proc/Cargo.toml
+++ b/lib/motsu-proc/Cargo.toml
@@ -6,7 +6,7 @@ categories = ["development-tools::testing", "cryptography::cryptocurrencies"]
 keywords = ["arbitrum", "ethereum", "stylus", "unit-tests", "tests"]
 license.workspace = true
 repository.workspace = true
-version = "0.1.0"
+version = "0.2.0"
 
 [dependencies]
 proc-macro2.workspace = true


Test patch:
diff --git a/examples/safe-erc20/tests/abi/mod.rs b/examples/safe-erc20/tests/abi/mod.rs
new file mode 100644
index 0000000..8a44187
--- /dev/null
+++ b/examples/safe-erc20/tests/abi/mod.rs
@@ -0,0 +1,25 @@
+#![allow(dead_code)]
+use alloy::sol;
+
+sol!(
+    #[sol(rpc)]
+    contract SafeErc20 {
+        function safeTransfer(address token, address to, uint256 value) external;
+        function safeTransferFrom(address token, address from, address to, uint256 value) external;
+        function safeIncreaseAllowance(address token, address spender, uint256 value) external;
+        function safeDecreaseAllowance(address token, address spender, uint256 requestedDecrease) external;
+        function forceApprove(address token, address spender, uint256 value) external;
+
+        error SafeErc20FailedOperation(address token);
+        error SafeErc20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
+    }
+
+    contract Erc20 {
+        error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
+
+        #[derive(Debug, PartialEq)]
+        event Transfer(address indexed from, address indexed to, uint256 value);
+        #[derive(Debug, PartialEq)]
+        event Approval(address indexed owner, address indexed spender, uint256 value);
+    }
+);
diff --git a/examples/safe-erc20/tests/address_with_no_code.rs b/examples/safe-erc20/tests/address_with_no_code.rs
new file mode 100644
index 0000000..221be97
--- /dev/null
+++ b/examples/safe-erc20/tests/address_with_no_code.rs
@@ -0,0 +1,135 @@
+#![cfg(feature = "e2e")]
+
+use abi::SafeErc20;
+use alloy::primitives::{uint, U256};
+use e2e::{send, Account, ReceiptExt, Revert};
+
+mod abi;
+mod mock;
+
+#[e2e::test]
+async fn reverts_on_transfer(
+    alice: Account,
+    bob: Account,
+    has_no_code: Account,
+) -> eyre::Result<()> {
+    let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+    let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+    let bob_addr = bob.address();
+    let has_no_code_addr = has_no_code.address();
+
+    let value = uint!(1_U256);
+
+    let err =
+        send!(safe_erc20_alice.safeTransfer(has_no_code_addr, bob_addr, value))
+            .expect_err("should not be able to invoke 'transfer' on EOA");
+    assert!(err.reverted_with(SafeErc20::SafeErc20FailedOperation {
+        token: has_no_code_addr
+    }));
+
+    Ok(())
+}
+
+#[e2e::test]
+async fn reverts_on_transfer_from(
+    alice: Account,
+    bob: Account,
+    has_no_code: Account,
+) -> eyre::Result<()> {
+    let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+    let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+    let alice_addr = alice.address();
+    let bob_addr = bob.address();
+    let has_no_code_addr = has_no_code.address();
+
+    let value = uint!(1_U256);
+
+    let err = send!(safe_erc20_alice.safeTransferFrom(
+        has_no_code_addr,
+        alice_addr,
+        bob_addr,
+        value
+    ))
+    .expect_err("should not be able to invoke 'transferFrom' on EOA");
+    assert!(err.reverted_with(SafeErc20::SafeErc20FailedOperation {
+        token: has_no_code_addr
+    }));
+
+    Ok(())
+}
+
+#[e2e::test]
+async fn reverts_on_increase_allowance(
+    alice: Account,
+    bob: Account,
+    has_no_code: Account,
+) -> eyre::Result<()> {
+    let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+    let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+    let bob_addr = bob.address();
+    let has_no_code_addr = has_no_code.address();
+
+    let value = uint!(1_U256);
+
+    let err = send!(safe_erc20_alice.safeIncreaseAllowance(
+        has_no_code_addr,
+        bob_addr,
+        value
+    ))
+    .expect_err("should not be able to invoke 'increaseAllowance' on EOA");
+    assert!(err.reverted_with(SafeErc20::SafeErc20FailedOperation {
+        token: has_no_code_addr
+    }));
+
+    Ok(())
+}
+
+#[e2e::test]
+async fn reverts_on_decrease_allowance(
+    alice: Account,
+    bob: Account,
+    has_no_code: Account,
+) -> eyre::Result<()> {
+    let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+    let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+    let bob_addr = bob.address();
+    let has_no_code_addr = has_no_code.address();
+
+    let requested_decrease = uint!(1_U256);
+
+    let err = send!(safe_erc20_alice.safeDecreaseAllowance(
+        has_no_code_addr,
+        bob_addr,
+        requested_decrease
+    ))
+    .expect_err("should not be able to invoke 'decreaseAllowance' on EOA");
+    assert!(err.reverted_with(SafeErc20::SafeErc20FailedOperation {
+        token: has_no_code_addr
+    }));
+
+    Ok(())
+}
+
+#[e2e::test]
+async fn reverts_on_force_approve(
+    alice: Account,
+    bob: Account,
+    has_no_code: Account,
+) -> eyre::Result<()> {
+    let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+    let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+    let bob_addr = bob.address();
+    let has_no_code_addr = has_no_code.address();
+
+    let err = send!(safe_erc20_alice.forceApprove(
+        has_no_code_addr,
+        bob_addr,
+        U256::ZERO
+    ))
+    .expect_err("should not be able to invoke 'forceApprove' on EOA");
+    assert!(err.reverted_with(SafeErc20::SafeErc20FailedOperation {
+        token: has_no_code_addr
+    }));
+
+    Ok(())
+}
diff --git a/examples/safe-erc20/tests/erc20.rs b/examples/safe-erc20/tests/erc20.rs
new file mode 100644
index 0000000..ae53433
--- /dev/null
+++ b/examples/safe-erc20/tests/erc20.rs
@@ -0,0 +1,620 @@
+#![cfg(feature = "e2e")]
+
+use abi::{Erc20, SafeErc20};
+use alloy::primitives::uint;
+use alloy_primitives::U256;
+use e2e::{
+    receipt, send, watch, Account, EventExt, Panic, PanicCode, ReceiptExt,
+    Revert,
+};
+use mock::{erc20, erc20::ERC20Mock};
+
+mod abi;
+mod mock;
+
+mod transfers {
+    use super::*;
+
+    #[e2e::test]
+    async fn does_not_revert_on_transfer(
+        alice: Account,
+        bob: Account,
+    ) -> eyre::Result<()> {
+        let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+        let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+        let bob_addr = bob.address();
+
+        let balance = uint!(10_U256);
+        let value = uint!(1_U256);
+
+        let erc20_address = erc20::deploy(&alice.wallet).await?;
+        let erc20_alice = ERC20Mock::new(erc20_address, &alice.wallet);
+
+        let _ = watch!(erc20_alice.mint(safe_erc20_addr, balance));
+
+        let initial_safe_erc20_balance =
+            erc20_alice.balanceOf(safe_erc20_addr).call().await?._0;
+        let initial_bob_balance =
+            erc20_alice.balanceOf(bob_addr).call().await?._0;
+        assert_eq!(initial_safe_erc20_balance, balance);
+        assert_eq!(initial_bob_balance, U256::ZERO);
+
+        let receipt = receipt!(safe_erc20_alice.safeTransfer(
+            erc20_address,
+            bob_addr,
+            value
+        ))?;
+
+        assert!(receipt.emits(Erc20::Transfer {
+            from: safe_erc20_addr,
+            to: bob_addr,
+            value
+        }));
+
+        let safe_erc20_balance =
+            erc20_alice.balanceOf(safe_erc20_addr).call().await?._0;
+        let bob_balance = erc20_alice.balanceOf(bob_addr).call().await?._0;
+
+        assert_eq!(initial_safe_erc20_balance - value, safe_erc20_balance);
+        assert_eq!(initial_bob_balance + value, bob_balance);
+
+        Ok(())
+    }
+
+    #[e2e::test]
+    async fn reverts_on_transfer_with_internal_error(
+        alice: Account,
+        bob: Account,
+    ) -> eyre::Result<()> {
+        let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+        let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+        let bob_addr = bob.address();
+
+        let value = uint!(1_U256);
+
+        let erc20_address = erc20::deploy(&alice.wallet).await?;
+        let erc20_alice = ERC20Mock::new(erc20_address, &alice.wallet);
+
+        let initial_safe_erc20_balance =
+            erc20_alice.balanceOf(safe_erc20_addr).call().await?._0;
+        let initial_bob_balance =
+            erc20_alice.balanceOf(bob_addr).call().await?._0;
+
+        let err = send!(safe_erc20_alice.safeTransfer(
+            erc20_address,
+            bob_addr,
+            value
+        ))
+        .expect_err("should not transfer when insufficient balance");
+
+        assert!(err.reverted_with(SafeErc20::SafeErc20FailedOperation {
+            token: erc20_address
+        }));
+
+        let safe_erc20_balance =
+            erc20_alice.balanceOf(safe_erc20_addr).call().await?._0;
+        let bob_balance = erc20_alice.balanceOf(bob_addr).call().await?._0;
+
+        assert_eq!(initial_safe_erc20_balance, safe_erc20_balance);
+        assert_eq!(initial_bob_balance, bob_balance);
+
+        Ok(())
+    }
+
+    #[e2e::test]
+    async fn does_not_revert_on_transfer_from(
+        alice: Account,
+        bob: Account,
+    ) -> eyre::Result<()> {
+        let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+        let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+        let alice_addr = alice.address();
+        let bob_addr = bob.address();
+
+        let balance = uint!(10_U256);
+        let value = uint!(1_U256);
+
+        let erc20_address = erc20::deploy(&alice.wallet).await?;
+        let erc20_alice = ERC20Mock::new(erc20_address, &alice.wallet);
+
+        let _ = watch!(erc20_alice.mint(alice_addr, balance));
+        let _ = watch!(erc20_alice.approve(safe_erc20_addr, value));
+
+        let initial_alice_balance =
+            erc20_alice.balanceOf(alice_addr).call().await?._0;
+        let initial_bob_balance =
+            erc20_alice.balanceOf(bob_addr).call().await?._0;
+        assert_eq!(initial_alice_balance, balance);
+        assert_eq!(initial_bob_balance, U256::ZERO);
+
+        let receipt = receipt!(safe_erc20_alice.safeTransferFrom(
+            erc20_address,
+            alice_addr,
+            bob_addr,
+            value
+        ))?;
+
+        assert!(receipt.emits(Erc20::Transfer {
+            from: alice_addr,
+            to: bob_addr,
+            value
+        }));
+
+        let alice_balance = erc20_alice.balanceOf(alice_addr).call().await?._0;
+        let bob_balance = erc20_alice.balanceOf(bob_addr).call().await?._0;
+
+        assert_eq!(initial_alice_balance - value, alice_balance);
+        assert_eq!(initial_bob_balance + value, bob_balance);
+
+        Ok(())
+    }
+
+    #[e2e::test]
+    async fn reverts_on_transfer_from_internal_error(
+        alice: Account,
+        bob: Account,
+    ) -> eyre::Result<()> {
+        let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+        let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+        let alice_addr = alice.address();
+        let bob_addr = bob.address();
+
+        let value = uint!(1_U256);
+
+        let erc20_address = erc20::deploy(&alice.wallet).await?;
+        let erc20_alice = ERC20Mock::new(erc20_address, &alice.wallet);
+
+        let _ = watch!(erc20_alice.approve(safe_erc20_addr, value));
+
+        let initial_alice_balance =
+            erc20_alice.balanceOf(alice_addr).call().await?._0;
+        let initial_bob_balance =
+            erc20_alice.balanceOf(bob_addr).call().await?._0;
+
+        let err = send!(safe_erc20_alice.safeTransferFrom(
+            erc20_address,
+            alice_addr,
+            bob_addr,
+            value
+        ))
+        .expect_err("should not transfer when insufficient balance");
+
+        assert!(err.reverted_with(SafeErc20::SafeErc20FailedOperation {
+            token: erc20_address
+        }));
+
+        let alice_balance = erc20_alice.balanceOf(alice_addr).call().await?._0;
+        let bob_balance = erc20_alice.balanceOf(bob_addr).call().await?._0;
+
+        assert_eq!(initial_alice_balance, alice_balance);
+        assert_eq!(initial_bob_balance, bob_balance);
+
+        Ok(())
+    }
+}
+
+mod approvals {
+    mod with_zero_allowance {
+        use super::super::*;
+
+        #[e2e::test]
+        async fn does_not_revert_when_force_approving_a_non_zero_allowance(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20::deploy(&alice.wallet).await?;
+            let erc20_alice = ERC20Mock::new(erc20_address, &alice.wallet);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                U256::ZERO
+            ));
+
+            let value = uint!(100_U256);
+
+            let receipt = receipt!(safe_erc20_alice.forceApprove(
+                erc20_address,
+                spender_addr,
+                value
+            ))?;
+
+            assert!(receipt.emits(Erc20::Approval {
+                owner: safe_erc20_addr,
+                spender: spender_addr,
+                value,
+            }));
+
+            let spender_allowance = erc20_alice
+                .allowance(safe_erc20_addr, spender_addr)
+                .call()
+                .await?
+                ._0;
+            assert_eq!(spender_allowance, value);
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn does_not_revert_when_force_approving_a_zero_allowance(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20::deploy(&alice.wallet).await?;
+            let erc20_alice = ERC20Mock::new(erc20_address, &alice.wallet);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                U256::ZERO
+            ));
+
+            let receipt = receipt!(safe_erc20_alice.forceApprove(
+                erc20_address,
+                spender_addr,
+                U256::ZERO
+            ))?;
+
+            assert!(receipt.emits(Erc20::Approval {
+                owner: safe_erc20_addr,
+                spender: spender_addr,
+                value: U256::ZERO,
+            }));
+
+            let spender_allowance = erc20_alice
+                .allowance(safe_erc20_addr, spender_addr)
+                .call()
+                .await?
+                ._0;
+            assert_eq!(spender_allowance, U256::ZERO);
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn does_not_revert_when_increasing_the_allowance(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20::deploy(&alice.wallet).await?;
+            let erc20_alice = ERC20Mock::new(erc20_address, &alice.wallet);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                U256::ZERO
+            ));
+
+            let value = uint!(10_U256);
+
+            let receipt = receipt!(safe_erc20_alice.safeIncreaseAllowance(
+                erc20_address,
+                spender_addr,
+                value
+            ))?;
+
+            assert!(receipt.emits(Erc20::Approval {
+                owner: safe_erc20_addr,
+                spender: spender_addr,
+                value,
+            }));
+
+            let spender_allowance = erc20_alice
+                .allowance(safe_erc20_addr, spender_addr)
+                .call()
+                .await?
+                ._0;
+            assert_eq!(spender_allowance, value);
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn panics_when_increasing_the_allowance_overflow(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20::deploy(&alice.wallet).await?;
+            let erc20_alice = ERC20Mock::new(erc20_address, &alice.wallet);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                U256::MAX
+            ));
+
+            let value = uint!(1_U256);
+
+            let err = send!(safe_erc20_alice.safeIncreaseAllowance(
+                erc20_address,
+                spender_addr,
+                value
+            ))
+            .expect_err("should not exceed U256::MAX");
+
+            assert!(err.panicked_with(PanicCode::ArithmeticOverflow));
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn reverts_when_decreasing_the_allowance(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20::deploy(&alice.wallet).await?;
+            let erc20_alice = ERC20Mock::new(erc20_address, &alice.wallet);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                U256::ZERO
+            ));
+
+            let value = uint!(10_U256);
+
+            let err = send!(safe_erc20_alice.safeDecreaseAllowance(
+                erc20_address,
+                spender_addr,
+                value
+            ))
+            .expect_err("should not be able to succeed on 'decreaseAllowance'");
+            assert!(err.reverted_with(
+                SafeErc20::SafeErc20FailedDecreaseAllowance {
+                    spender: spender_addr,
+                    currentAllowance: U256::ZERO,
+                    requestedDecrease: value
+                }
+            ));
+
+            Ok(())
+        }
+    }
+
+    mod with_non_zero_allowance {
+        use super::super::*;
+
+        #[e2e::test]
+        async fn does_not_revert_when_force_approving_a_non_zero_allowance(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20::deploy(&alice.wallet).await?;
+            let erc20_alice = ERC20Mock::new(erc20_address, &alice.wallet);
+
+            let allowance = uint!(100_U256);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                allowance
+            ));
+
+            let value = uint!(20_U256);
+
+            let receipt = receipt!(safe_erc20_alice.forceApprove(
+                erc20_address,
+                spender_addr,
+                value
+            ))?;
+
+            assert!(receipt.emits(Erc20::Approval {
+                owner: safe_erc20_addr,
+                spender: spender_addr,
+                value,
+            }));
+
+            let spender_allowance = erc20_alice
+                .allowance(safe_erc20_addr, spender_addr)
+                .call()
+                .await?
+                ._0;
+            assert_eq!(spender_allowance, value);
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn does_not_revert_when_force_approving_a_zero_allowance(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20::deploy(&alice.wallet).await?;
+            let erc20_alice = ERC20Mock::new(erc20_address, &alice.wallet);
+
+            let allowance = uint!(100_U256);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                allowance
+            ));
+
+            let receipt = receipt!(safe_erc20_alice.forceApprove(
+                erc20_address,
+                spender_addr,
+                U256::ZERO
+            ))?;
+
+            assert!(receipt.emits(Erc20::Approval {
+                owner: safe_erc20_addr,
+                spender: spender_addr,
+                value: U256::ZERO,
+            }));
+
+            let spender_allowance = erc20_alice
+                .allowance(safe_erc20_addr, spender_addr)
+                .call()
+                .await?
+                ._0;
+            assert_eq!(spender_allowance, U256::ZERO);
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn does_not_revert_when_increasing_the_allowance(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20::deploy(&alice.wallet).await?;
+            let erc20_alice = ERC20Mock::new(erc20_address, &alice.wallet);
+
+            let allowance = uint!(100_U256);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                allowance
+            ));
+
+            let value = uint!(10_U256);
+
+            let receipt = receipt!(safe_erc20_alice.safeIncreaseAllowance(
+                erc20_address,
+                spender_addr,
+                value
+            ))?;
+
+            assert!(receipt.emits(Erc20::Approval {
+                owner: safe_erc20_addr,
+                spender: spender_addr,
+                value: allowance + value,
+            }));
+
+            let spender_allowance = erc20_alice
+                .allowance(safe_erc20_addr, spender_addr)
+                .call()
+                .await?
+                ._0;
+            assert_eq!(spender_allowance, allowance + value);
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn does_not_revert_when_decreasing_the_allowance_to_a_positive_value(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20::deploy(&alice.wallet).await?;
+            let erc20_alice = ERC20Mock::new(erc20_address, &alice.wallet);
+
+            let allowance = uint!(100_U256);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                allowance
+            ));
+
+            let value = uint!(50_U256);
+
+            let receipt = receipt!(safe_erc20_alice.safeDecreaseAllowance(
+                erc20_address,
+                spender_addr,
+                value
+            ))?;
+
+            assert!(receipt.emits(Erc20::Approval {
+                owner: safe_erc20_addr,
+                spender: spender_addr,
+                value: allowance - value,
+            }));
+
+            let spender_allowance = erc20_alice
+                .allowance(safe_erc20_addr, spender_addr)
+                .call()
+                .await?
+                ._0;
+            assert_eq!(spender_allowance, allowance - value);
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn reverts_when_decreasing_the_allowance_to_a_negative_value(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20::deploy(&alice.wallet).await?;
+            let erc20_alice = ERC20Mock::new(erc20_address, &alice.wallet);
+
+            let allowance = uint!(100_U256);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                allowance
+            ));
+
+            let value = uint!(200_U256);
+
+            let err = send!(safe_erc20_alice.safeDecreaseAllowance(
+                erc20_address,
+                spender_addr,
+                value
+            ))
+            .expect_err("should not be able to succeed on 'decreaseAllowance'");
+            assert!(err.reverted_with(
+                SafeErc20::SafeErc20FailedDecreaseAllowance {
+                    spender: spender_addr,
+                    currentAllowance: allowance,
+                    requestedDecrease: value
+                }
+            ));
+
+            Ok(())
+        }
+    }
+}
diff --git a/examples/safe-erc20/tests/erc20_that_always_returns_false.rs b/examples/safe-erc20/tests/erc20_that_always_returns_false.rs
new file mode 100644
index 0000000..a3fa785
--- /dev/null
+++ b/examples/safe-erc20/tests/erc20_that_always_returns_false.rs
@@ -0,0 +1,128 @@
+#![cfg(feature = "e2e")]
+
+use abi::SafeErc20;
+use alloy::primitives::U256;
+use e2e::{send, Account, ReceiptExt, Revert};
+use mock::erc20_return_false;
+
+mod abi;
+mod mock;
+
+#[e2e::test]
+async fn reverts_on_transfer(alice: Account, bob: Account) -> eyre::Result<()> {
+    let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+    let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+    let bob_addr = bob.address();
+
+    let erc20_address = erc20_return_false::deploy(&alice.wallet).await?;
+
+    let err = send!(safe_erc20_alice.safeTransfer(
+        erc20_address,
+        bob_addr,
+        U256::ZERO
+    ))
+    .expect_err("should not be able to succeed on 'transfer'");
+    assert!(err.reverted_with(SafeErc20::SafeErc20FailedOperation {
+        token: erc20_address
+    }));
+
+    Ok(())
+}
+
+#[e2e::test]
+async fn reverts_on_transfer_from(
+    alice: Account,
+    bob: Account,
+) -> eyre::Result<()> {
+    let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+    let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+    let alice_addr = alice.address();
+    let bob_addr = bob.address();
+
+    let erc20_address = erc20_return_false::deploy(&alice.wallet).await?;
+
+    let err = send!(safe_erc20_alice.safeTransferFrom(
+        erc20_address,
+        alice_addr,
+        bob_addr,
+        U256::ZERO
+    ))
+    .expect_err("should not be able to succeed on 'transferFrom'");
+    assert!(err.reverted_with(SafeErc20::SafeErc20FailedOperation {
+        token: erc20_address
+    }));
+
+    Ok(())
+}
+
+#[e2e::test]
+async fn reverts_on_increase_allowance(
+    alice: Account,
+    bob: Account,
+) -> eyre::Result<()> {
+    let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+    let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+    let bob_addr = bob.address();
+
+    let erc20_address = erc20_return_false::deploy(&alice.wallet).await?;
+
+    let err = send!(safe_erc20_alice.safeIncreaseAllowance(
+        erc20_address,
+        bob_addr,
+        U256::ZERO
+    ))
+    .expect_err("should not be able to succeed on 'increaseAllowance'");
+    assert!(err.reverted_with(SafeErc20::SafeErc20FailedOperation {
+        token: erc20_address
+    }));
+
+    Ok(())
+}
+
+#[e2e::test]
+async fn reverts_on_decrease_allowance(
+    alice: Account,
+    bob: Account,
+) -> eyre::Result<()> {
+    let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+    let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+    let bob_addr = bob.address();
+
+    let erc20_address = erc20_return_false::deploy(&alice.wallet).await?;
+
+    let err = send!(safe_erc20_alice.safeDecreaseAllowance(
+        erc20_address,
+        bob_addr,
+        U256::ZERO
+    ))
+    .expect_err("should not be able to succeed on 'decreaseAllowance'");
+    assert!(err.reverted_with(SafeErc20::SafeErc20FailedOperation {
+        token: erc20_address
+    }));
+
+    Ok(())
+}
+
+#[e2e::test]
+async fn reverts_on_force_approve(
+    alice: Account,
+    bob: Account,
+) -> eyre::Result<()> {
+    let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+    let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+    let bob_addr = bob.address();
+
+    let erc20_address = erc20_return_false::deploy(&alice.wallet).await?;
+
+    let err = send!(safe_erc20_alice.forceApprove(
+        erc20_address,
+        bob_addr,
+        U256::ZERO
+    ))
+    .expect_err("should not be able to succeed on 'forceApprove'");
+    assert!(err.reverted_with(SafeErc20::SafeErc20FailedOperation {
+        token: erc20_address
+    }));
+
+    Ok(())
+}
diff --git a/examples/safe-erc20/tests/erc20_that_does_not_return.rs b/examples/safe-erc20/tests/erc20_that_does_not_return.rs
new file mode 100644
index 0000000..0770962
--- /dev/null
+++ b/examples/safe-erc20/tests/erc20_that_does_not_return.rs
@@ -0,0 +1,628 @@
+#![cfg(feature = "e2e")]
+
+use abi::{Erc20, SafeErc20};
+use alloy::primitives::uint;
+use alloy_primitives::U256;
+use e2e::{
+    receipt, send, watch, Account, EventExt, Panic, PanicCode, ReceiptExt,
+    Revert,
+};
+use mock::{erc20_no_return, erc20_no_return::ERC20NoReturnMock};
+
+mod abi;
+mod mock;
+
+mod transfers {
+    use super::*;
+
+    #[e2e::test]
+    async fn does_not_revert_on_transfer(
+        alice: Account,
+        bob: Account,
+    ) -> eyre::Result<()> {
+        let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+        let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+        let bob_addr = bob.address();
+
+        let balance = uint!(10_U256);
+        let value = uint!(1_U256);
+
+        let erc20_address = erc20_no_return::deploy(&alice.wallet).await?;
+        let erc20_alice = ERC20NoReturnMock::new(erc20_address, &alice.wallet);
+
+        let _ = watch!(erc20_alice.mint(safe_erc20_addr, balance));
+
+        let initial_safe_erc20_balance =
+            erc20_alice.balanceOf(safe_erc20_addr).call().await?._0;
+        let initial_bob_balance =
+            erc20_alice.balanceOf(bob_addr).call().await?._0;
+        assert_eq!(initial_safe_erc20_balance, balance);
+        assert_eq!(initial_bob_balance, U256::ZERO);
+
+        let receipt = receipt!(safe_erc20_alice.safeTransfer(
+            erc20_address,
+            bob_addr,
+            value
+        ))?;
+
+        assert!(receipt.emits(Erc20::Transfer {
+            from: safe_erc20_addr,
+            to: bob_addr,
+            value,
+        }));
+
+        let safe_erc20_balance =
+            erc20_alice.balanceOf(safe_erc20_addr).call().await?._0;
+        let bob_balance = erc20_alice.balanceOf(bob_addr).call().await?._0;
+
+        assert_eq!(initial_safe_erc20_balance - value, safe_erc20_balance);
+        assert_eq!(initial_bob_balance + value, bob_balance);
+
+        Ok(())
+    }
+
+    #[e2e::test]
+    async fn reverts_on_transfer_with_internal_error(
+        alice: Account,
+        bob: Account,
+    ) -> eyre::Result<()> {
+        let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+        let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+        let bob_addr = bob.address();
+
+        let value = uint!(1_U256);
+
+        let erc20_address = erc20_no_return::deploy(&alice.wallet).await?;
+        let erc20_alice = ERC20NoReturnMock::new(erc20_address, &alice.wallet);
+
+        let initial_safe_erc20_balance =
+            erc20_alice.balanceOf(safe_erc20_addr).call().await?._0;
+        let initial_bob_balance =
+            erc20_alice.balanceOf(bob_addr).call().await?._0;
+
+        let err = send!(safe_erc20_alice.safeTransfer(
+            erc20_address,
+            bob_addr,
+            value
+        ))
+        .expect_err("should not transfer when insufficient balance");
+        assert!(err.reverted_with(SafeErc20::SafeErc20FailedOperation {
+            token: erc20_address
+        }));
+
+        let safe_erc20_balance =
+            erc20_alice.balanceOf(safe_erc20_addr).call().await?._0;
+        let bob_balance = erc20_alice.balanceOf(bob_addr).call().await?._0;
+
+        assert_eq!(initial_safe_erc20_balance, safe_erc20_balance);
+        assert_eq!(initial_bob_balance, bob_balance);
+
+        Ok(())
+    }
+
+    #[e2e::test]
+    async fn does_not_revert_on_transfer_from(
+        alice: Account,
+        bob: Account,
+    ) -> eyre::Result<()> {
+        let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+        let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+        let alice_addr = alice.address();
+        let bob_addr = bob.address();
+
+        let balance = uint!(10_U256);
+        let value = uint!(1_U256);
+
+        let erc20_address = erc20_no_return::deploy(&alice.wallet).await?;
+        let erc20_alice = ERC20NoReturnMock::new(erc20_address, &alice.wallet);
+
+        let _ = watch!(erc20_alice.mint(alice_addr, balance));
+        let _ = watch!(erc20_alice.approve(safe_erc20_addr, value));
+
+        let initial_alice_balance =
+            erc20_alice.balanceOf(alice_addr).call().await?._0;
+        let initial_bob_balance =
+            erc20_alice.balanceOf(bob_addr).call().await?._0;
+        assert_eq!(initial_alice_balance, balance);
+        assert_eq!(initial_bob_balance, U256::ZERO);
+
+        let receipt = receipt!(safe_erc20_alice.safeTransferFrom(
+            erc20_address,
+            alice_addr,
+            bob_addr,
+            value
+        ))?;
+
+        assert!(receipt.emits(Erc20::Transfer {
+            from: alice_addr,
+            to: bob_addr,
+            value,
+        }));
+
+        let alice_balance = erc20_alice.balanceOf(alice_addr).call().await?._0;
+        let bob_balance = erc20_alice.balanceOf(bob_addr).call().await?._0;
+
+        assert_eq!(initial_alice_balance - value, alice_balance);
+        assert_eq!(initial_bob_balance + value, bob_balance);
+
+        Ok(())
+    }
+
+    #[e2e::test]
+    async fn reverts_on_transfer_from_internal_error(
+        alice: Account,
+        bob: Account,
+    ) -> eyre::Result<()> {
+        let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+        let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+        let alice_addr = alice.address();
+        let bob_addr = bob.address();
+
+        let value = uint!(1_U256);
+
+        let erc20_address = erc20_no_return::deploy(&alice.wallet).await?;
+        let erc20_alice = ERC20NoReturnMock::new(erc20_address, &alice.wallet);
+
+        let _ = watch!(erc20_alice.approve(safe_erc20_addr, value));
+
+        let initial_alice_balance =
+            erc20_alice.balanceOf(alice_addr).call().await?._0;
+        let initial_bob_balance =
+            erc20_alice.balanceOf(bob_addr).call().await?._0;
+
+        let err = send!(safe_erc20_alice.safeTransferFrom(
+            erc20_address,
+            alice_addr,
+            bob_addr,
+            value
+        ))
+        .expect_err("should not transfer when insufficient balance");
+        assert!(err.reverted_with(SafeErc20::SafeErc20FailedOperation {
+            token: erc20_address
+        }));
+
+        let alice_balance = erc20_alice.balanceOf(alice_addr).call().await?._0;
+        let bob_balance = erc20_alice.balanceOf(bob_addr).call().await?._0;
+
+        assert_eq!(initial_alice_balance, alice_balance);
+        assert_eq!(initial_bob_balance, bob_balance);
+
+        Ok(())
+    }
+}
+
+mod approvals {
+    mod with_zero_allowance {
+        use super::super::*;
+
+        #[e2e::test]
+        async fn does_not_revert_when_force_approving_a_non_zero_allowance(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20_no_return::deploy(&alice.wallet).await?;
+            let erc20_alice =
+                ERC20NoReturnMock::new(erc20_address, &alice.wallet);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                U256::ZERO
+            ));
+
+            let value = uint!(100_U256);
+
+            let receipt = receipt!(safe_erc20_alice.forceApprove(
+                erc20_address,
+                spender_addr,
+                value
+            ))?;
+
+            assert!(receipt.emits(Erc20::Approval {
+                owner: safe_erc20_addr,
+                spender: spender_addr,
+                value,
+            }));
+
+            let spender_allowance = erc20_alice
+                .allowance(safe_erc20_addr, spender_addr)
+                .call()
+                .await?
+                ._0;
+            assert_eq!(spender_allowance, value);
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn does_not_revert_when_force_approving_a_zero_allowance(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20_no_return::deploy(&alice.wallet).await?;
+            let erc20_alice =
+                ERC20NoReturnMock::new(erc20_address, &alice.wallet);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                U256::ZERO
+            ));
+
+            let receipt = receipt!(safe_erc20_alice.forceApprove(
+                erc20_address,
+                spender_addr,
+                U256::ZERO
+            ))?;
+
+            assert!(receipt.emits(Erc20::Approval {
+                owner: safe_erc20_addr,
+                spender: spender_addr,
+                value: U256::ZERO,
+            }));
+
+            let spender_allowance = erc20_alice
+                .allowance(safe_erc20_addr, spender_addr)
+                .call()
+                .await?
+                ._0;
+            assert_eq!(spender_allowance, U256::ZERO);
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn does_not_revert_when_increasing_the_allowance(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20_no_return::deploy(&alice.wallet).await?;
+            let erc20_alice =
+                ERC20NoReturnMock::new(erc20_address, &alice.wallet);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                U256::ZERO
+            ));
+
+            let value = uint!(10_U256);
+
+            let receipt = receipt!(safe_erc20_alice.safeIncreaseAllowance(
+                erc20_address,
+                spender_addr,
+                value
+            ))?;
+
+            assert!(receipt.emits(Erc20::Approval {
+                owner: safe_erc20_addr,
+                spender: spender_addr,
+                value,
+            }));
+
+            let spender_allowance = erc20_alice
+                .allowance(safe_erc20_addr, spender_addr)
+                .call()
+                .await?
+                ._0;
+            assert_eq!(spender_allowance, value);
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn panics_when_increasing_the_allowance_overflow(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20_no_return::deploy(&alice.wallet).await?;
+            let erc20_alice =
+                ERC20NoReturnMock::new(erc20_address, &alice.wallet);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                U256::MAX
+            ));
+
+            let value = uint!(1_U256);
+
+            let err = send!(safe_erc20_alice.safeIncreaseAllowance(
+                erc20_address,
+                spender_addr,
+                value
+            ))
+            .expect_err("should not exceed U256::MAX");
+
+            assert!(err.panicked_with(PanicCode::ArithmeticOverflow));
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn reverts_when_decreasing_the_allowance(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20_no_return::deploy(&alice.wallet).await?;
+            let erc20_alice =
+                ERC20NoReturnMock::new(erc20_address, &alice.wallet);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                U256::ZERO
+            ));
+
+            let value = uint!(10_U256);
+
+            let err = send!(safe_erc20_alice.safeDecreaseAllowance(
+                erc20_address,
+                spender_addr,
+                value
+            ))
+            .expect_err("should not be able to succeed on 'decreaseAllowance'");
+            assert!(err.reverted_with(
+                SafeErc20::SafeErc20FailedDecreaseAllowance {
+                    spender: spender_addr,
+                    currentAllowance: U256::ZERO,
+                    requestedDecrease: value
+                }
+            ));
+
+            Ok(())
+        }
+    }
+
+    mod with_non_zero_allowance {
+        use super::super::*;
+
+        #[e2e::test]
+        async fn does_not_revert_when_force_approving_a_non_zero_allowance(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20_no_return::deploy(&alice.wallet).await?;
+            let erc20_alice =
+                ERC20NoReturnMock::new(erc20_address, &alice.wallet);
+
+            let allowance = uint!(100_U256);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                allowance
+            ));
+
+            let value = uint!(20_U256);
+
+            let receipt = receipt!(safe_erc20_alice.forceApprove(
+                erc20_address,
+                spender_addr,
+                value
+            ))?;
+
+            assert!(receipt.emits(Erc20::Approval {
+                owner: safe_erc20_addr,
+                spender: spender_addr,
+                value,
+            }));
+
+            let spender_allowance = erc20_alice
+                .allowance(safe_erc20_addr, spender_addr)
+                .call()
+                .await?
+                ._0;
+            assert_eq!(spender_allowance, value);
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn does_not_revert_when_force_approving_a_zero_allowance(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20_no_return::deploy(&alice.wallet).await?;
+            let erc20_alice =
+                ERC20NoReturnMock::new(erc20_address, &alice.wallet);
+
+            let allowance = uint!(100_U256);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                allowance
+            ));
+
+            let receipt = receipt!(safe_erc20_alice.forceApprove(
+                erc20_address,
+                spender_addr,
+                U256::ZERO
+            ))?;
+
+            assert!(receipt.emits(Erc20::Approval {
+                owner: safe_erc20_addr,
+                spender: spender_addr,
+                value: U256::ZERO,
+            }));
+
+            let spender_allowance = erc20_alice
+                .allowance(safe_erc20_addr, spender_addr)
+                .call()
+                .await?
+                ._0;
+            assert_eq!(spender_allowance, U256::ZERO);
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn does_not_revert_when_increasing_the_allowance(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20_no_return::deploy(&alice.wallet).await?;
+            let erc20_alice =
+                ERC20NoReturnMock::new(erc20_address, &alice.wallet);
+
+            let allowance = uint!(100_U256);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                allowance
+            ));
+
+            let value = uint!(10_U256);
+
+            let receipt = receipt!(safe_erc20_alice.safeIncreaseAllowance(
+                erc20_address,
+                spender_addr,
+                value
+            ))?;
+
+            assert!(receipt.emits(Erc20::Approval {
+                owner: safe_erc20_addr,
+                spender: spender_addr,
+                value: allowance + value,
+            }));
+
+            let spender_allowance = erc20_alice
+                .allowance(safe_erc20_addr, spender_addr)
+                .call()
+                .await?
+                ._0;
+            assert_eq!(spender_allowance, allowance + value);
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn does_not_revert_when_decreasing_the_allowance_to_a_positive_value(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20_no_return::deploy(&alice.wallet).await?;
+            let erc20_alice =
+                ERC20NoReturnMock::new(erc20_address, &alice.wallet);
+
+            let allowance = uint!(100_U256);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                allowance
+            ));
+
+            let value = uint!(50_U256);
+
+            let receipt = receipt!(safe_erc20_alice.safeDecreaseAllowance(
+                erc20_address,
+                spender_addr,
+                value
+            ))?;
+
+            assert!(receipt.emits(Erc20::Approval {
+                owner: safe_erc20_addr,
+                spender: spender_addr,
+                value: allowance - value,
+            }));
+
+            let spender_allowance = erc20_alice
+                .allowance(safe_erc20_addr, spender_addr)
+                .call()
+                .await?
+                ._0;
+            assert_eq!(spender_allowance, allowance - value);
+
+            Ok(())
+        }
+
+        #[e2e::test]
+        async fn reverts_when_decreasing_the_allowance_to_a_negative_value(
+            alice: Account,
+        ) -> eyre::Result<()> {
+            let safe_erc20_addr =
+                alice.as_deployer().deploy().await?.address()?;
+            let safe_erc20_alice =
+                SafeErc20::new(safe_erc20_addr, &alice.wallet);
+            let spender_addr = alice.address();
+
+            let erc20_address = erc20_no_return::deploy(&alice.wallet).await?;
+            let erc20_alice =
+                ERC20NoReturnMock::new(erc20_address, &alice.wallet);
+
+            let allowance = uint!(100_U256);
+
+            let _ = watch!(erc20_alice.regular_approve(
+                safe_erc20_addr,
+                spender_addr,
+                allowance
+            ));
+
+            let value = uint!(200_U256);
+
+            let err = send!(safe_erc20_alice.safeDecreaseAllowance(
+                erc20_address,
+                spender_addr,
+                value
+            ))
+            .expect_err("should not be able to succeed on 'decreaseAllowance'");
+            assert!(err.reverted_with(
+                SafeErc20::SafeErc20FailedDecreaseAllowance {
+                    spender: spender_addr,
+                    currentAllowance: allowance,
+                    requestedDecrease: value
+                }
+            ));
+
+            Ok(())
+        }
+    }
+}
diff --git a/examples/safe-erc20/tests/mock/erc20.rs b/examples/safe-erc20/tests/mock/erc20.rs
new file mode 100644
index 0000000..68514da
--- /dev/null
+++ b/examples/safe-erc20/tests/mock/erc20.rs
@@ -0,0 +1,48 @@
+#![allow(dead_code)]
+#![cfg(feature = "e2e")]
+use alloy::{primitives::Address, sol};
+use e2e::Wallet;
+
+sol! {
+    #[allow(missing_docs)]
+    // Built with Remix IDE; solc v0.8.21+commit.d9974bed
+    #[sol(rpc, bytecode="608060405234801562000010575f80fd5b506040518060400160405280600981526020017f45524332304d6f636b00000000000000000000000000000000000000000000008152506040518060400160405280600381526020017f4d544b000000000000000000000000000000000000000000000000000000000081525081600390816200008e91906200030d565b508060049081620000a091906200030d565b505050620003f1565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806200012557607f821691505b6020821081036200013b576200013a620000e0565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026200019f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000162565b620001ab868362000162565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f620001f5620001ef620001e984620001c3565b620001cc565b620001c3565b9050919050565b5f819050919050565b6200021083620001d5565b620002286200021f82620001fc565b8484546200016e565b825550505050565b5f90565b6200023e62000230565b6200024b81848462000205565b505050565b5b818110156200027257620002665f8262000234565b60018101905062000251565b5050565b601f821115620002c1576200028b8162000141565b620002968462000153565b81016020851015620002a6578190505b620002be620002b58562000153565b83018262000250565b50505b505050565b5f82821c905092915050565b5f620002e35f1984600802620002c6565b1980831691505092915050565b5f620002fd8383620002d2565b9150826002028217905092915050565b6200031882620000a9565b67ffffffffffffffff811115620003345762000333620000b3565b5b6200034082546200010d565b6200034d82828562000276565b5f60209050601f83116001811462000383575f84156200036e578287015190505b6200037a8582620002f0565b865550620003e9565b601f198416620003938662000141565b5f5b82811015620003bc5784890151825560018201915060208501945060208101905062000395565b86831015620003dc5784890151620003d8601f891682620002d2565b8355505b6001600288020188555050505b505050505050565b610f4580620003ff5f395ff3fe608060405234801561000f575f80fd5b50600436106100a7575f3560e01c806340c10f191161006f57806340c10f191461016557806370a08231146101815780638483acfe146101b157806395d89b41146101cd578063a9059cbb146101eb578063dd62ed3e1461021b576100a7565b806306fdde03146100ab578063095ea7b3146100c957806318160ddd146100f957806323b872dd14610117578063313ce56714610147575b5f80fd5b6100b361024b565b6040516100c09190610bbe565b60405180910390f35b6100e360048036038101906100de9190610c6f565b6102db565b6040516100f09190610cc7565b60405180910390f35b6101016102ee565b60405161010e9190610cef565b60405180910390f35b610131600480360381019061012c9190610d08565b6102f7565b60405161013e9190610cc7565b60405180910390f35b61014f61030c565b60405161015c9190610d73565b60405180910390f35b61017f600480360381019061017a9190610c6f565b610314565b005b61019b60048036038101906101969190610d8c565b610322565b6040516101a89190610cef565b60405180910390f35b6101cb60048036038101906101c69190610d08565b610333565b005b6101d5610343565b6040516101e29190610bbe565b60405180910390f35b61020560048036038101906102009190610c6f565b6103d3565b6040516102129190610cc7565b60405180910390f35b61023560048036038101906102309190610db7565b6103e6565b6040516102429190610cef565b60405180910390f35b60606003805461025a90610e22565b80601f016020809104026020016040519081016040528092919081815260200182805461028690610e22565b80156102d15780601f106102a8576101008083540402835291602001916102d1565b820191905f5260205f20905b8154815290600101906020018083116102b457829003601f168201915b5050505050905090565b5f6102e683836103f9565b905092915050565b5f600254905090565b5f61030384848461041b565b90509392505050565b5f6012905090565b61031e8282610449565b5050565b5f61032c826104c8565b9050919050565b61033e83838361050d565b505050565b60606004805461035290610e22565b80601f016020809104026020016040519081016040528092919081815260200182805461037e90610e22565b80156103c95780601f106103a0576101008083540402835291602001916103c9565b820191905f5260205f20905b8154815290600101906020018083116103ac57829003601f168201915b5050505050905090565b5f6103de838361051f565b905092915050565b5f6103f18383610541565b905092915050565b5f806104036105c3565b905061041081858561050d565b600191505092915050565b5f806104256105c3565b90506104328582856105ca565b61043d85858561065c565b60019150509392505050565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036104b9575f6040517fec442f050000000000000000000000000000000000000000000000000000000081526004016104b09190610e61565b60405180910390fd5b6104c45f838361074c565b5050565b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b61051a8383836001610965565b505050565b5f806105296105c3565b905061053681858561065c565b600191505092915050565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b5f33905090565b5f6105d584846103e6565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146106565781811015610647578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040161063e93929190610e7a565b60405180910390fd5b61065584848484035f610965565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036106cc575f6040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016106c39190610e61565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361073c575f6040517fec442f050000000000000000000000000000000000000000000000000000000081526004016107339190610e61565b60405180910390fd5b61074783838361074c565b505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361079c578060025f8282546107909190610edc565b9250508190555061086a565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905081811015610825578381836040517fe450d38c00000000000000000000000000000000000000000000000000000000815260040161081c93929190610e7a565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108b1578060025f82825403925050819055506108fb565b805f808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516109589190610cef565b60405180910390a3505050565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036109d5575f6040517fe602df050000000000000000000000000000000000000000000000000000000081526004016109cc9190610e61565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610a45575f6040517f94280d62000000000000000000000000000000000000000000000000000000008152600401610a3c9190610e61565b60405180910390fd5b8160015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508015610b2e578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610b259190610cef565b60405180910390a35b50505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610b6b578082015181840152602081019050610b50565b5f8484015250505050565b5f601f19601f8301169050919050565b5f610b9082610b34565b610b9a8185610b3e565b9350610baa818560208601610b4e565b610bb381610b76565b840191505092915050565b5f6020820190508181035f830152610bd68184610b86565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610c0b82610be2565b9050919050565b610c1b81610c01565b8114610c25575f80fd5b50565b5f81359050610c3681610c12565b92915050565b5f819050919050565b610c4e81610c3c565b8114610c58575f80fd5b50565b5f81359050610c6981610c45565b92915050565b5f8060408385031215610c8557610c84610bde565b5b5f610c9285828601610c28565b9250506020610ca385828601610c5b565b9150509250929050565b5f8115159050919050565b610cc181610cad565b82525050565b5f602082019050610cda5f830184610cb8565b92915050565b610ce981610c3c565b82525050565b5f602082019050610d025f830184610ce0565b92915050565b5f805f60608486031215610d1f57610d1e610bde565b5b5f610d2c86828701610c28565b9350506020610d3d86828701610c28565b9250506040610d4e86828701610c5b565b9150509250925092565b5f60ff82169050919050565b610d6d81610d58565b82525050565b5f602082019050610d865f830184610d64565b92915050565b5f60208284031215610da157610da0610bde565b5b5f610dae84828501610c28565b91505092915050565b5f8060408385031215610dcd57610dcc610bde565b5b5f610dda85828601610c28565b9250506020610deb85828601610c28565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680610e3957607f821691505b602082108103610e4c57610e4b610df5565b5b50919050565b610e5b81610c01565b82525050565b5f602082019050610e745f830184610e52565b92915050565b5f606082019050610e8d5f830186610e52565b610e9a6020830185610ce0565b610ea76040830184610ce0565b949350505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f610ee682610c3c565b9150610ef183610c3c565b9250828201905080821115610f0957610f08610eaf565b5b9291505056fea2646970667358221220383e898342e74543d1bfb6186eff00b4ae7a39d4ecde6190742c5e9f2a7a2e9364736f6c63430008150033")]
+    // SPDX-License-Identifier: MIT
+    contract ERC20Mock is ERC20 {
+        constructor() ERC20("ERC20Mock", "MTK") {}
+
+        function approve(address spender, uint256 value) public override returns (bool) {
+            return super.approve(spender, value);
+        }
+
+        function regular_approve(address owner, address spender, uint256 amount) public {
+            super._approve(owner, spender, amount);
+        }
+
+        function balanceOf(address account) public override view returns (uint256) {
+            return super.balanceOf(account);
+        }
+
+        function mint(address account, uint256 value) public {
+            super._mint(account, value);
+        }
+
+        function transfer(address to, uint256 amount) public override returns (bool) {
+            return super.transfer(to, amount);
+        }
+
+        function transferFrom(address from, address to, uint256 value) public override returns (bool) {
+            return super.transferFrom(from, to, value);
+        }
+
+        function allowance(address owner, address spender) public view override returns (uint256) {
+            return super.allowance(owner, spender);
+        }
+    }
+}
+
+pub async fn deploy(wallet: &Wallet) -> eyre::Result<Address> {
+    // Deploy the contract.
+    let contract = ERC20Mock::deploy(wallet).await?;
+    Ok(*contract.address())
+}
diff --git a/examples/safe-erc20/tests/mock/erc20_force_approve.rs b/examples/safe-erc20/tests/mock/erc20_force_approve.rs
new file mode 100644
index 0000000..ccf5c41
--- /dev/null
+++ b/examples/safe-erc20/tests/mock/erc20_force_approve.rs
@@ -0,0 +1,33 @@
+#![allow(dead_code)]
+#![cfg(feature = "e2e")]
+use alloy::{primitives::Address, sol};
+use e2e::Wallet;
+
+sol! {
+    #[allow(missing_docs)]
+    // Built with Remix IDE; solc v0.8.21+commit.d9974bed
+    #[sol(rpc, bytecode="608060405234801562000010575f80fd5b506040518060400160405280601581526020017f4552433230466f726365417070726f76654d6f636b00000000000000000000008152506040518060400160405280600381526020017f46414d000000000000000000000000000000000000000000000000000000000081525081600390816200008e91906200030d565b508060049081620000a091906200030d565b505050620003f1565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806200012557607f821691505b6020821081036200013b576200013a620000e0565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026200019f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000162565b620001ab868362000162565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f620001f5620001ef620001e984620001c3565b620001cc565b620001c3565b9050919050565b5f819050919050565b6200021083620001d5565b620002286200021f82620001fc565b8484546200016e565b825550505050565b5f90565b6200023e62000230565b6200024b81848462000205565b505050565b5b818110156200027257620002665f8262000234565b60018101905062000251565b5050565b601f821115620002c1576200028b8162000141565b620002968462000153565b81016020851015620002a6578190505b620002be620002b58562000153565b83018262000250565b50505b505050565b5f82821c905092915050565b5f620002e35f1984600802620002c6565b1980831691505092915050565b5f620002fd8383620002d2565b9150826002028217905092915050565b6200031882620000a9565b67ffffffffffffffff811115620003345762000333620000b3565b5b6200034082546200010d565b6200034d82828562000276565b5f60209050601f83116001811462000383575f84156200036e578287015190505b6200037a8582620002f0565b865550620003e9565b601f198416620003938662000141565b5f5b82811015620003bc5784890151825560018201915060208501945060208101905062000395565b86831015620003dc5784890151620003d8601f891682620002d2565b8355505b6001600288020188555050505b505050505050565b610f1580620003ff5f395ff3fe608060405234801561000f575f80fd5b506004361061009c575f3560e01c806370a082311161006457806370a082311461015a5780638483acfe1461018a57806395d89b41146101a6578063a9059cbb146101c4578063dd62ed3e146101f45761009c565b806306fdde03146100a0578063095ea7b3146100be57806318160ddd146100ee57806323b872dd1461010c578063313ce5671461013c575b5f80fd5b6100a8610224565b6040516100b59190610b26565b60405180910390f35b6100d860048036038101906100d39190610bd7565b6102b4565b6040516100e59190610c2f565b60405180910390f35b6100f661031c565b6040516101039190610c57565b60405180910390f35b61012660048036038101906101219190610c70565b610325565b6040516101339190610c2f565b60405180910390f35b610144610353565b6040516101519190610cdb565b60405180910390f35b610174600480360381019061016f9190610cf4565b61035b565b6040516101819190610c57565b60405180910390f35b6101a4600480360381019061019f9190610c70565b6103a0565b005b6101ae6103b0565b6040516101bb9190610b26565b60405180910390f35b6101de60048036038101906101d99190610bd7565b610440565b6040516101eb9190610c2f565b60405180910390f35b61020e60048036038101906102099190610d1f565b610462565b60405161021b9190610c57565b60405180910390f35b60606003805461023390610d8a565b80601f016020809104026020016040519081016040528092919081815260200182805461025f90610d8a565b80156102aa5780601f10610281576101008083540402835291602001916102aa565b820191905f5260205f20905b81548152906001019060200180831161028d57829003601f168201915b5050505050905090565b5f808214806102cb57505f6102c93385610462565b145b61030a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030190610e04565b60405180910390fd5b6103148383610475565b905092915050565b5f600254905090565b5f8061032f610497565b905061033c85828561049e565b610347858585610530565b60019150509392505050565b5f6012905090565b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b6103ab838383610620565b505050565b6060600480546103bf90610d8a565b80601f01602080910402602001604051908101604052809291908181526020018280546103eb90610d8a565b80156104365780601f1061040d57610100808354040283529160200191610436565b820191905f5260205f20905b81548152906001019060200180831161041957829003601f168201915b5050505050905090565b5f8061044a610497565b9050610457818585610530565b600191505092915050565b5f61046d8383610632565b905092915050565b5f8061047f610497565b905061048c818585610620565b600191505092915050565b5f33905090565b5f6104a98484610462565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461052a578181101561051b578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040161051293929190610e31565b60405180910390fd5b61052984848484035f6106b4565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036105a0575f6040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016105979190610e66565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610610575f6040517fec442f050000000000000000000000000000000000000000000000000000000081526004016106079190610e66565b60405180910390fd5b61061b838383610883565b505050565b61062d83838360016106b4565b505050565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610724575f6040517fe602df0500000000000000000000000000000000000000000000000000000000815260040161071b9190610e66565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610794575f6040517f94280d6200000000000000000000000000000000000000000000000000000000815260040161078b9190610e66565b60405180910390fd5b8160015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550801561087d578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516108749190610c57565b60405180910390a35b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036108d3578060025f8282546108c79190610eac565b925050819055506109a1565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205490508181101561095c578381836040517fe450d38c00000000000000000000000000000000000000000000000000000000815260040161095393929190610e31565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036109e8578060025f8282540392505081905550610a32565b805f808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610a8f9190610c57565b60405180910390a3505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610ad3578082015181840152602081019050610ab8565b5f8484015250505050565b5f601f19601f8301169050919050565b5f610af882610a9c565b610b028185610aa6565b9350610b12818560208601610ab6565b610b1b81610ade565b840191505092915050565b5f6020820190508181035f830152610b3e8184610aee565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610b7382610b4a565b9050919050565b610b8381610b69565b8114610b8d575f80fd5b50565b5f81359050610b9e81610b7a565b92915050565b5f819050919050565b610bb681610ba4565b8114610bc0575f80fd5b50565b5f81359050610bd181610bad565b92915050565b5f8060408385031215610bed57610bec610b46565b5b5f610bfa85828601610b90565b9250506020610c0b85828601610bc3565b9150509250929050565b5f8115159050919050565b610c2981610c15565b82525050565b5f602082019050610c425f830184610c20565b92915050565b610c5181610ba4565b82525050565b5f602082019050610c6a5f830184610c48565b92915050565b5f805f60608486031215610c8757610c86610b46565b5b5f610c9486828701610b90565b9350506020610ca586828701610b90565b9250506040610cb686828701610bc3565b9150509250925092565b5f60ff82169050919050565b610cd581610cc0565b82525050565b5f602082019050610cee5f830184610ccc565b92915050565b5f60208284031215610d0957610d08610b46565b5b5f610d1684828501610b90565b91505092915050565b5f8060408385031215610d3557610d34610b46565b5b5f610d4285828601610b90565b9250506020610d5385828601610b90565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680610da157607f821691505b602082108103610db457610db3610d5d565b5b50919050565b7f5553445420617070726f76616c206661696c75726500000000000000000000005f82015250565b5f610dee601583610aa6565b9150610df982610dba565b602082019050919050565b5f6020820190508181035f830152610e1b81610de2565b9050919050565b610e2b81610b69565b82525050565b5f606082019050610e445f830186610e22565b610e516020830185610c48565b610e5e6040830184610c48565b949350505050565b5f602082019050610e795f830184610e22565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f610eb682610ba4565b9150610ec183610ba4565b9250828201905080821115610ed957610ed8610e7f565b5b9291505056fea26469706673582212204360bd31161a5a21172e203aecf5b49d953f1b1c8a64d9d0e539c9c81467f7b064736f6c63430008150033")]
+    // SPDX-License-Identifier: MIT
+    contract ERC20ForceApproveMock is ERC20 {
+        constructor() ERC20("ERC20ForceApproveMock", "FAM") {}
+
+        function approve(address spender, uint256 amount) public virtual override returns (bool) {
+            require(amount == 0 || allowance(msg.sender, spender) == 0, "USDT approval failure");
+            return super.approve(spender, amount);
+        }
+
+        function regular_approve(address owner, address spender, uint256 amount) public {
+            super._approve(owner, spender, amount);
+        }
+
+        function allowance(address owner, address spender) public view override returns (uint256) {
+            return super.allowance(owner, spender);
+        }
+    }
+}
+
+pub async fn deploy(wallet: &Wallet) -> eyre::Result<Address> {
+    // Deploy the contract.
+    let contract = ERC20ForceApproveMock::deploy(wallet).await?;
+    Ok(*contract.address())
+}
diff --git a/examples/safe-erc20/tests/mock/erc20_no_return.rs b/examples/safe-erc20/tests/mock/erc20_no_return.rs
new file mode 100644
index 0000000..2b1189d
--- /dev/null
+++ b/examples/safe-erc20/tests/mock/erc20_no_return.rs
@@ -0,0 +1,57 @@
+#![allow(dead_code)]
+#![cfg(feature = "e2e")]
+use alloy::{primitives::Address, sol};
+use e2e::Wallet;
+
+sol! {
+    #[allow(missing_docs)]
+    // Built with Remix IDE; solc v0.8.21+commit.d9974bed
+    #[sol(rpc, bytecode="608060405234801562000010575f80fd5b506040518060400160405280601181526020017f45524332304e6f52657475726e4d6f636b0000000000000000000000000000008152506040518060400160405280600381526020017f4e524d000000000000000000000000000000000000000000000000000000000081525081600390816200008e91906200030d565b508060049081620000a091906200030d565b505050620003f1565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806200012557607f821691505b6020821081036200013b576200013a620000e0565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026200019f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000162565b620001ab868362000162565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f620001f5620001ef620001e984620001c3565b620001cc565b620001c3565b9050919050565b5f819050919050565b6200021083620001d5565b620002286200021f82620001fc565b8484546200016e565b825550505050565b5f90565b6200023e62000230565b6200024b81848462000205565b505050565b5b818110156200027257620002665f8262000234565b60018101905062000251565b5050565b601f821115620002c1576200028b8162000141565b620002968462000153565b81016020851015620002a6578190505b620002be620002b58562000153565b83018262000250565b50505b505050565b5f82821c905092915050565b5f620002e35f1984600802620002c6565b1980831691505092915050565b5f620002fd8383620002d2565b9150826002028217905092915050565b6200031882620000a9565b67ffffffffffffffff811115620003345762000333620000b3565b5b6200034082546200010d565b6200034d82828562000276565b5f60209050601f83116001811462000383575f84156200036e578287015190505b6200037a8582620002f0565b865550620003e9565b601f198416620003938662000141565b5f5b82811015620003bc5784890151825560018201915060208501945060208101905062000395565b86831015620003dc5784890151620003d8601f891682620002d2565b8355505b6001600288020188555050505b505050505050565b610f3880620003ff5f395ff3fe608060405234801561000f575f80fd5b50600436106100a7575f3560e01c806340c10f191161006f57806340c10f191461016557806370a08231146101815780638483acfe146101b157806395d89b41146101cd578063a9059cbb146101eb578063dd62ed3e1461021b576100a7565b806306fdde03146100ab578063095ea7b3146100c957806318160ddd146100f957806323b872dd14610117578063313ce56714610147575b5f80fd5b6100b361024b565b6040516100c09190610bb1565b60405180910390f35b6100e360048036038101906100de9190610c62565b6102db565b6040516100f09190610cba565b60405180910390f35b6101016102ea565b60405161010e9190610ce2565b60405180910390f35b610131600480360381019061012c9190610cfb565b6102f3565b60405161013e9190610cba565b60405180910390f35b61014f610303565b60405161015c9190610d66565b60405180910390f35b61017f600480360381019061017a9190610c62565b61030b565b005b61019b60048036038101906101969190610d7f565b610319565b6040516101a89190610ce2565b60405180910390f35b6101cb60048036038101906101c69190610cfb565b61032a565b005b6101d561033a565b6040516101e29190610bb1565b60405180910390f35b61020560048036038101906102009190610c62565b6103ca565b6040516102129190610cba565b60405180910390f35b61023560048036038101906102309190610daa565b6103d9565b6040516102429190610ce2565b60405180910390f35b60606003805461025a90610e15565b80601f016020809104026020016040519081016040528092919081815260200182805461028690610e15565b80156102d15780601f106102a8576101008083540402835291602001916102d1565b820191905f5260205f20905b8154815290600101906020018083116102b457829003601f168201915b5050505050905090565b5f6102e683836103ec565b5f80f35b5f600254905090565b5f6102ff84848461040e565b5f80f35b5f6012905090565b610315828261043c565b5050565b5f610323826104bb565b9050919050565b610335838383610500565b505050565b60606004805461034990610e15565b80601f016020809104026020016040519081016040528092919081815260200182805461037590610e15565b80156103c05780601f10610397576101008083540402835291602001916103c0565b820191905f5260205f20905b8154815290600101906020018083116103a357829003601f168201915b5050505050905090565b5f6103d58383610512565b5f80f35b5f6103e48383610534565b905092915050565b5f806103f66105b6565b9050610403818585610500565b600191505092915050565b5f806104186105b6565b90506104258582856105bd565b61043085858561064f565b60019150509392505050565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036104ac575f6040517fec442f050000000000000000000000000000000000000000000000000000000081526004016104a39190610e54565b60405180910390fd5b6104b75f838361073f565b5050565b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b61050d8383836001610958565b505050565b5f8061051c6105b6565b905061052981858561064f565b600191505092915050565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b5f33905090565b5f6105c884846103d9565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610649578181101561063a578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040161063193929190610e6d565b60405180910390fd5b61064884848484035f610958565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036106bf575f6040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016106b69190610e54565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361072f575f6040517fec442f050000000000000000000000000000000000000000000000000000000081526004016107269190610e54565b60405180910390fd5b61073a83838361073f565b505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361078f578060025f8282546107839190610ecf565b9250508190555061085d565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905081811015610818578381836040517fe450d38c00000000000000000000000000000000000000000000000000000000815260040161080f93929190610e6d565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108a4578060025f82825403925050819055506108ee565b805f808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161094b9190610ce2565b60405180910390a3505050565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036109c8575f6040517fe602df050000000000000000000000000000000000000000000000000000000081526004016109bf9190610e54565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610a38575f6040517f94280d62000000000000000000000000000000000000000000000000000000008152600401610a2f9190610e54565b60405180910390fd5b8160015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508015610b21578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610b189190610ce2565b60405180910390a35b50505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610b5e578082015181840152602081019050610b43565b5f8484015250505050565b5f601f19601f8301169050919050565b5f610b8382610b27565b610b8d8185610b31565b9350610b9d818560208601610b41565b610ba681610b69565b840191505092915050565b5f6020820190508181035f830152610bc98184610b79565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610bfe82610bd5565b9050919050565b610c0e81610bf4565b8114610c18575f80fd5b50565b5f81359050610c2981610c05565b92915050565b5f819050919050565b610c4181610c2f565b8114610c4b575f80fd5b50565b5f81359050610c5c81610c38565b92915050565b5f8060408385031215610c7857610c77610bd1565b5b5f610c8585828601610c1b565b9250506020610c9685828601610c4e565b9150509250929050565b5f8115159050919050565b610cb481610ca0565b82525050565b5f602082019050610ccd5f830184610cab565b92915050565b610cdc81610c2f565b82525050565b5f602082019050610cf55f830184610cd3565b92915050565b5f805f60608486031215610d1257610d11610bd1565b5b5f610d1f86828701610c1b565b9350506020610d3086828701610c1b565b9250506040610d4186828701610c4e565b9150509250925092565b5f60ff82169050919050565b610d6081610d4b565b82525050565b5f602082019050610d795f830184610d57565b92915050565b5f60208284031215610d9457610d93610bd1565b5b5f610da184828501610c1b565b91505092915050565b5f8060408385031215610dc057610dbf610bd1565b5b5f610dcd85828601610c1b565b9250506020610dde85828601610c1b565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680610e2c57607f821691505b602082108103610e3f57610e3e610de8565b5b50919050565b610e4e81610bf4565b82525050565b5f602082019050610e675f830184610e45565b92915050565b5f606082019050610e805f830186610e45565b610e8d6020830185610cd3565b610e9a6040830184610cd3565b949350505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f610ed982610c2f565b9150610ee483610c2f565b9250828201905080821115610efc57610efb610ea2565b5b9291505056fea2646970667358221220e66fa5f170a573315c29c69b9be493f577016746885cba3ad5a88b793a2bebac64736f6c63430008150033")]
+    // SPDX-License-Identifier: MIT
+    contract ERC20NoReturnMock is ERC20 {
+        constructor() ERC20("ERC20NoReturnMock", "NRM") {}
+
+        function transfer(address to, uint256 amount) public override returns (bool) {
+            super.transfer(to, amount);
+            assembly {
+                return(0, 0)
+            }
+        }
+
+        function transferFrom(address from, address to, uint256 amount) public override returns (bool) {
+            super.transferFrom(from, to, amount);
+            assembly {
+                return(0, 0)
+            }
+        }
+
+        function approve(address spender, uint256 amount) public override returns (bool) {
+            super.approve(spender, amount);
+            assembly {
+                return(0, 0)
+            }
+        }
+
+        function regular_approve(address owner, address spender, uint256 amount) public {
+            super._approve(owner, spender, amount);
+        }
+
+        function balanceOf(address account) public override view returns (uint256) {
+            return super.balanceOf(account);
+        }
+
+        function mint(address account, uint256 value) public {
+            super._mint(account, value);
+        }
+
+        function allowance(address owner, address spender) public view override returns (uint256) {
+            return super.allowance(owner, spender);
+        }
+    }
+}
+
+pub async fn deploy(wallet: &Wallet) -> eyre::Result<Address> {
+    // Deploy the contract.
+    let contract = ERC20NoReturnMock::deploy(wallet).await?;
+    Ok(*contract.address())
+}
diff --git a/examples/safe-erc20/tests/mock/erc20_return_false.rs b/examples/safe-erc20/tests/mock/erc20_return_false.rs
new file mode 100644
index 0000000..809c806
--- /dev/null
+++ b/examples/safe-erc20/tests/mock/erc20_return_false.rs
@@ -0,0 +1,44 @@
+#![allow(dead_code)]
+#![cfg(feature = "e2e")]
+use alloy::{primitives::Address, sol};
+use e2e::Wallet;
+
+sol! {
+    #[allow(missing_docs)]
+    // Built with Remix IDE; solc v0.8.21+commit.d9974bed
+    #[sol(rpc, bytecode="608060405234801562000010575f80fd5b506040518060400160405280601481526020017f455243323052657475726e46616c73654d6f636b0000000000000000000000008152506040518060400160405280600381526020017f52464d000000000000000000000000000000000000000000000000000000000081525081600390816200008e91906200030d565b508060049081620000a091906200030d565b505050620003f1565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806200012557607f821691505b6020821081036200013b576200013a620000e0565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026200019f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000162565b620001ab868362000162565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f620001f5620001ef620001e984620001c3565b620001cc565b620001c3565b9050919050565b5f819050919050565b6200021083620001d5565b620002286200021f82620001fc565b8484546200016e565b825550505050565b5f90565b6200023e62000230565b6200024b81848462000205565b505050565b5b818110156200027257620002665f8262000234565b60018101905062000251565b5050565b601f821115620002c1576200028b8162000141565b620002968462000153565b81016020851015620002a6578190505b620002be620002b58562000153565b83018262000250565b50505b505050565b5f82821c905092915050565b5f620002e35f1984600802620002c6565b1980831691505092915050565b5f620002fd8383620002d2565b9150826002028217905092915050565b6200031882620000a9565b67ffffffffffffffff811115620003345762000333620000b3565b5b6200034082546200010d565b6200034d82828562000276565b5f60209050601f83116001811462000383575f84156200036e578287015190505b6200037a8582620002f0565b865550620003e9565b601f198416620003938662000141565b5f5b82811015620003bc5784890151825560018201915060208501945060208101905062000395565b86831015620003dc5784890151620003d8601f891682620002d2565b8355505b6001600288020188555050505b505050505050565b610b0d80620003ff5f395ff3fe608060405234801561000f575f80fd5b506004361061009c575f3560e01c806340c10f191161006457806340c10f191461015a57806370a082311461017657806395d89b41146101a6578063a9059cbb146101c4578063dd62ed3e146101f45761009c565b806306fdde03146100a0578063095ea7b3146100be57806318160ddd146100ee57806323b872dd1461010c578063313ce5671461013c575b5f80fd5b6100a8610224565b6040516100b59190610786565b60405180910390f35b6100d860048036038101906100d39190610837565b6102b4565b6040516100e5919061088f565b60405180910390f35b6100f66102bb565b60405161010391906108b7565b60405180910390f35b610126600480360381019061012191906108d0565b6102c4565b604051610133919061088f565b60405180910390f35b6101446102cc565b604051610151919061093b565b60405180910390f35b610174600480360381019061016f9190610837565b6102d4565b005b610190600480360381019061018b9190610954565b6102e2565b60405161019d91906108b7565b60405180910390f35b6101ae6102f3565b6040516101bb9190610786565b60405180910390f35b6101de60048036038101906101d99190610837565b610383565b6040516101eb919061088f565b60405180910390f35b61020e6004803603810190610209919061097f565b61038a565b60405161021b91906108b7565b60405180910390f35b606060038054610233906109ea565b80601f016020809104026020016040519081016040528092919081815260200182805461025f906109ea565b80156102aa5780601f10610281576101008083540402835291602001916102aa565b820191905f5260205f20905b81548152906001019060200180831161028d57829003601f168201915b5050505050905090565b5f92915050565b5f600254905090565b5f9392505050565b5f6012905090565b6102de828261039d565b5050565b5f6102ec8261041c565b9050919050565b606060048054610302906109ea565b80601f016020809104026020016040519081016040528092919081815260200182805461032e906109ea565b80156103795780601f1061035057610100808354040283529160200191610379565b820191905f5260205f20905b81548152906001019060200180831161035c57829003601f168201915b5050505050905090565b5f92915050565b5f6103958383610461565b905092915050565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361040d575f6040517fec442f050000000000000000000000000000000000000000000000000000000081526004016104049190610a29565b60405180910390fd5b6104185f83836104e3565b5050565b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610533578060025f8282546105279190610a6f565b92505081905550610601565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050818110156105bc578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016105b393929190610aa2565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610648578060025f8282540392505081905550610692565b805f808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516106ef91906108b7565b60405180910390a3505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610733578082015181840152602081019050610718565b5f8484015250505050565b5f601f19601f8301169050919050565b5f610758826106fc565b6107628185610706565b9350610772818560208601610716565b61077b8161073e565b840191505092915050565b5f6020820190508181035f83015261079e818461074e565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6107d3826107aa565b9050919050565b6107e3816107c9565b81146107ed575f80fd5b50565b5f813590506107fe816107da565b92915050565b5f819050919050565b61081681610804565b8114610820575f80fd5b50565b5f813590506108318161080d565b92915050565b5f806040838503121561084d5761084c6107a6565b5b5f61085a858286016107f0565b925050602061086b85828601610823565b9150509250929050565b5f8115159050919050565b61088981610875565b82525050565b5f6020820190506108a25f830184610880565b92915050565b6108b181610804565b82525050565b5f6020820190506108ca5f8301846108a8565b92915050565b5f805f606084860312156108e7576108e66107a6565b5b5f6108f4868287016107f0565b9350506020610905868287016107f0565b925050604061091686828701610823565b9150509250925092565b5f60ff82169050919050565b61093581610920565b82525050565b5f60208201905061094e5f83018461092c565b92915050565b5f60208284031215610969576109686107a6565b5b5f610976848285016107f0565b91505092915050565b5f8060408385031215610995576109946107a6565b5b5f6109a2858286016107f0565b92505060206109b3858286016107f0565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680610a0157607f821691505b602082108103610a1457610a136109bd565b5b50919050565b610a23816107c9565b82525050565b5f602082019050610a3c5f830184610a1a565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f610a7982610804565b9150610a8483610804565b9250828201905080821115610a9c57610a9b610a42565b5b92915050565b5f606082019050610ab55f830186610a1a565b610ac260208301856108a8565b610acf60408301846108a8565b94935050505056fea26469706673582212204aac6dd6254b82f37f30add0ed2937474eced0bafc505b611f66b99ebe39999e64736f6c63430008150033")]
+    // SPDX-License-Identifier: MIT
+    contract ERC20ReturnFalseMock is ERC20 {
+        constructor() ERC20("ERC20ReturnFalseMock", "RFM") {}
+
+        function approve(address, uint256) public override returns (bool) {
+            return false;
+        }
+
+        function transfer(address, uint256) public override returns (bool) {
+            return false;
+        }
+
+        function transferFrom(address, address, uint256) public override returns (bool) {
+            return false;
+        }
+
+        function balanceOf(address account) public override view returns (uint256) {
+            return super.balanceOf(account);
+        }
+
+        function mint(address account, uint256 value) public {
+            super._mint(account, value);
+        }
+
+        function allowance(address owner, address spender) public view override returns (uint256) {
+            return super.allowance(owner, spender);
+        }
+    }
+}
+
+pub async fn deploy(wallet: &Wallet) -> eyre::Result<Address> {
+    // Deploy the contract.
+    let contract = ERC20ReturnFalseMock::deploy(wallet).await?;
+    Ok(*contract.address())
+}
diff --git a/examples/safe-erc20/tests/mock/mod.rs b/examples/safe-erc20/tests/mock/mod.rs
new file mode 100644
index 0000000..c8c60bd
--- /dev/null
+++ b/examples/safe-erc20/tests/mock/mod.rs
@@ -0,0 +1,4 @@
+pub mod erc20;
+pub mod erc20_force_approve;
+pub mod erc20_no_return;
+pub mod erc20_return_false;
diff --git a/examples/safe-erc20/tests/usdt_approval_behavior.rs b/examples/safe-erc20/tests/usdt_approval_behavior.rs
new file mode 100644
index 0000000..9530a3c
--- /dev/null
+++ b/examples/safe-erc20/tests/usdt_approval_behavior.rs
@@ -0,0 +1,138 @@
+#![cfg(feature = "e2e")]
+
+use abi::{Erc20, SafeErc20};
+use alloy::primitives::uint;
+use e2e::{receipt, watch, Account, EventExt, ReceiptExt};
+use mock::{erc20_force_approve, erc20_force_approve::ERC20ForceApproveMock};
+
+mod abi;
+mod mock;
+
+#[e2e::test]
+async fn safe_increase_allowance_works(
+    alice: Account,
+    bob: Account,
+) -> eyre::Result<()> {
+    let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+    let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+    let bob_addr = bob.address();
+
+    let erc20_address = erc20_force_approve::deploy(&alice.wallet).await?;
+    let erc20_alice = ERC20ForceApproveMock::new(erc20_address, &alice.wallet);
+
+    let init_approval = uint!(100_U256);
+    let value = uint!(10_U256);
+
+    let _ = watch!(erc20_alice.regular_approve(
+        safe_erc20_addr,
+        bob_addr,
+        init_approval
+    ));
+
+    let initial_bob_allowance =
+        erc20_alice.allowance(safe_erc20_addr, bob_addr).call().await?._0;
+    assert_eq!(initial_bob_allowance, init_approval);
+
+    let receipt = receipt!(safe_erc20_alice.safeIncreaseAllowance(
+        erc20_address,
+        bob_addr,
+        value
+    ))?;
+
+    assert!(receipt.emits(Erc20::Approval {
+        owner: safe_erc20_addr,
+        spender: bob_addr,
+        value: init_approval + value,
+    }));
+
+    let bob_allowance =
+        erc20_alice.allowance(safe_erc20_addr, bob_addr).call().await?._0;
+    assert_eq!(bob_allowance, init_approval + value);
+
+    Ok(())
+}
+
+#[e2e::test]
+async fn safe_decrease_allowance_works(
+    alice: Account,
+    bob: Account,
+) -> eyre::Result<()> {
+    let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+    let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+    let bob_addr = bob.address();
+
+    let erc20_address = erc20_force_approve::deploy(&alice.wallet).await?;
+    let erc20_alice = ERC20ForceApproveMock::new(erc20_address, &alice.wallet);
+
+    let init_approval = uint!(100_U256);
+    let value = uint!(10_U256);
+
+    let _ = watch!(erc20_alice.regular_approve(
+        safe_erc20_addr,
+        bob_addr,
+        init_approval
+    ));
+
+    let initial_bob_allowance =
+        erc20_alice.allowance(safe_erc20_addr, bob_addr).call().await?._0;
+    assert_eq!(initial_bob_allowance, init_approval);
+
+    let receipt = receipt!(safe_erc20_alice.safeDecreaseAllowance(
+        erc20_address,
+        bob_addr,
+        value
+    ))?;
+
+    assert!(receipt.emits(Erc20::Approval {
+        owner: safe_erc20_addr,
+        spender: bob_addr,
+        value: init_approval - value,
+    }));
+
+    let bob_allowance =
+        erc20_alice.allowance(safe_erc20_addr, bob_addr).call().await?._0;
+    assert_eq!(bob_allowance, init_approval - value);
+
+    Ok(())
+}
+
+#[e2e::test]
+async fn force_approve_works(alice: Account, bob: Account) -> eyre::Result<()> {
+    let safe_erc20_addr = alice.as_deployer().deploy().await?.address()?;
+    let safe_erc20_alice = SafeErc20::new(safe_erc20_addr, &alice.wallet);
+    let bob_addr = bob.address();
+
+    let erc20_address = erc20_force_approve::deploy(&alice.wallet).await?;
+    let erc20_alice = ERC20ForceApproveMock::new(erc20_address, &alice.wallet);
+
+    let init_approval = uint!(100_U256);
+    let updated_approval = uint!(10_U256);
+
+    let _ = watch!(erc20_alice.regular_approve(
+        safe_erc20_addr,
+        bob_addr,
+        init_approval
+    ));
+
+    let initial_bob_allowance =
+        erc20_alice.allowance(safe_erc20_addr, bob_addr).call().await?._0;
+    assert_eq!(initial_bob_allowance, init_approval);
+
+    let receipt = receipt!(safe_erc20_alice.forceApprove(
+        erc20_address,
+        bob_addr,
+        updated_approval
+    ))?;
+
+    assert!(receipt.emits(Erc20::Approval {
+        owner: safe_erc20_addr,
+        spender: bob_addr,
+        value: updated_approval,
+    }));
+
+    let bob_allowance =
+        erc20_alice.allowance(safe_erc20_addr, bob_addr).call().await?._0;
+    assert_eq!(bob_allowance, updated_approval);
+
+    Ok(())
+}