diff --git a/CHANGELOG.md b/CHANGELOG.md index 338b0a42c..aef1fa142 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed (Breaking) +- Remove implementation of `Deref` for `Erc1155Supply`, `Deref` for `Erc721Consecutive`, and `Deref` for `Ownable2Step`. #724 + ## [v0.2.0] - 2025-06-20 > **Heads-up:** this is the production release after four pre-releases diff --git a/contracts/src/access/ownable_two_step.rs b/contracts/src/access/ownable_two_step.rs index 4c1dabed4..9e5c0bf29 100644 --- a/contracts/src/access/ownable_two_step.rs +++ b/contracts/src/access/ownable_two_step.rs @@ -17,7 +17,6 @@ //! available. use alloc::{vec, vec::Vec}; -use core::ops::{Deref, DerefMut}; use alloy_primitives::{Address, FixedBytes}; use openzeppelin_stylus_proc::interface_id; @@ -58,20 +57,6 @@ pub struct Ownable2Step { pub(crate) pending_owner: StorageAddress, } -impl Deref for Ownable2Step { - type Target = Ownable; - - fn deref(&self) -> &Self::Target { - &self.ownable - } -} - -impl DerefMut for Ownable2Step { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.ownable - } -} - /// Interface for an [`Ownable2Step`] contract. #[interface_id] pub trait IOwnable2Step { diff --git a/contracts/src/token/erc1155/extensions/supply.rs b/contracts/src/token/erc1155/extensions/supply.rs index f982b1293..cf91247ff 100644 --- a/contracts/src/token/erc1155/extensions/supply.rs +++ b/contracts/src/token/erc1155/extensions/supply.rs @@ -12,7 +12,6 @@ //! deployed contract. use alloc::{vec, vec::Vec}; -use core::ops::{Deref, DerefMut}; use alloy_primitives::{Address, FixedBytes, U256}; use openzeppelin_stylus_proc::interface_id; @@ -42,20 +41,6 @@ pub struct Erc1155Supply { pub(crate) total_supply_all: StorageU256, } -impl Deref for Erc1155Supply { - type Target = Erc1155; - - fn deref(&self) -> &Self::Target { - &self.erc1155 - } -} - -impl DerefMut for Erc1155Supply { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.erc1155 - } -} - /// Required interface of a [`Erc1155Supply`] contract. #[interface_id] pub trait IErc1155Supply: IErc165 { diff --git a/contracts/src/token/erc721/extensions/consecutive.rs b/contracts/src/token/erc721/extensions/consecutive.rs index 8dca41e08..d4887eb83 100644 --- a/contracts/src/token/erc721/extensions/consecutive.rs +++ b/contracts/src/token/erc721/extensions/consecutive.rs @@ -24,7 +24,6 @@ //! [ERC]: https://eips.ethereum.org/EIPS/eip-2309 use alloc::{vec, vec::Vec}; -use core::ops::{Deref, DerefMut}; use alloy_primitives::{aliases::U96, uint, Address, FixedBytes, U256}; use stylus_sdk::{abi::Bytes, call::MethodError, evm, msg, prelude::*}; @@ -198,20 +197,6 @@ pub struct Erc721Consecutive { pub max_batch_size: StorageU96, } -impl Deref for Erc721Consecutive { - type Target = Erc721; - - fn deref(&self) -> &Self::Target { - &self.erc721 - } -} - -impl DerefMut for Erc721Consecutive { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.erc721 - } -} - /// NOTE: Implementation of [`TopLevelStorage`] to be able use `&mut self` when /// calling other contracts and not `&mut (impl TopLevelStorage + /// BorrowMut)`. Should be fixed in the future by the Stylus team. diff --git a/examples/ownable-two-step/src/lib.rs b/examples/ownable-two-step/src/lib.rs index 338baceff..e4b627da9 100644 --- a/examples/ownable-two-step/src/lib.rs +++ b/examples/ownable-two-step/src/lib.rs @@ -86,7 +86,7 @@ impl IErc20 for Ownable2StepExample { to: Address, value: U256, ) -> Result { - self.ownable.only_owner()?; + self.ownable.ownable.only_owner()?; Ok(self.erc20.transfer(to, value)?) }