From a694a933e511045e01606552545528a37061cb07 Mon Sep 17 00:00:00 2001 From: SarveshLimaye Date: Mon, 9 Dec 2024 21:26:39 +0530 Subject: [PATCH 1/9] feat:replace call::new_in to call::new --- contracts/src/finance/vesting_wallet.rs | 2 +- contracts/src/token/erc1155/mod.rs | 4 ++-- contracts/src/token/erc20/extensions/permit.rs | 2 +- contracts/src/token/erc721/mod.rs | 4 ++-- contracts/src/utils/cryptography/ecdsa.rs | 7 ++----- examples/ecdsa/src/lib.rs | 2 +- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/contracts/src/finance/vesting_wallet.rs b/contracts/src/finance/vesting_wallet.rs index 3870fba2d..01c01d1fd 100644 --- a/contracts/src/finance/vesting_wallet.rs +++ b/contracts/src/finance/vesting_wallet.rs @@ -420,7 +420,7 @@ impl IVestingWallet for VestingWallet { let owner = self.ownable.owner(); - call(Call::new_in(self).value(amount), owner, &[])?; + call(Call::new().value(amount), owner, &[])?; evm::log(EtherReleased { amount }); diff --git a/contracts/src/token/erc1155/mod.rs b/contracts/src/token/erc1155/mod.rs index 34b28433a..2ec5ab122 100644 --- a/contracts/src/token/erc1155/mod.rs +++ b/contracts/src/token/erc1155/mod.rs @@ -786,7 +786,7 @@ impl Erc1155 { /// interface id or returned with error, then the error /// [`Error::InvalidReceiver`] is returned. fn _check_on_erc1155_received( - &mut self, + &self, operator: Address, from: Address, to: Address, @@ -798,7 +798,7 @@ impl Erc1155 { } let receiver = IERC1155Receiver::new(to); - let call = Call::new_in(self); + let call = Call::new(); let result = match details.transfer { Transfer::Single { id, value } => receiver .on_erc_1155_received(call, operator, from, id, value, data), diff --git a/contracts/src/token/erc20/extensions/permit.rs b/contracts/src/token/erc20/extensions/permit.rs index 64af6492a..e45b241b9 100644 --- a/contracts/src/token/erc20/extensions/permit.rs +++ b/contracts/src/token/erc20/extensions/permit.rs @@ -174,7 +174,7 @@ impl Erc20Permit { let hash: B256 = self.eip712.hash_typed_data_v4(struct_hash); - let signer: Address = ecdsa::recover(self, hash, v, r, s)?; + let signer: Address = ecdsa::recover(hash, v, r, s)?; if signer != owner { return Err(ERC2612InvalidSigner { signer, owner }.into()); diff --git a/contracts/src/token/erc721/mod.rs b/contracts/src/token/erc721/mod.rs index 9f2ce71ac..4980aa330 100644 --- a/contracts/src/token/erc721/mod.rs +++ b/contracts/src/token/erc721/mod.rs @@ -1108,7 +1108,7 @@ impl Erc721 { /// interface id or returned with error, then the error /// [`Error::InvalidReceiver`] is returned. pub fn _check_on_erc721_received( - &mut self, + &self, operator: Address, from: Address, to: Address, @@ -1122,7 +1122,7 @@ impl Erc721 { } let receiver = IERC721Receiver::new(to); - let call = Call::new_in(self); + let call = Call::new(); let result = receiver.on_erc_721_received( call, operator, diff --git a/contracts/src/utils/cryptography/ecdsa.rs b/contracts/src/utils/cryptography/ecdsa.rs index eeffca3e8..36e99b764 100644 --- a/contracts/src/utils/cryptography/ecdsa.rs +++ b/contracts/src/utils/cryptography/ecdsa.rs @@ -8,7 +8,6 @@ use alloy_primitives::{address, uint, Address, B256, U256}; use alloy_sol_types::{sol, SolType}; use stylus_sdk::{ call::{self, Call, MethodError}, - storage::TopLevelStorage, stylus_proc::SolidityError, }; @@ -88,7 +87,6 @@ sol! { /// /// * If the `ecrecover` precompile fails to execute. pub fn recover( - storage: &mut impl TopLevelStorage, hash: B256, v: u8, r: B256, @@ -96,7 +94,7 @@ pub fn recover( ) -> Result { check_if_malleable(&s)?; // If the signature is valid (and not malleable), return the signer address. - _recover(storage, hash, v, r, s) + _recover(hash, v, r, s) } /// Calls `ecrecover` EVM precompile. @@ -123,7 +121,6 @@ pub fn recover( /// /// * If the `ecrecover` precompile fails to execute. fn _recover( - storage: &mut impl TopLevelStorage, hash: B256, v: u8, r: B256, @@ -140,7 +137,7 @@ fn _recover( } let recovered = - call::static_call(Call::new_in(storage), ECRECOVER_ADDR, &calldata) + call::static_call(Call::new(), ECRECOVER_ADDR, &calldata) .expect("should call `ecrecover` precompile"); let recovered = Address::from_slice(&recovered[12..]); diff --git a/examples/ecdsa/src/lib.rs b/examples/ecdsa/src/lib.rs index de6bf0576..6dd9a527e 100644 --- a/examples/ecdsa/src/lib.rs +++ b/examples/ecdsa/src/lib.rs @@ -21,7 +21,7 @@ impl ECDSAExample { r: B256, s: B256, ) -> Result> { - let signer = ecdsa::recover(self, hash, v, r, s)?; + let signer = ecdsa::recover(hash, v, r, s)?; Ok(signer) } } From d8c6c2d1fe5af07662575dbffc0ca2ab4c0cfbef Mon Sep 17 00:00:00 2001 From: SarveshLimaye Date: Tue, 10 Dec 2024 10:59:32 +0530 Subject: [PATCH 2/9] feat:remove all occurence of toplevelstorage --- CHANGELOG.md | 3 ++- contracts/src/finance/vesting_wallet.rs | 6 ------ contracts/src/token/erc1155/mod.rs | 6 ------ contracts/src/token/erc20/extensions/permit.rs | 6 ------ contracts/src/token/erc20/utils/safe_erc20.rs | 6 ------ contracts/src/token/erc721/extensions/consecutive.rs | 3 --- contracts/src/token/erc721/mod.rs | 5 ----- 7 files changed, 2 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3a3e318f..418bd83b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Implement `MethodError` for `safe_erc20::Error`. #402 - Use `function_selector!` to calculate transfer type selector in `Erc1155`. #417 -- Update internal functions of `Erc721` and `Erc721Consecutive` accept reference to `Bytes`. #437 +- Update internal functions of `Erc721` and `Erc721Consecutive` accept reference to `Bytes`. #437 +- Replace all `Call:new_in` to `Call:new` to stop supporting reentrancy. #440 ### Fixed diff --git a/contracts/src/finance/vesting_wallet.rs b/contracts/src/finance/vesting_wallet.rs index 01c01d1fd..1b83d1748 100644 --- a/contracts/src/finance/vesting_wallet.rs +++ b/contracts/src/finance/vesting_wallet.rs @@ -32,7 +32,6 @@ use stylus_sdk::{ block, call::{self, call, Call}, contract, evm, function_selector, - storage::TopLevelStorage, stylus_proc::{public, sol_storage, SolidityError}, }; @@ -112,11 +111,6 @@ sol_storage! { } } -/// 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. -unsafe impl TopLevelStorage for VestingWallet {} - /// Required interface of a [`VestingWallet`] compliant contract. #[interface_id] pub trait IVestingWallet { diff --git a/contracts/src/token/erc1155/mod.rs b/contracts/src/token/erc1155/mod.rs index 2ec5ab122..1f82dbcc7 100644 --- a/contracts/src/token/erc1155/mod.rs +++ b/contracts/src/token/erc1155/mod.rs @@ -9,7 +9,6 @@ use stylus_sdk::{ call::{self, Call, MethodError}, evm, function_selector, msg, prelude::{public, sol_storage, AddressVM, SolidityError}, - storage::TopLevelStorage, }; use crate::utils::{ @@ -189,11 +188,6 @@ sol_storage! { } } -/// 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. -unsafe impl TopLevelStorage for Erc1155 {} - /// Required interface of an [`Erc1155`] compliant contract. #[interface_id] pub trait IErc1155 { diff --git a/contracts/src/token/erc20/extensions/permit.rs b/contracts/src/token/erc20/extensions/permit.rs index e45b241b9..49e997284 100644 --- a/contracts/src/token/erc20/extensions/permit.rs +++ b/contracts/src/token/erc20/extensions/permit.rs @@ -17,7 +17,6 @@ use alloy_sol_types::{sol, SolType}; use stylus_sdk::{ block, prelude::StorageType, - storage::TopLevelStorage, stylus_proc::{public, sol_storage, SolidityError}, }; @@ -79,11 +78,6 @@ sol_storage! { } } -/// 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. -unsafe impl TopLevelStorage for Erc20Permit {} - #[public] impl Erc20Permit { /// Returns the current nonce for `owner`. diff --git a/contracts/src/token/erc20/utils/safe_erc20.rs b/contracts/src/token/erc20/utils/safe_erc20.rs index d64f18661..abf2ec084 100644 --- a/contracts/src/token/erc20/utils/safe_erc20.rs +++ b/contracts/src/token/erc20/utils/safe_erc20.rs @@ -16,7 +16,6 @@ use stylus_sdk::{ contract::address, evm::gas_left, function_selector, - storage::TopLevelStorage, stylus_proc::{public, sol_storage, SolidityError}, types::AddressVM, }; @@ -80,11 +79,6 @@ sol_storage! { pub struct SafeErc20 {} } -/// 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. -unsafe impl TopLevelStorage for SafeErc20 {} - /// Required interface of a [`SafeErc20`] utility contract. pub trait ISafeErc20 { /// The error type associated to this trait implementation. diff --git a/contracts/src/token/erc721/extensions/consecutive.rs b/contracts/src/token/erc721/extensions/consecutive.rs index e457d0de2..19cea546c 100644 --- a/contracts/src/token/erc721/extensions/consecutive.rs +++ b/contracts/src/token/erc721/extensions/consecutive.rs @@ -31,7 +31,6 @@ use alloy_sol_types::sol; use stylus_sdk::{ abi::Bytes, evm, msg, - prelude::TopLevelStorage, stylus_proc::{public, sol_storage, SolidityError}, }; @@ -134,8 +133,6 @@ pub enum Error { ForbiddenBatchBurn(ERC721ForbiddenBatchBurn), } -unsafe impl TopLevelStorage for Erc721Consecutive {} - // ************** ERC-721 External ************** #[public] diff --git a/contracts/src/token/erc721/mod.rs b/contracts/src/token/erc721/mod.rs index 4980aa330..0a645c7dd 100644 --- a/contracts/src/token/erc721/mod.rs +++ b/contracts/src/token/erc721/mod.rs @@ -200,11 +200,6 @@ sol_storage! { } } -/// 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. -unsafe impl TopLevelStorage for Erc721 {} - /// Required interface of an [`Erc721`] compliant contract. #[interface_id] pub trait IErc721 { From 9288eebc0e0b58e3820fe6d204751a2254aae8e0 Mon Sep 17 00:00:00 2001 From: Nenad Date: Tue, 10 Dec 2024 08:02:52 +0100 Subject: [PATCH 3/9] docs: reword Bytes-related CHANGELOG entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 418bd83b2..167dacacb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Implement `MethodError` for `safe_erc20::Error`. #402 - Use `function_selector!` to calculate transfer type selector in `Erc1155`. #417 -- Update internal functions of `Erc721` and `Erc721Consecutive` accept reference to `Bytes`. #437 +- Update internal functions of `Erc721` and `Erc721Consecutive` to accept a reference to `Bytes`. #437 - Replace all `Call:new_in` to `Call:new` to stop supporting reentrancy. #440 ### Fixed From c18c1750ed61308ca240454880bcb53ced769370 Mon Sep 17 00:00:00 2001 From: SarveshLimaye Date: Tue, 10 Dec 2024 19:54:49 +0530 Subject: [PATCH 4/9] update docs --- CHANGELOG.md | 3 +++ contracts/src/token/erc1155/mod.rs | 2 +- contracts/src/token/erc721/mod.rs | 2 +- contracts/src/utils/cryptography/ecdsa.rs | 2 -- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 167dacacb..ace22415c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Implement `MethodError` for `safe_erc20::Error`. #402 - Use `function_selector!` to calculate transfer type selector in `Erc1155`. #417 + +### Changed (Breaking) + - Update internal functions of `Erc721` and `Erc721Consecutive` to accept a reference to `Bytes`. #437 - Replace all `Call:new_in` to `Call:new` to stop supporting reentrancy. #440 diff --git a/contracts/src/token/erc1155/mod.rs b/contracts/src/token/erc1155/mod.rs index 1f82dbcc7..15624ae8c 100644 --- a/contracts/src/token/erc1155/mod.rs +++ b/contracts/src/token/erc1155/mod.rs @@ -761,7 +761,7 @@ impl Erc1155 { /// /// # Arguments /// - /// * `&mut self` - Write access to the contract's state. + /// * `&self` - Read access to the contract's state. /// * `operator` - Generally the address that initiated the token transfer /// (e.g. `msg::sender()`). /// * `from` - Account of the sender. diff --git a/contracts/src/token/erc721/mod.rs b/contracts/src/token/erc721/mod.rs index 0a645c7dd..1fc97832c 100644 --- a/contracts/src/token/erc721/mod.rs +++ b/contracts/src/token/erc721/mod.rs @@ -1089,7 +1089,7 @@ impl Erc721 { /// /// # Arguments /// - /// * `&mut self` - Write access to the contract's state. + /// * `&self` - Read access to the contract's state. /// * `operator` - Account to add to the set of authorized operators. /// * `from` - Account of the sender. /// * `to` - Account of the recipient. diff --git a/contracts/src/utils/cryptography/ecdsa.rs b/contracts/src/utils/cryptography/ecdsa.rs index 36e99b764..b9012aaa3 100644 --- a/contracts/src/utils/cryptography/ecdsa.rs +++ b/contracts/src/utils/cryptography/ecdsa.rs @@ -70,7 +70,6 @@ sol! { /// /// # Arguments /// -/// * `storage` - Write access to storage. /// * `hash` - Hash of the message. /// * `v` - `v` value from the signature. /// * `r` - `r` value from the signature. @@ -104,7 +103,6 @@ pub fn recover( /// /// # Arguments /// -/// * `storage` - Write access to storage. /// * `hash` - Hash of the message. /// * `v` - `v` value from the signature. /// * `r` - `r` value from the signature. From cfa1b37f133ddeeaba8560c575cad6a3d1380c63 Mon Sep 17 00:00:00 2001 From: Nenad Date: Tue, 10 Dec 2024 20:21:00 +0100 Subject: [PATCH 5/9] chore: list all changes in CHANGELOG --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70f76fdfa..ff2dfd514 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed (Breaking) - Update internal functions of `Erc721` and `Erc721Consecutive` to accept a reference to `Bytes`. #437 -- Replace all `Call:new_in` to `Call:new` to stop supporting reentrancy. #440 +- Stop supporting reentrancy, and borrow `self` immutably in `IErc721::_check_on_erc721_received` and `IErc1155::_check_on_erc1155_received`. #440 +- Remove `storage: &mut impl TopLevelStorage` parameter from `ecdsa::recover`. #440 +- Remove `TopLevelStorage` implementation from `VestingWallet`, `Erc1155`, `Erc20Permit`, `SafeErc20`, `Erc721Consecutive`, and `Erc721`. #440 ### Fixed From 848798ffbec13af9f846175e898f173cf3c15552 Mon Sep 17 00:00:00 2001 From: Nenad Date: Wed, 11 Dec 2024 11:43:21 +0100 Subject: [PATCH 6/9] ref: format code in ecdsa.rs --- contracts/src/utils/cryptography/ecdsa.rs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/contracts/src/utils/cryptography/ecdsa.rs b/contracts/src/utils/cryptography/ecdsa.rs index b9012aaa3..cb848e1dd 100644 --- a/contracts/src/utils/cryptography/ecdsa.rs +++ b/contracts/src/utils/cryptography/ecdsa.rs @@ -85,12 +85,7 @@ sol! { /// # Panics /// /// * If the `ecrecover` precompile fails to execute. -pub fn recover( - hash: B256, - v: u8, - r: B256, - s: B256, -) -> Result { +pub fn recover(hash: B256, v: u8, r: B256, s: B256) -> Result { check_if_malleable(&s)?; // If the signature is valid (and not malleable), return the signer address. _recover(hash, v, r, s) @@ -118,12 +113,7 @@ pub fn recover( /// # Panics /// /// * If the `ecrecover` precompile fails to execute. -fn _recover( - hash: B256, - v: u8, - r: B256, - s: B256, -) -> Result { +fn _recover(hash: B256, v: u8, r: B256, s: B256) -> Result { let calldata = encode_calldata(hash, v, r, s); if v == 0 || v == 1 { @@ -134,9 +124,8 @@ fn _recover( return Err(ECDSAInvalidSignature {}.into()); } - let recovered = - call::static_call(Call::new(), ECRECOVER_ADDR, &calldata) - .expect("should call `ecrecover` precompile"); + let recovered = call::static_call(Call::new(), ECRECOVER_ADDR, &calldata) + .expect("should call `ecrecover` precompile"); let recovered = Address::from_slice(&recovered[12..]); From d46429bfaf176ff81ec04cc1da6064048184799a Mon Sep 17 00:00:00 2001 From: SarveshLimaye Date: Thu, 12 Dec 2024 10:58:15 +0530 Subject: [PATCH 7/9] chore: apply clippy warnings --- CHANGELOG.md | 5 +++-- contracts/src/token/erc1155/extensions/supply.rs | 2 +- contracts/src/token/erc1155/mod.rs | 4 +--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff2dfd514..17ab68dd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,9 +27,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed (Breaking) - Update internal functions of `Erc721` and `Erc721Consecutive` to accept a reference to `Bytes`. #437 -- Stop supporting reentrancy, and borrow `self` immutably in `IErc721::_check_on_erc721_received` and `IErc1155::_check_on_erc1155_received`. #440 +- Stop supporting reentrancy, and borrow `self` immutably in `IErc721::_check_on_erc721_received`. #440 +- Remove `&mut self` parameter from `IErc1155::_check_on_erc1155_received` and make it an associated function. #440 - Remove `storage: &mut impl TopLevelStorage` parameter from `ecdsa::recover`. #440 -- Remove `TopLevelStorage` implementation from `VestingWallet`, `Erc1155`, `Erc20Permit`, `SafeErc20`, `Erc721Consecutive`, and `Erc721`. #440 +- Remove `TopLevelStorage` trait implementation from `VestingWallet`, `Erc1155`, `Erc20Permit`, `SafeErc20`, `Erc721Consecutive`, and `Erc721`. #440 ### Fixed diff --git a/contracts/src/token/erc1155/extensions/supply.rs b/contracts/src/token/erc1155/extensions/supply.rs index 0c5e218c3..6c46f64bf 100644 --- a/contracts/src/token/erc1155/extensions/supply.rs +++ b/contracts/src/token/erc1155/extensions/supply.rs @@ -279,7 +279,7 @@ impl Erc1155Supply { self._update(from, to, ids.clone(), values.clone())?; if !to.is_zero() { - self.erc1155._check_on_erc1155_received( + Erc1155::_check_on_erc1155_received( msg::sender(), from, to, diff --git a/contracts/src/token/erc1155/mod.rs b/contracts/src/token/erc1155/mod.rs index 56d30d534..f88e96cee 100644 --- a/contracts/src/token/erc1155/mod.rs +++ b/contracts/src/token/erc1155/mod.rs @@ -551,7 +551,7 @@ impl Erc1155 { self._update(from, to, ids.clone(), values.clone())?; if !to.is_zero() { - self._check_on_erc1155_received( + Erc1155::_check_on_erc1155_received( msg::sender(), from, to, @@ -761,7 +761,6 @@ impl Erc1155 { /// /// # Arguments /// - /// * `&self` - Read access to the contract's state. /// * `operator` - Generally the address that initiated the token transfer /// (e.g. `msg::sender()`). /// * `from` - Account of the sender. @@ -780,7 +779,6 @@ impl Erc1155 { /// interface id or returned with error, then the error /// [`Error::InvalidReceiver`] is returned. fn _check_on_erc1155_received( - &self, operator: Address, from: Address, to: Address, From 55ab7fedf9ea516e5f527891f360f190412fa110 Mon Sep 17 00:00:00 2001 From: Daniel Bigos Date: Thu, 12 Dec 2024 12:02:23 +0100 Subject: [PATCH 8/9] ref: formatting --- lib/motsu/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/motsu/README.md b/lib/motsu/README.md index 3356e2038..f7f10674e 100644 --- a/lib/motsu/README.md +++ b/lib/motsu/README.md @@ -13,7 +13,7 @@ Annotate tests with `#[motsu::test]` instead of `#[test]` to get access to VM affordances. Note that we require contracts to implement `stylus_sdk::prelude::StorageType`. -This trait is typically implemented by default with `stylus_proc::sol_storage` +This trait is typically implemented by default with `stylus_proc::sol_storage` or `stylus_proc::storage` macros. ```rust From b88d0afe5cf15809016390016aff559a198261dd Mon Sep 17 00:00:00 2001 From: Daniel Bigos Date: Thu, 12 Dec 2024 12:09:34 +0100 Subject: [PATCH 9/9] ref: remove unused imports --- contracts/src/finance/vesting_wallet.rs | 2 +- contracts/src/token/erc1155/extensions/uri_storage.rs | 2 +- contracts/src/token/erc20/utils/safe_erc20.rs | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/contracts/src/finance/vesting_wallet.rs b/contracts/src/finance/vesting_wallet.rs index 68ee81b3d..3cbd55c43 100644 --- a/contracts/src/finance/vesting_wallet.rs +++ b/contracts/src/finance/vesting_wallet.rs @@ -33,7 +33,7 @@ use stylus_sdk::{ call::{self, call, Call}, contract, evm, function_selector, prelude::storage, - storage::{StorageMap, StorageU256, StorageU64, TopLevelStorage}, + storage::{StorageMap, StorageU256, StorageU64}, stylus_proc::{public, SolidityError}, }; diff --git a/contracts/src/token/erc1155/extensions/uri_storage.rs b/contracts/src/token/erc1155/extensions/uri_storage.rs index 442c260fa..cc510039c 100644 --- a/contracts/src/token/erc1155/extensions/uri_storage.rs +++ b/contracts/src/token/erc1155/extensions/uri_storage.rs @@ -94,7 +94,7 @@ mod tests { use stylus_sdk::prelude::storage; use super::Erc1155UriStorage; - use crate::token::erc1155::{extensions::Erc1155MetadataUri, Erc1155}; + use crate::token::erc1155::extensions::Erc1155MetadataUri; fn random_token_id() -> U256 { let num: u32 = rand::random(); diff --git a/contracts/src/token/erc20/utils/safe_erc20.rs b/contracts/src/token/erc20/utils/safe_erc20.rs index 23aa812e0..1bb611e77 100644 --- a/contracts/src/token/erc20/utils/safe_erc20.rs +++ b/contracts/src/token/erc20/utils/safe_erc20.rs @@ -18,7 +18,6 @@ use stylus_sdk::{ evm::gas_left, function_selector, prelude::storage, - storage::TopLevelStorage, stylus_proc::{public, SolidityError}, types::AddressVM, };