From e8b750072843c7085e6a6c3e9071e5e2204844eb Mon Sep 17 00:00:00 2001 From: Eric Nordelo Date: Fri, 28 Jul 2023 18:44:17 +0200 Subject: [PATCH] feat: sort imports --- src/openzeppelin/access/accesscontrol.cairo | 4 +- .../access/accesscontrol/accesscontrol.cairo | 4 +- .../accesscontrol/dual_accesscontrol.cairo | 6 +-- src/openzeppelin/access/ownable.cairo | 6 +-- .../access/ownable/dual_ownable.cairo | 14 +++---- src/openzeppelin/account.cairo | 6 +-- src/openzeppelin/account/account.cairo | 14 +++---- src/openzeppelin/account/dual_account.cairo | 7 ++-- src/openzeppelin/account/interface.cairo | 2 +- src/openzeppelin/introspection.cairo | 2 +- .../introspection/dual_src5.cairo | 5 +-- src/openzeppelin/security.cairo | 4 +- src/openzeppelin/tests/access.cairo | 2 +- .../tests/access/test_accesscontrol.cairo | 12 +++--- .../access/test_dual_accesscontrol.cairo | 21 +++++------ .../tests/access/test_dual_ownable.cairo | 23 ++++++------ .../tests/access/test_ownable.cairo | 10 ++--- .../tests/account/test_account.cairo | 15 ++++---- .../tests/account/test_dual_account.cairo | 11 +++--- src/openzeppelin/tests/introspection.cairo | 2 +- .../tests/introspection/test_dual_src5.cairo | 16 ++++---- .../tests/introspection/test_src5.cairo | 6 +-- src/openzeppelin/tests/mocks.cairo | 24 ++++++------ .../tests/mocks/camel20_mock.cairo | 2 +- .../tests/mocks/camel721_mock.cairo | 6 +-- .../mocks/camel_accesscontrol_mock.cairo | 6 +-- .../tests/mocks/dual721_receiver_mocks.cairo | 2 +- .../tests/mocks/erc721_receiver.cairo | 9 ++--- .../mocks/reentrancy_attacker_mock.cairo | 4 +- .../tests/mocks/reentrancy_mock.cairo | 4 +- .../tests/mocks/snake20_mock.cairo | 2 +- .../tests/mocks/snake721_mock.cairo | 6 +-- .../mocks/snake_accesscontrol_mock.cairo | 6 +-- src/openzeppelin/tests/security.cairo | 2 +- .../tests/security/test_initializable.cairo | 2 +- .../tests/security/test_pausable.cairo | 4 +- .../tests/security/test_reentrancyguard.cairo | 6 +-- src/openzeppelin/tests/token.cairo | 2 +- .../tests/token/test_dual20.cairo | 11 +++--- .../tests/token/test_dual721.cairo | 30 +++++++-------- .../tests/token/test_dual721_receiver.cairo | 26 ++++++------- src/openzeppelin/tests/token/test_erc20.cairo | 9 ++--- .../tests/token/test_erc721.cairo | 37 +++++++++---------- src/openzeppelin/tests/utils.cairo | 2 +- src/openzeppelin/token/erc20.cairo | 2 +- src/openzeppelin/token/erc20/dual20.cairo | 11 +++--- src/openzeppelin/token/erc20/erc20.cairo | 5 +-- src/openzeppelin/token/erc721/dual721.cairo | 8 ++-- .../token/erc721/dual721_receiver.cairo | 8 ++-- src/openzeppelin/token/erc721/erc721.cairo | 9 ++--- src/openzeppelin/token/erc721/interface.cairo | 2 +- src/openzeppelin/utils.cairo | 2 +- src/openzeppelin/utils/unwrap_and_cast.cairo | 4 +- 53 files changed, 216 insertions(+), 229 deletions(-) diff --git a/src/openzeppelin/access/accesscontrol.cairo b/src/openzeppelin/access/accesscontrol.cairo index 025142e68..6c2df16c2 100644 --- a/src/openzeppelin/access/accesscontrol.cairo +++ b/src/openzeppelin/access/accesscontrol.cairo @@ -1,7 +1,7 @@ mod accesscontrol; -use accesscontrol::AccessControl; - mod dual_accesscontrol; mod interface; +use accesscontrol::AccessControl; + const DEFAULT_ADMIN_ROLE: felt252 = 0; diff --git a/src/openzeppelin/access/accesscontrol/accesscontrol.cairo b/src/openzeppelin/access/accesscontrol/accesscontrol.cairo index 78d245945..0287ab1b7 100644 --- a/src/openzeppelin/access/accesscontrol/accesscontrol.cairo +++ b/src/openzeppelin/access/accesscontrol/accesscontrol.cairo @@ -1,11 +1,11 @@ #[starknet::contract] mod AccessControl { - use starknet::ContractAddress; - use starknet::get_caller_address; use openzeppelin::access::accesscontrol::interface; use openzeppelin::introspection::interface::ISRC5; use openzeppelin::introspection::interface::ISRC5Camel; use openzeppelin::introspection::src5::SRC5; + use starknet::ContractAddress; + use starknet::get_caller_address; #[storage] struct Storage { diff --git a/src/openzeppelin/access/accesscontrol/dual_accesscontrol.cairo b/src/openzeppelin/access/accesscontrol/dual_accesscontrol.cairo index 49367b2e5..c82403192 100644 --- a/src/openzeppelin/access/accesscontrol/dual_accesscontrol.cairo +++ b/src/openzeppelin/access/accesscontrol/dual_accesscontrol.cairo @@ -1,12 +1,12 @@ use array::ArrayTrait; -use starknet::ContractAddress; -use starknet::SyscallResultTrait; use openzeppelin::utils::Felt252TryIntoBool; +use openzeppelin::utils::UnwrapAndCast; use openzeppelin::utils::selectors; use openzeppelin::utils::serde::SerializedAppend; use openzeppelin::utils::try_selector_with_fallback; -use openzeppelin::utils::UnwrapAndCast; +use starknet::ContractAddress; +use starknet::SyscallResultTrait; #[derive(Copy, Drop)] struct DualCaseAccessControl { diff --git a/src/openzeppelin/access/ownable.cairo b/src/openzeppelin/access/ownable.cairo index 7b8e812b9..4c70a8a9d 100644 --- a/src/openzeppelin/access/ownable.cairo +++ b/src/openzeppelin/access/ownable.cairo @@ -1,5 +1,5 @@ +mod dual_ownable; +mod interface; mod ownable; -use ownable::Ownable; -mod interface; -mod dual_ownable; +use ownable::Ownable; diff --git a/src/openzeppelin/access/ownable/dual_ownable.cairo b/src/openzeppelin/access/ownable/dual_ownable.cairo index 583d96ffe..c05859f7d 100644 --- a/src/openzeppelin/access/ownable/dual_ownable.cairo +++ b/src/openzeppelin/access/ownable/dual_ownable.cairo @@ -1,6 +1,12 @@ -use array::SpanTrait; use array::ArrayTrait; +use array::SpanTrait; use core::result::ResultTrait; + +use openzeppelin::utils::Felt252TryIntoBool; +use openzeppelin::utils::UnwrapAndCast; +use openzeppelin::utils::selectors; +use openzeppelin::utils::serde::SerializedAppend; +use openzeppelin::utils::try_selector_with_fallback; use option::OptionTrait; use starknet::ContractAddress; use starknet::Felt252TryIntoContractAddress; @@ -8,12 +14,6 @@ use starknet::SyscallResultTrait; use starknet::call_contract_syscall; use traits::TryInto; -use openzeppelin::utils::Felt252TryIntoBool; -use openzeppelin::utils::selectors; -use openzeppelin::utils::serde::SerializedAppend; -use openzeppelin::utils::try_selector_with_fallback; -use openzeppelin::utils::UnwrapAndCast; - #[derive(Copy, Drop)] struct DualCaseOwnable { contract_address: ContractAddress diff --git a/src/openzeppelin/account.cairo b/src/openzeppelin/account.cairo index d8f6cab7a..1ca2c1578 100644 --- a/src/openzeppelin/account.cairo +++ b/src/openzeppelin/account.cairo @@ -3,9 +3,9 @@ mod dual_account; mod interface; use account::Account; -use account::TRANSACTION_VERSION; use account::QUERY_VERSION; -use interface::AccountCamelABIDispatcher; -use interface::AccountCamelABIDispatcherTrait; +use account::TRANSACTION_VERSION; use interface::AccountABIDispatcher; use interface::AccountABIDispatcherTrait; +use interface::AccountCamelABIDispatcher; +use interface::AccountCamelABIDispatcherTrait; diff --git a/src/openzeppelin/account/account.cairo b/src/openzeppelin/account/account.cairo index 21b2d79d7..301203f7e 100644 --- a/src/openzeppelin/account/account.cairo +++ b/src/openzeppelin/account/account.cairo @@ -2,8 +2,8 @@ use array::ArrayTrait; use array::SpanTrait; use option::OptionTrait; use serde::Serde; -use starknet::account::Call; use starknet::ContractAddress; +use starknet::account::Call; const TRANSACTION_VERSION: felt252 = 1; @@ -22,24 +22,24 @@ trait PublicKeyCamelTrait { #[starknet::contract] mod Account { - use array::SpanTrait; use array::ArrayTrait; + use array::SpanTrait; use box::BoxTrait; use ecdsa::check_ecdsa_signature; - use option::OptionTrait; - use starknet::get_tx_info; - use starknet::get_caller_address; - use starknet::get_contract_address; - use zeroable::Zeroable; use openzeppelin::account::interface; use openzeppelin::introspection::interface::ISRC5; use openzeppelin::introspection::interface::ISRC5Camel; use openzeppelin::introspection::src5::SRC5; + use option::OptionTrait; + use starknet::get_caller_address; + use starknet::get_contract_address; + use starknet::get_tx_info; use super::Call; use super::QUERY_VERSION; use super::TRANSACTION_VERSION; + use zeroable::Zeroable; #[storage] struct Storage { diff --git a/src/openzeppelin/account/dual_account.cairo b/src/openzeppelin/account/dual_account.cairo index ee4e1c0b6..56297eb0c 100644 --- a/src/openzeppelin/account/dual_account.cairo +++ b/src/openzeppelin/account/dual_account.cairo @@ -1,12 +1,11 @@ use array::ArrayTrait; use array::SpanTrait; -use starknet::ContractAddress; -use starknet::SyscallResultTrait; - +use openzeppelin::utils::UnwrapAndCast; use openzeppelin::utils::selectors; use openzeppelin::utils::serde::SerializedAppend; use openzeppelin::utils::try_selector_with_fallback; -use openzeppelin::utils::UnwrapAndCast; +use starknet::ContractAddress; +use starknet::SyscallResultTrait; #[derive(Copy, Drop)] struct DualCaseAccount { diff --git a/src/openzeppelin/account/interface.cairo b/src/openzeppelin/account/interface.cairo index e557b6dec..b00f0d093 100644 --- a/src/openzeppelin/account/interface.cairo +++ b/src/openzeppelin/account/interface.cairo @@ -1,7 +1,7 @@ use array::ArrayTrait; use array::SpanTrait; -use starknet::account::Call; use starknet::ContractAddress; +use starknet::account::Call; const ISRC6_ID: felt252 = 0x2ceccef7f994940b3962a6c67e0ba4fcd37df7d131417c604f91e03caecc1cd; diff --git a/src/openzeppelin/introspection.cairo b/src/openzeppelin/introspection.cairo index 184f921e7..5eb468c65 100644 --- a/src/openzeppelin/introspection.cairo +++ b/src/openzeppelin/introspection.cairo @@ -1,3 +1,3 @@ -mod src5; mod dual_src5; mod interface; +mod src5; diff --git a/src/openzeppelin/introspection/dual_src5.cairo b/src/openzeppelin/introspection/dual_src5.cairo index ca6868cae..11a88098e 100644 --- a/src/openzeppelin/introspection/dual_src5.cairo +++ b/src/openzeppelin/introspection/dual_src5.cairo @@ -1,9 +1,8 @@ use array::ArrayTrait; -use starknet::ContractAddress; - +use openzeppelin::utils::UnwrapAndCast; use openzeppelin::utils::selectors; use openzeppelin::utils::try_selector_with_fallback; -use openzeppelin::utils::UnwrapAndCast; +use starknet::ContractAddress; #[derive(Copy, Drop)] struct DualCaseSRC5 { diff --git a/src/openzeppelin/security.cairo b/src/openzeppelin/security.cairo index 45a9c998a..4713c3cff 100644 --- a/src/openzeppelin/security.cairo +++ b/src/openzeppelin/security.cairo @@ -1,3 +1,3 @@ -mod reentrancyguard; -mod pausable; mod initializable; +mod pausable; +mod reentrancyguard; diff --git a/src/openzeppelin/tests/access.cairo b/src/openzeppelin/tests/access.cairo index 149c62b59..2599d6d1f 100644 --- a/src/openzeppelin/tests/access.cairo +++ b/src/openzeppelin/tests/access.cairo @@ -1,4 +1,4 @@ mod test_accesscontrol; mod test_dual_accesscontrol; -mod test_ownable; mod test_dual_ownable; +mod test_ownable; diff --git a/src/openzeppelin/tests/access/test_accesscontrol.cairo b/src/openzeppelin/tests/access/test_accesscontrol.cairo index 704242309..86ef607e0 100644 --- a/src/openzeppelin/tests/access/test_accesscontrol.cairo +++ b/src/openzeppelin/tests/access/test_accesscontrol.cairo @@ -1,12 +1,12 @@ -use starknet::contract_address_const; -use starknet::ContractAddress; -use starknet::testing; -use openzeppelin::access::accesscontrol::AccessControl; -use openzeppelin::access::accesscontrol::AccessControl::InternalImpl; -use openzeppelin::access::accesscontrol::AccessControl::AccessControlImpl; use openzeppelin::access::accesscontrol::AccessControl::AccessControlCamelImpl; +use openzeppelin::access::accesscontrol::AccessControl::AccessControlImpl; +use openzeppelin::access::accesscontrol::AccessControl::InternalImpl; +use openzeppelin::access::accesscontrol::AccessControl; use openzeppelin::access::accesscontrol::DEFAULT_ADMIN_ROLE; use openzeppelin::access::accesscontrol::interface::IACCESSCONTROL_ID; +use starknet::ContractAddress; +use starknet::contract_address_const; +use starknet::testing; const ROLE: felt252 = 41; const OTHER_ROLE: felt252 = 42; diff --git a/src/openzeppelin/tests/access/test_dual_accesscontrol.cairo b/src/openzeppelin/tests/access/test_dual_accesscontrol.cairo index 7fc3b5049..0523ba1c6 100644 --- a/src/openzeppelin/tests/access/test_dual_accesscontrol.cairo +++ b/src/openzeppelin/tests/access/test_dual_accesscontrol.cairo @@ -1,23 +1,22 @@ use array::ArrayTrait; -use starknet::ContractAddress; -use starknet::contract_address_const; -use starknet::testing::set_contract_address; - use openzeppelin::access::accesscontrol::DEFAULT_ADMIN_ROLE; +use openzeppelin::access::accesscontrol::dual_accesscontrol::DualCaseAccessControl; +use openzeppelin::access::accesscontrol::dual_accesscontrol::DualCaseAccessControlTrait; use openzeppelin::access::accesscontrol::interface::IACCESSCONTROL_ID; -use openzeppelin::access::accesscontrol::interface::IAccessControlDispatcher; use openzeppelin::access::accesscontrol::interface::IAccessControlCamelDispatcher; -use openzeppelin::access::accesscontrol::interface::IAccessControlDispatcherTrait; use openzeppelin::access::accesscontrol::interface::IAccessControlCamelDispatcherTrait; -use openzeppelin::access::accesscontrol::dual_accesscontrol::DualCaseAccessControlTrait; -use openzeppelin::access::accesscontrol::dual_accesscontrol::DualCaseAccessControl; -use openzeppelin::tests::mocks::snake_accesscontrol_mock::SnakeAccessControlMock; -use openzeppelin::tests::mocks::camel_accesscontrol_mock::CamelAccessControlMock; -use openzeppelin::tests::mocks::accesscontrol_panic_mock::SnakeAccessControlPanicMock; +use openzeppelin::access::accesscontrol::interface::IAccessControlDispatcher; +use openzeppelin::access::accesscontrol::interface::IAccessControlDispatcherTrait; use openzeppelin::tests::mocks::accesscontrol_panic_mock::CamelAccessControlPanicMock; +use openzeppelin::tests::mocks::accesscontrol_panic_mock::SnakeAccessControlPanicMock; +use openzeppelin::tests::mocks::camel_accesscontrol_mock::CamelAccessControlMock; use openzeppelin::tests::mocks::non_implementing_mock::NonImplementingMock; +use openzeppelin::tests::mocks::snake_accesscontrol_mock::SnakeAccessControlMock; use openzeppelin::tests::utils; use openzeppelin::utils::serde::SerializedAppend; +use starknet::ContractAddress; +use starknet::contract_address_const; +use starknet::testing::set_contract_address; // // Constants diff --git a/src/openzeppelin/tests/access/test_dual_ownable.cairo b/src/openzeppelin/tests/access/test_dual_ownable.cairo index 672df30ce..f07f1a10c 100644 --- a/src/openzeppelin/tests/access/test_dual_ownable.cairo +++ b/src/openzeppelin/tests/access/test_dual_ownable.cairo @@ -1,22 +1,21 @@ -use starknet::ContractAddress; -use starknet::contract_address_const; -use starknet::testing::set_caller_address; -use starknet::testing::set_contract_address; -use zeroable::Zeroable; - -use openzeppelin::access::ownable::interface::IOwnableDispatcher; +use openzeppelin::access::ownable::dual_ownable::DualCaseOwnable; +use openzeppelin::access::ownable::dual_ownable::DualCaseOwnableTrait; use openzeppelin::access::ownable::interface::IOwnableCamelOnlyDispatcher; -use openzeppelin::access::ownable::interface::IOwnableDispatcherTrait; use openzeppelin::access::ownable::interface::IOwnableCamelOnlyDispatcherTrait; -use openzeppelin::access::ownable::dual_ownable::DualCaseOwnableTrait; -use openzeppelin::access::ownable::dual_ownable::DualCaseOwnable; -use openzeppelin::tests::mocks::dual_ownable_mocks::SnakeOwnableMock; +use openzeppelin::access::ownable::interface::IOwnableDispatcher; +use openzeppelin::access::ownable::interface::IOwnableDispatcherTrait; use openzeppelin::tests::mocks::dual_ownable_mocks::CamelOwnableMock; -use openzeppelin::tests::mocks::dual_ownable_mocks::SnakeOwnablePanicMock; use openzeppelin::tests::mocks::dual_ownable_mocks::CamelOwnablePanicMock; +use openzeppelin::tests::mocks::dual_ownable_mocks::SnakeOwnableMock; +use openzeppelin::tests::mocks::dual_ownable_mocks::SnakeOwnablePanicMock; use openzeppelin::tests::mocks::non_implementing_mock::NonImplementingMock; use openzeppelin::tests::utils; use openzeppelin::utils::serde::SerializedAppend; +use starknet::ContractAddress; +use starknet::contract_address_const; +use starknet::testing::set_caller_address; +use starknet::testing::set_contract_address; +use zeroable::Zeroable; // // Constants diff --git a/src/openzeppelin/tests/access/test_ownable.cairo b/src/openzeppelin/tests/access/test_ownable.cairo index 2b906dbed..d88d0f786 100644 --- a/src/openzeppelin/tests/access/test_ownable.cairo +++ b/src/openzeppelin/tests/access/test_ownable.cairo @@ -1,12 +1,12 @@ +use openzeppelin::access::ownable::Ownable::InternalImpl; +use openzeppelin::access::ownable::Ownable::OwnableCamelOnlyImpl; +use openzeppelin::access::ownable::Ownable::OwnableImpl; +use openzeppelin::access::ownable::Ownable::_owner::InternalContractStateTrait; +use openzeppelin::access::ownable::Ownable; use starknet::ContractAddress; use starknet::contract_address_const; use starknet::testing; use zeroable::Zeroable; -use openzeppelin::access::ownable::Ownable; -use openzeppelin::access::ownable::Ownable::OwnableImpl; -use openzeppelin::access::ownable::Ownable::OwnableCamelOnlyImpl; -use openzeppelin::access::ownable::Ownable::InternalImpl; -use openzeppelin::access::ownable::Ownable::_owner::InternalContractStateTrait; fn ZERO() -> ContractAddress { contract_address_const::<0>() diff --git a/src/openzeppelin/tests/account/test_account.cairo b/src/openzeppelin/tests/account/test_account.cairo index b5d9828f7..b2fe45ceb 100644 --- a/src/openzeppelin/tests/account/test_account.cairo +++ b/src/openzeppelin/tests/account/test_account.cairo @@ -1,18 +1,11 @@ use array::ArrayTrait; use core::traits::Into; -use option::OptionTrait; -use serde::Serde; -use starknet::account::Call; -use starknet::contract_address_const; -use starknet::ContractAddress; -use starknet::testing; - use openzeppelin::account::Account; use openzeppelin::account::AccountABIDispatcher; use openzeppelin::account::AccountABIDispatcherTrait; -use openzeppelin::account::interface::ISRC6_ID; use openzeppelin::account::QUERY_VERSION; use openzeppelin::account::TRANSACTION_VERSION; +use openzeppelin::account::interface::ISRC6_ID; use openzeppelin::introspection::interface::ISRC5_ID; use openzeppelin::tests::utils; use openzeppelin::token::erc20::ERC20; @@ -20,6 +13,12 @@ use openzeppelin::token::erc20::interface::IERC20Dispatcher; use openzeppelin::token::erc20::interface::IERC20DispatcherTrait; use openzeppelin::utils::selectors; use openzeppelin::utils::serde::SerializedAppend; +use option::OptionTrait; +use serde::Serde; +use starknet::ContractAddress; +use starknet::account::Call; +use starknet::contract_address_const; +use starknet::testing; // // Constants diff --git a/src/openzeppelin/tests/account/test_dual_account.cairo b/src/openzeppelin/tests/account/test_dual_account.cairo index 76ea9fb99..7f306b68a 100644 --- a/src/openzeppelin/tests/account/test_dual_account.cairo +++ b/src/openzeppelin/tests/account/test_dual_account.cairo @@ -1,11 +1,9 @@ -use starknet::testing; - -use openzeppelin::account::dual_account::DualCaseAccount; -use openzeppelin::account::dual_account::DualCaseAccountABI; -use openzeppelin::account::AccountCamelABIDispatcher; -use openzeppelin::account::AccountCamelABIDispatcherTrait; use openzeppelin::account::AccountABIDispatcher; use openzeppelin::account::AccountABIDispatcherTrait; +use openzeppelin::account::AccountCamelABIDispatcher; +use openzeppelin::account::AccountCamelABIDispatcherTrait; +use openzeppelin::account::dual_account::DualCaseAccount; +use openzeppelin::account::dual_account::DualCaseAccountABI; use openzeppelin::introspection::interface::ISRC5_ID; use openzeppelin::tests::account::test_account::SIGNED_TX_DATA; use openzeppelin::tests::mocks::account_panic_mock::CamelAccountPanicMock; @@ -14,6 +12,7 @@ use openzeppelin::tests::mocks::camel_account_mock::CamelAccountMock; use openzeppelin::tests::mocks::non_implementing_mock::NonImplementingMock; use openzeppelin::tests::mocks::snake_account_mock::SnakeAccountMock; use openzeppelin::tests::utils; +use starknet::testing; // // Constants diff --git a/src/openzeppelin/tests/introspection.cairo b/src/openzeppelin/tests/introspection.cairo index d46bcfe7d..010db98a8 100644 --- a/src/openzeppelin/tests/introspection.cairo +++ b/src/openzeppelin/tests/introspection.cairo @@ -1,2 +1,2 @@ -mod test_src5; mod test_dual_src5; +mod test_src5; diff --git a/src/openzeppelin/tests/introspection/test_dual_src5.cairo b/src/openzeppelin/tests/introspection/test_dual_src5.cairo index 4e47773cc..d9747c681 100644 --- a/src/openzeppelin/tests/introspection/test_dual_src5.cairo +++ b/src/openzeppelin/tests/introspection/test_dual_src5.cairo @@ -1,16 +1,16 @@ use array::ArrayTrait; -use openzeppelin::introspection::interface::ISRC5_ID; -use openzeppelin::introspection::interface::ISRC5Dispatcher; -use openzeppelin::introspection::interface::ISRC5DispatcherTrait; -use openzeppelin::introspection::interface::ISRC5CamelDispatcher; -use openzeppelin::introspection::interface::ISRC5CamelDispatcherTrait; use openzeppelin::introspection::dual_src5::DualCaseSRC5; use openzeppelin::introspection::dual_src5::DualCaseSRC5Trait; -use openzeppelin::tests::mocks::src5_mocks::SnakeSRC5Mock; +use openzeppelin::introspection::interface::ISRC5CamelDispatcher; +use openzeppelin::introspection::interface::ISRC5CamelDispatcherTrait; +use openzeppelin::introspection::interface::ISRC5Dispatcher; +use openzeppelin::introspection::interface::ISRC5DispatcherTrait; +use openzeppelin::introspection::interface::ISRC5_ID; +use openzeppelin::tests::mocks::non_implementing_mock::NonImplementingMock; use openzeppelin::tests::mocks::src5_mocks::CamelSRC5Mock; -use openzeppelin::tests::mocks::src5_mocks::SnakeSRC5PanicMock; use openzeppelin::tests::mocks::src5_mocks::CamelSRC5PanicMock; -use openzeppelin::tests::mocks::non_implementing_mock::NonImplementingMock; +use openzeppelin::tests::mocks::src5_mocks::SnakeSRC5Mock; +use openzeppelin::tests::mocks::src5_mocks::SnakeSRC5PanicMock; use openzeppelin::tests::utils; // diff --git a/src/openzeppelin/tests/introspection/test_src5.cairo b/src/openzeppelin/tests/introspection/test_src5.cairo index 7b0ea5418..d81cf3e37 100644 --- a/src/openzeppelin/tests/introspection/test_src5.cairo +++ b/src/openzeppelin/tests/introspection/test_src5.cairo @@ -1,7 +1,7 @@ -use openzeppelin::introspection::src5::SRC5; -use openzeppelin::introspection::src5::SRC5::SRC5Impl; -use openzeppelin::introspection::src5::SRC5::InternalImpl; use openzeppelin::introspection::interface::ISRC5_ID; +use openzeppelin::introspection::src5::SRC5::InternalImpl; +use openzeppelin::introspection::src5::SRC5::SRC5Impl; +use openzeppelin::introspection::src5::SRC5; const OTHER_ID: felt252 = 0x12345678; diff --git a/src/openzeppelin/tests/mocks.cairo b/src/openzeppelin/tests/mocks.cairo index fd2e8f322..cb3112db1 100644 --- a/src/openzeppelin/tests/mocks.cairo +++ b/src/openzeppelin/tests/mocks.cairo @@ -1,19 +1,19 @@ -mod reentrancy_attacker_mock; -mod reentrancy_mock; -mod erc721_receiver; -mod erc721_panic_mock; -mod camel20_mock; -mod snake20_mock; -mod erc20_panic; mod accesscontrol_panic_mock; mod account_panic_mock; +mod camel20_mock; +mod camel721_mock; mod camel_accesscontrol_mock; mod camel_account_mock; -mod snake_accesscontrol_mock; -mod snake_account_mock; +mod dual721_receiver_mocks; mod dual_ownable_mocks; -mod snake721_mock; -mod camel721_mock; +mod erc20_panic; +mod erc721_panic_mock; +mod erc721_receiver; mod non_implementing_mock; -mod dual721_receiver_mocks; +mod reentrancy_attacker_mock; +mod reentrancy_mock; +mod snake20_mock; +mod snake721_mock; +mod snake_accesscontrol_mock; +mod snake_account_mock; mod src5_mocks; diff --git a/src/openzeppelin/tests/mocks/camel20_mock.cairo b/src/openzeppelin/tests/mocks/camel20_mock.cairo index 6eab0e06f..7c6e55637 100644 --- a/src/openzeppelin/tests/mocks/camel20_mock.cairo +++ b/src/openzeppelin/tests/mocks/camel20_mock.cairo @@ -1,7 +1,7 @@ #[starknet::contract] mod CamelERC20Mock { - use starknet::ContractAddress; use openzeppelin::token::erc20::ERC20; + use starknet::ContractAddress; #[storage] struct Storage {} diff --git a/src/openzeppelin/tests/mocks/camel721_mock.cairo b/src/openzeppelin/tests/mocks/camel721_mock.cairo index 553114f7e..9fcbbb248 100644 --- a/src/openzeppelin/tests/mocks/camel721_mock.cairo +++ b/src/openzeppelin/tests/mocks/camel721_mock.cairo @@ -1,10 +1,10 @@ #[starknet::contract] mod CamelERC721Mock { + use openzeppelin::token::erc721::ERC721::ERC721CamelOnlyImpl; + use openzeppelin::token::erc721::ERC721::InternalImpl; + use openzeppelin::token::erc721::ERC721; use starknet::ContractAddress; use starknet::get_caller_address; - use openzeppelin::token::erc721::ERC721; - use openzeppelin::token::erc721::ERC721::InternalImpl; - use openzeppelin::token::erc721::ERC721::ERC721CamelOnlyImpl; #[storage] struct Storage {} diff --git a/src/openzeppelin/tests/mocks/camel_accesscontrol_mock.cairo b/src/openzeppelin/tests/mocks/camel_accesscontrol_mock.cairo index dc0879a60..55835f50c 100644 --- a/src/openzeppelin/tests/mocks/camel_accesscontrol_mock.cairo +++ b/src/openzeppelin/tests/mocks/camel_accesscontrol_mock.cairo @@ -1,10 +1,10 @@ #[starknet::contract] mod CamelAccessControlMock { - use starknet::ContractAddress; - use starknet::get_caller_address; - use openzeppelin::access::accesscontrol::AccessControl; use openzeppelin::access::accesscontrol::AccessControl::AccessControlCamelImpl; + use openzeppelin::access::accesscontrol::AccessControl; use openzeppelin::access::accesscontrol::DEFAULT_ADMIN_ROLE; + use starknet::ContractAddress; + use starknet::get_caller_address; #[storage] struct Storage {} diff --git a/src/openzeppelin/tests/mocks/dual721_receiver_mocks.cairo b/src/openzeppelin/tests/mocks/dual721_receiver_mocks.cairo index 897918b68..a6e4f5f2a 100644 --- a/src/openzeppelin/tests/mocks/dual721_receiver_mocks.cairo +++ b/src/openzeppelin/tests/mocks/dual721_receiver_mocks.cairo @@ -1,6 +1,6 @@ use openzeppelin::introspection::src5::SRC5; -use openzeppelin::tests::mocks::erc721_receiver::ERC721Receiver; use openzeppelin::tests::mocks::erc721_receiver::ERC721Receiver::IERC721_RECEIVER_ID; +use openzeppelin::tests::mocks::erc721_receiver::ERC721Receiver; #[starknet::contract] mod SnakeERC721ReceiverMock { diff --git a/src/openzeppelin/tests/mocks/erc721_receiver.cairo b/src/openzeppelin/tests/mocks/erc721_receiver.cairo index 673e4100e..9205f6d97 100644 --- a/src/openzeppelin/tests/mocks/erc721_receiver.cairo +++ b/src/openzeppelin/tests/mocks/erc721_receiver.cairo @@ -4,14 +4,13 @@ const FAILURE: felt252 = 456456; #[starknet::contract] mod ERC721Receiver { use array::SpanTrait; - use starknet::ContractAddress; - - use openzeppelin::token::erc721::interface::IERC721Receiver; - use openzeppelin::token::erc721::interface::IERC721ReceiverCamel; - use openzeppelin::token::erc721::interface::IERC721_RECEIVER_ID; use openzeppelin::introspection::interface::ISRC5; use openzeppelin::introspection::interface::ISRC5Camel; use openzeppelin::introspection::src5::SRC5; + use openzeppelin::token::erc721::interface::IERC721Receiver; + use openzeppelin::token::erc721::interface::IERC721ReceiverCamel; + use openzeppelin::token::erc721::interface::IERC721_RECEIVER_ID; + use starknet::ContractAddress; #[storage] struct Storage {} diff --git a/src/openzeppelin/tests/mocks/reentrancy_attacker_mock.cairo b/src/openzeppelin/tests/mocks/reentrancy_attacker_mock.cairo index 39560f902..6657cc145 100644 --- a/src/openzeppelin/tests/mocks/reentrancy_attacker_mock.cairo +++ b/src/openzeppelin/tests/mocks/reentrancy_attacker_mock.cairo @@ -5,10 +5,10 @@ trait IAttacker { #[starknet::contract] mod Attacker { - use starknet::ContractAddress; - use starknet::get_caller_address; use openzeppelin::tests::mocks::reentrancy_mock::IReentrancyMockDispatcher; use openzeppelin::tests::mocks::reentrancy_mock::IReentrancyMockDispatcherTrait; + use starknet::ContractAddress; + use starknet::get_caller_address; #[storage] struct Storage {} diff --git a/src/openzeppelin/tests/mocks/reentrancy_mock.cairo b/src/openzeppelin/tests/mocks/reentrancy_mock.cairo index 0850954c5..dc81bb9ea 100644 --- a/src/openzeppelin/tests/mocks/reentrancy_mock.cairo +++ b/src/openzeppelin/tests/mocks/reentrancy_mock.cairo @@ -16,11 +16,11 @@ trait IReentrancyMock { #[starknet::contract] mod ReentrancyMock { - use starknet::ContractAddress; - use starknet::get_contract_address; use openzeppelin::security::reentrancyguard::ReentrancyGuard; use openzeppelin::tests::mocks::reentrancy_attacker_mock::IAttackerDispatcher; use openzeppelin::tests::mocks::reentrancy_attacker_mock::IAttackerDispatcherTrait; + use starknet::ContractAddress; + use starknet::get_contract_address; use super::IReentrancyGuardedDispatcher; use super::IReentrancyGuardedDispatcherTrait; diff --git a/src/openzeppelin/tests/mocks/snake20_mock.cairo b/src/openzeppelin/tests/mocks/snake20_mock.cairo index ba20d54b1..17c7b32ef 100644 --- a/src/openzeppelin/tests/mocks/snake20_mock.cairo +++ b/src/openzeppelin/tests/mocks/snake20_mock.cairo @@ -1,7 +1,7 @@ #[starknet::contract] mod SnakeERC20Mock { - use starknet::ContractAddress; use openzeppelin::token::erc20::ERC20; + use starknet::ContractAddress; #[storage] struct Storage {} diff --git a/src/openzeppelin/tests/mocks/snake721_mock.cairo b/src/openzeppelin/tests/mocks/snake721_mock.cairo index 13335a52f..6f1382c61 100644 --- a/src/openzeppelin/tests/mocks/snake721_mock.cairo +++ b/src/openzeppelin/tests/mocks/snake721_mock.cairo @@ -1,10 +1,10 @@ #[starknet::contract] mod SnakeERC721Mock { + use openzeppelin::token::erc721::ERC721::ERC721Impl; + use openzeppelin::token::erc721::ERC721::InternalImpl; + use openzeppelin::token::erc721::ERC721; use starknet::ContractAddress; use starknet::get_caller_address; - use openzeppelin::token::erc721::ERC721; - use openzeppelin::token::erc721::ERC721::InternalImpl; - use openzeppelin::token::erc721::ERC721::ERC721Impl; #[storage] struct Storage {} diff --git a/src/openzeppelin/tests/mocks/snake_accesscontrol_mock.cairo b/src/openzeppelin/tests/mocks/snake_accesscontrol_mock.cairo index 1d69feaec..48b291979 100644 --- a/src/openzeppelin/tests/mocks/snake_accesscontrol_mock.cairo +++ b/src/openzeppelin/tests/mocks/snake_accesscontrol_mock.cairo @@ -1,10 +1,10 @@ #[starknet::contract] mod SnakeAccessControlMock { - use starknet::ContractAddress; - use starknet::get_caller_address; - use openzeppelin::access::accesscontrol::AccessControl; use openzeppelin::access::accesscontrol::AccessControl::AccessControlImpl; + use openzeppelin::access::accesscontrol::AccessControl; use openzeppelin::access::accesscontrol::DEFAULT_ADMIN_ROLE; + use starknet::ContractAddress; + use starknet::get_caller_address; #[storage] struct Storage {} diff --git a/src/openzeppelin/tests/security.cairo b/src/openzeppelin/tests/security.cairo index 1efdf53c8..35c30a0e8 100644 --- a/src/openzeppelin/tests/security.cairo +++ b/src/openzeppelin/tests/security.cairo @@ -1,3 +1,3 @@ mod test_initializable; -mod test_reentrancyguard; mod test_pausable; +mod test_reentrancyguard; diff --git a/src/openzeppelin/tests/security/test_initializable.cairo b/src/openzeppelin/tests/security/test_initializable.cairo index 86bf68fbc..66d2b89dc 100644 --- a/src/openzeppelin/tests/security/test_initializable.cairo +++ b/src/openzeppelin/tests/security/test_initializable.cairo @@ -1,5 +1,5 @@ -use openzeppelin::security::initializable::Initializable; use openzeppelin::security::initializable::Initializable::InternalImpl; +use openzeppelin::security::initializable::Initializable; fn STATE() -> Initializable::ContractState { Initializable::contract_state_for_testing() diff --git a/src/openzeppelin/tests/security/test_pausable.cairo b/src/openzeppelin/tests/security/test_pausable.cairo index 79bafced6..ac84fedc2 100644 --- a/src/openzeppelin/tests/security/test_pausable.cairo +++ b/src/openzeppelin/tests/security/test_pausable.cairo @@ -1,6 +1,6 @@ -use openzeppelin::security::pausable::Pausable; -use openzeppelin::security::pausable::Pausable::PausableImpl; use openzeppelin::security::pausable::Pausable::InternalImpl; +use openzeppelin::security::pausable::Pausable::PausableImpl; +use openzeppelin::security::pausable::Pausable; fn STATE() -> Pausable::ContractState { Pausable::contract_state_for_testing() diff --git a/src/openzeppelin/tests/security/test_reentrancyguard.cairo b/src/openzeppelin/tests/security/test_reentrancyguard.cairo index f0891b213..b608706db 100644 --- a/src/openzeppelin/tests/security/test_reentrancyguard.cairo +++ b/src/openzeppelin/tests/security/test_reentrancyguard.cairo @@ -1,10 +1,10 @@ -use openzeppelin::security::reentrancyguard::ReentrancyGuard; use openzeppelin::security::reentrancyguard::ReentrancyGuard::InternalImpl; use openzeppelin::security::reentrancyguard::ReentrancyGuard::entered::InternalContractStateTrait; -use openzeppelin::tests::mocks::reentrancy_mock::ReentrancyMock; +use openzeppelin::security::reentrancyguard::ReentrancyGuard; +use openzeppelin::tests::mocks::reentrancy_attacker_mock::Attacker; use openzeppelin::tests::mocks::reentrancy_mock::IReentrancyMockDispatcher; use openzeppelin::tests::mocks::reentrancy_mock::IReentrancyMockDispatcherTrait; -use openzeppelin::tests::mocks::reentrancy_attacker_mock::Attacker; +use openzeppelin::tests::mocks::reentrancy_mock::ReentrancyMock; use openzeppelin::tests::utils; fn STATE() -> ReentrancyGuard::ContractState { diff --git a/src/openzeppelin/tests/token.cairo b/src/openzeppelin/tests/token.cairo index fa678fb9c..458159c98 100644 --- a/src/openzeppelin/tests/token.cairo +++ b/src/openzeppelin/tests/token.cairo @@ -1,6 +1,6 @@ mod test_dual20; mod test_dual721; +mod test_dual721_receiver; mod test_erc20; mod test_erc721; -mod test_dual721_receiver; diff --git a/src/openzeppelin/tests/token/test_dual20.cairo b/src/openzeppelin/tests/token/test_dual20.cairo index d8b56c5fa..6e1e5dc86 100644 --- a/src/openzeppelin/tests/token/test_dual20.cairo +++ b/src/openzeppelin/tests/token/test_dual20.cairo @@ -1,21 +1,20 @@ use array::ArrayTrait; -use starknet::ContractAddress; -use starknet::contract_address_const; -use starknet::testing::set_contract_address; - use openzeppelin::tests::mocks::camel20_mock::CamelERC20Mock; -use openzeppelin::tests::mocks::erc20_panic::SnakeERC20Panic; use openzeppelin::tests::mocks::erc20_panic::CamelERC20Panic; +use openzeppelin::tests::mocks::erc20_panic::SnakeERC20Panic; use openzeppelin::tests::mocks::non_implementing_mock::NonImplementingMock; use openzeppelin::tests::mocks::snake20_mock::SnakeERC20Mock; +use openzeppelin::tests::utils; use openzeppelin::token::erc20::dual20::DualERC20; use openzeppelin::token::erc20::dual20::DualERC20Trait; use openzeppelin::token::erc20::interface::IERC20CamelDispatcher; use openzeppelin::token::erc20::interface::IERC20CamelDispatcherTrait; use openzeppelin::token::erc20::interface::IERC20Dispatcher; use openzeppelin::token::erc20::interface::IERC20DispatcherTrait; -use openzeppelin::tests::utils; use openzeppelin::utils::serde::SerializedAppend; +use starknet::ContractAddress; +use starknet::contract_address_const; +use starknet::testing::set_contract_address; // // Constants diff --git a/src/openzeppelin/tests/token/test_dual721.cairo b/src/openzeppelin/tests/token/test_dual721.cairo index dfaa53bad..f1ccd8682 100644 --- a/src/openzeppelin/tests/token/test_dual721.cairo +++ b/src/openzeppelin/tests/token/test_dual721.cairo @@ -1,25 +1,25 @@ use array::ArrayTrait; -use starknet::ContractAddress; -use starknet::contract_address_const; -use starknet::testing::set_caller_address; -use starknet::testing::set_contract_address; -use openzeppelin::token::erc721::interface::IERC721_ID; -use openzeppelin::token::erc721::interface::IERC721Dispatcher; -use openzeppelin::token::erc721::interface::IERC721CamelOnlyDispatcher; -use openzeppelin::token::erc721::interface::IERC721DispatcherTrait; -use openzeppelin::token::erc721::interface::IERC721CamelOnlyDispatcherTrait; -use openzeppelin::token::erc721::dual721::DualCaseERC721Trait; -use openzeppelin::token::erc721::dual721::DualCaseERC721; -use openzeppelin::tests::mocks::snake721_mock::SnakeERC721Mock; use openzeppelin::tests::mocks::camel721_mock::CamelERC721Mock; +use openzeppelin::tests::mocks::erc721_panic_mock::CamelERC721PanicMock; +use openzeppelin::tests::mocks::erc721_panic_mock::SnakeERC721PanicMock; use openzeppelin::tests::mocks::erc721_receiver::ERC721Receiver; -use openzeppelin::tests::mocks::erc721_receiver::SUCCESS; use openzeppelin::tests::mocks::erc721_receiver::FAILURE; -use openzeppelin::tests::mocks::erc721_panic_mock::SnakeERC721PanicMock; -use openzeppelin::tests::mocks::erc721_panic_mock::CamelERC721PanicMock; +use openzeppelin::tests::mocks::erc721_receiver::SUCCESS; use openzeppelin::tests::mocks::non_implementing_mock::NonImplementingMock; +use openzeppelin::tests::mocks::snake721_mock::SnakeERC721Mock; use openzeppelin::tests::utils; +use openzeppelin::token::erc721::dual721::DualCaseERC721; +use openzeppelin::token::erc721::dual721::DualCaseERC721Trait; +use openzeppelin::token::erc721::interface::IERC721CamelOnlyDispatcher; +use openzeppelin::token::erc721::interface::IERC721CamelOnlyDispatcherTrait; +use openzeppelin::token::erc721::interface::IERC721Dispatcher; +use openzeppelin::token::erc721::interface::IERC721DispatcherTrait; +use openzeppelin::token::erc721::interface::IERC721_ID; use openzeppelin::utils::serde::SerializedAppend; +use starknet::ContractAddress; +use starknet::contract_address_const; +use starknet::testing::set_caller_address; +use starknet::testing::set_contract_address; // // Constants diff --git a/src/openzeppelin/tests/token/test_dual721_receiver.cairo b/src/openzeppelin/tests/token/test_dual721_receiver.cairo index a3197dddc..d154ee769 100644 --- a/src/openzeppelin/tests/token/test_dual721_receiver.cairo +++ b/src/openzeppelin/tests/token/test_dual721_receiver.cairo @@ -1,21 +1,21 @@ use array::ArrayTrait; -use starknet::ContractAddress; -use starknet::contract_address_const; -use openzeppelin::tests::mocks::erc721_receiver::SUCCESS; -use openzeppelin::tests::mocks::erc721_receiver::FAILURE; -use openzeppelin::token::erc721::interface::IERC721_RECEIVER_ID; -use openzeppelin::token::erc721::interface::IERC721ReceiverDispatcher; -use openzeppelin::token::erc721::interface::IERC721ReceiverCamelDispatcher; -use openzeppelin::token::erc721::interface::IERC721ReceiverDispatcherTrait; -use openzeppelin::token::erc721::interface::IERC721ReceiverCamelDispatcherTrait; -use openzeppelin::token::erc721::dual721_receiver::DualCaseERC721ReceiverTrait; -use openzeppelin::token::erc721::dual721_receiver::DualCaseERC721Receiver; -use openzeppelin::tests::mocks::dual721_receiver_mocks::SnakeERC721ReceiverMock; use openzeppelin::tests::mocks::dual721_receiver_mocks::CamelERC721ReceiverMock; -use openzeppelin::tests::mocks::dual721_receiver_mocks::SnakeERC721ReceiverPanicMock; use openzeppelin::tests::mocks::dual721_receiver_mocks::CamelERC721ReceiverPanicMock; +use openzeppelin::tests::mocks::dual721_receiver_mocks::SnakeERC721ReceiverMock; +use openzeppelin::tests::mocks::dual721_receiver_mocks::SnakeERC721ReceiverPanicMock; +use openzeppelin::tests::mocks::erc721_receiver::FAILURE; +use openzeppelin::tests::mocks::erc721_receiver::SUCCESS; use openzeppelin::tests::mocks::non_implementing_mock::NonImplementingMock; use openzeppelin::tests::utils; +use openzeppelin::token::erc721::dual721_receiver::DualCaseERC721Receiver; +use openzeppelin::token::erc721::dual721_receiver::DualCaseERC721ReceiverTrait; +use openzeppelin::token::erc721::interface::IERC721ReceiverCamelDispatcher; +use openzeppelin::token::erc721::interface::IERC721ReceiverCamelDispatcherTrait; +use openzeppelin::token::erc721::interface::IERC721ReceiverDispatcher; +use openzeppelin::token::erc721::interface::IERC721ReceiverDispatcherTrait; +use openzeppelin::token::erc721::interface::IERC721_RECEIVER_ID; +use starknet::ContractAddress; +use starknet::contract_address_const; // // Constants diff --git a/src/openzeppelin/tests/token/test_erc20.cairo b/src/openzeppelin/tests/token/test_erc20.cairo index 55945c0e2..1303c3e1c 100644 --- a/src/openzeppelin/tests/token/test_erc20.cairo +++ b/src/openzeppelin/tests/token/test_erc20.cairo @@ -1,17 +1,16 @@ use integer::BoundedInt; use integer::u256; use integer::u256_from_felt252; +use openzeppelin::token::erc20::ERC20::ERC20CamelOnlyImpl; +use openzeppelin::token::erc20::ERC20::ERC20Impl; +use openzeppelin::token::erc20::ERC20::InternalImpl; +use openzeppelin::token::erc20::ERC20; use starknet::ContractAddress; use starknet::contract_address_const; use starknet::testing::set_caller_address; use traits::Into; use zeroable::Zeroable; -use openzeppelin::token::erc20::ERC20; -use openzeppelin::token::erc20::ERC20::ERC20CamelOnlyImpl; -use openzeppelin::token::erc20::ERC20::ERC20Impl; -use openzeppelin::token::erc20::ERC20::InternalImpl; - // // Constants // diff --git a/src/openzeppelin/tests/token/test_erc721.cairo b/src/openzeppelin/tests/token/test_erc721.cairo index 5c7fdc4f9..45bd6c39e 100644 --- a/src/openzeppelin/tests/token/test_erc721.cairo +++ b/src/openzeppelin/tests/token/test_erc721.cairo @@ -1,17 +1,19 @@ -use starknet::contract_address_const; -use starknet::ContractAddress; -use starknet::testing::set_caller_address; +use ERC721::_owners::InternalContractStateTrait as OwnersTrait; +use ERC721::_token_approvals::InternalContractStateTrait as TokenApprovalsTrait; +use array::ArrayTrait; use integer::u256; use integer::u256_from_felt252; -use array::ArrayTrait; -use traits::Into; -use zeroable::Zeroable; use openzeppelin::account::Account; -use openzeppelin::introspection; use openzeppelin::introspection::src5; -use openzeppelin::token::erc721; -use openzeppelin::token::erc721::ERC721; +use openzeppelin::introspection; +use openzeppelin::tests::mocks::camel_account_mock::CamelAccountMock; +use openzeppelin::tests::mocks::dual721_receiver_mocks::CamelERC721ReceiverMock; +use openzeppelin::tests::mocks::erc721_receiver::ERC721Receiver; +use openzeppelin::tests::mocks::erc721_receiver::FAILURE; +use openzeppelin::tests::mocks::erc721_receiver::SUCCESS; +use openzeppelin::tests::mocks::non_implementing_mock::NonImplementingMock; +use openzeppelin::tests::utils; use openzeppelin::token::erc721::ERC721::ERC721CamelOnlyImpl; use openzeppelin::token::erc721::ERC721::ERC721Impl; use openzeppelin::token::erc721::ERC721::ERC721MetadataCamelOnlyImpl; @@ -19,16 +21,13 @@ use openzeppelin::token::erc721::ERC721::ERC721MetadataImpl; use openzeppelin::token::erc721::ERC721::InternalImpl; use openzeppelin::token::erc721::ERC721::SRC5CamelImpl; use openzeppelin::token::erc721::ERC721::SRC5Impl; -use openzeppelin::tests::mocks::camel_account_mock::CamelAccountMock; -use openzeppelin::tests::mocks::dual721_receiver_mocks::CamelERC721ReceiverMock; -use openzeppelin::tests::mocks::erc721_receiver::ERC721Receiver; -use openzeppelin::tests::mocks::erc721_receiver::SUCCESS; -use openzeppelin::tests::mocks::erc721_receiver::FAILURE; -use openzeppelin::tests::mocks::non_implementing_mock::NonImplementingMock; -use openzeppelin::tests::utils; - -use ERC721::_owners::InternalContractStateTrait as OwnersTrait; -use ERC721::_token_approvals::InternalContractStateTrait as TokenApprovalsTrait; +use openzeppelin::token::erc721::ERC721; +use openzeppelin::token::erc721; +use starknet::ContractAddress; +use starknet::contract_address_const; +use starknet::testing::set_caller_address; +use traits::Into; +use zeroable::Zeroable; const NAME: felt252 = 111; const SYMBOL: felt252 = 222; diff --git a/src/openzeppelin/tests/utils.cairo b/src/openzeppelin/tests/utils.cairo index d3b720cce..5eb3d1001 100644 --- a/src/openzeppelin/tests/utils.cairo +++ b/src/openzeppelin/tests/utils.cairo @@ -1,8 +1,8 @@ use array::ArrayTrait; use core::result::ResultTrait; use option::OptionTrait; -use starknet::class_hash::Felt252TryIntoClassHash; use starknet::ContractAddress; +use starknet::class_hash::Felt252TryIntoClassHash; use traits::TryInto; fn deploy(contract_class_hash: felt252, calldata: Array) -> ContractAddress { diff --git a/src/openzeppelin/token/erc20.cairo b/src/openzeppelin/token/erc20.cairo index 6784045a0..736230aca 100644 --- a/src/openzeppelin/token/erc20.cairo +++ b/src/openzeppelin/token/erc20.cairo @@ -1,5 +1,5 @@ -mod erc20; mod dual20; +mod erc20; mod interface; use erc20::ERC20; diff --git a/src/openzeppelin/token/erc20/dual20.cairo b/src/openzeppelin/token/erc20/dual20.cairo index 848f53363..446a8f434 100644 --- a/src/openzeppelin/token/erc20/dual20.cairo +++ b/src/openzeppelin/token/erc20/dual20.cairo @@ -1,12 +1,11 @@ use array::ArrayTrait; -use starknet::call_contract_syscall; -use starknet::ContractAddress; -use starknet::SyscallResultTrait; - -use openzeppelin::utils::try_selector_with_fallback; +use openzeppelin::utils::UnwrapAndCast; use openzeppelin::utils::selectors; use openzeppelin::utils::serde::SerializedAppend; -use openzeppelin::utils::UnwrapAndCast; +use openzeppelin::utils::try_selector_with_fallback; +use starknet::ContractAddress; +use starknet::SyscallResultTrait; +use starknet::call_contract_syscall; #[derive(Copy, Drop)] struct DualERC20 { diff --git a/src/openzeppelin/token/erc20/erc20.cairo b/src/openzeppelin/token/erc20/erc20.cairo index f83a965a8..906759e93 100644 --- a/src/openzeppelin/token/erc20/erc20.cairo +++ b/src/openzeppelin/token/erc20/erc20.cairo @@ -1,13 +1,12 @@ #[starknet::contract] mod ERC20 { use integer::BoundedInt; + use openzeppelin::token::erc20::interface::IERC20; + use openzeppelin::token::erc20::interface::IERC20CamelOnly; use starknet::ContractAddress; use starknet::get_caller_address; use zeroable::Zeroable; - use openzeppelin::token::erc20::interface::IERC20; - use openzeppelin::token::erc20::interface::IERC20CamelOnly; - #[storage] struct Storage { _name: felt252, diff --git a/src/openzeppelin/token/erc721/dual721.cairo b/src/openzeppelin/token/erc721/dual721.cairo index 55655d9c7..104c5711d 100644 --- a/src/openzeppelin/token/erc721/dual721.cairo +++ b/src/openzeppelin/token/erc721/dual721.cairo @@ -1,11 +1,11 @@ use array::ArrayTrait; +use openzeppelin::utils::UnwrapAndCast; +use openzeppelin::utils::selectors; +use openzeppelin::utils::serde::SerializedAppend; +use openzeppelin::utils::try_selector_with_fallback; use starknet::ContractAddress; use starknet::SyscallResultTrait; use starknet::call_contract_syscall; -use openzeppelin::utils::try_selector_with_fallback; -use openzeppelin::utils::selectors; -use openzeppelin::utils::UnwrapAndCast; -use openzeppelin::utils::serde::SerializedAppend; #[derive(Copy, Drop)] struct DualCaseERC721 { diff --git a/src/openzeppelin/token/erc721/dual721_receiver.cairo b/src/openzeppelin/token/erc721/dual721_receiver.cairo index 6c13fc931..93b166757 100644 --- a/src/openzeppelin/token/erc721/dual721_receiver.cairo +++ b/src/openzeppelin/token/erc721/dual721_receiver.cairo @@ -1,10 +1,10 @@ use array::ArrayTrait; -use starknet::ContractAddress; -use starknet::SyscallResultTrait; -use openzeppelin::utils::try_selector_with_fallback; +use openzeppelin::utils::UnwrapAndCast; use openzeppelin::utils::selectors; use openzeppelin::utils::serde::SerializedAppend; -use openzeppelin::utils::UnwrapAndCast; +use openzeppelin::utils::try_selector_with_fallback; +use starknet::ContractAddress; +use starknet::SyscallResultTrait; #[derive(Copy, Drop)] struct DualCaseERC721Receiver { diff --git a/src/openzeppelin/token/erc721/erc721.cairo b/src/openzeppelin/token/erc721/erc721.cairo index 4e2a1bb80..e1f7c0366 100644 --- a/src/openzeppelin/token/erc721/erc721.cairo +++ b/src/openzeppelin/token/erc721/erc721.cairo @@ -3,11 +3,6 @@ use starknet::ContractAddress; #[starknet::contract] mod ERC721 { use array::SpanTrait; - use option::OptionTrait; - use starknet::ContractAddress; - use starknet::get_caller_address; - use zeroable::Zeroable; - use openzeppelin::account; use openzeppelin::introspection::dual_src5::DualCaseSRC5; use openzeppelin::introspection::dual_src5::DualCaseSRC5Trait; @@ -17,6 +12,10 @@ mod ERC721 { use openzeppelin::token::erc721::dual721_receiver::DualCaseERC721Receiver; use openzeppelin::token::erc721::dual721_receiver::DualCaseERC721ReceiverTrait; use openzeppelin::token::erc721::interface; + use option::OptionTrait; + use starknet::ContractAddress; + use starknet::get_caller_address; + use zeroable::Zeroable; #[storage] struct Storage { diff --git a/src/openzeppelin/token/erc721/interface.cairo b/src/openzeppelin/token/erc721/interface.cairo index 5e22d6f07..3f58b9a20 100644 --- a/src/openzeppelin/token/erc721/interface.cairo +++ b/src/openzeppelin/token/erc721/interface.cairo @@ -1,5 +1,5 @@ -use starknet::ContractAddress; use array::SpanTrait; +use starknet::ContractAddress; const IERC721_ID: felt252 = 0x33eb2f84c309543403fd69f0d0f363781ef06ef6faeb0131ff16ea3175bd943; const IERC721_METADATA_ID: felt252 = diff --git a/src/openzeppelin/utils.cairo b/src/openzeppelin/utils.cairo index e8d356c77..6e2d2c0d2 100644 --- a/src/openzeppelin/utils.cairo +++ b/src/openzeppelin/utils.cairo @@ -7,10 +7,10 @@ use array::ArrayTrait; use array::SpanTrait; use box::BoxTrait; use option::OptionTrait; -use starknet::call_contract_syscall; use starknet::ContractAddress; use starknet::SyscallResult; use starknet::SyscallResultTrait; +use starknet::call_contract_syscall; use unwrap_and_cast::UnwrapAndCast; fn try_selector_with_fallback( diff --git a/src/openzeppelin/utils/unwrap_and_cast.cairo b/src/openzeppelin/utils/unwrap_and_cast.cairo index 0e3959664..327ed24bd 100644 --- a/src/openzeppelin/utils/unwrap_and_cast.cairo +++ b/src/openzeppelin/utils/unwrap_and_cast.cairo @@ -1,4 +1,6 @@ use array::SpanTrait; + +use openzeppelin::utils::Felt252TryIntoBool; use option::OptionTrait; use starknet::ContractAddress; use starknet::Felt252TryIntoContractAddress; @@ -6,8 +8,6 @@ use starknet::SyscallResult; use starknet::SyscallResultTrait; use traits::TryInto; -use openzeppelin::utils::Felt252TryIntoBool; - trait UnwrapAndCast { fn unwrap_and_cast(self: SyscallResult>) -> T; }