Skip to content

Commit

Permalink
⚰️ remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
tekkac committed Oct 3, 2024
1 parent 54c3f69 commit fafd19c
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 65 deletions.
2 changes: 1 addition & 1 deletion Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version = "0.1.0"
starknet = ">=2.6.0"
alexandria_storage = { git = "https://github.com/keep-starknet-strange/alexandria", tag = "cairo-v2.6.0" }
alexandria_numeric = { git = "https://github.com/keep-starknet-strange/alexandria", tag = "cairo-v2.6.0" }
alexandria_merkle_tree = { git = "https://github.com/keep-starknet-strange/alexandria.git", tag="cairo-v2.6.0" }
alexandria_merkle_tree = { git = "https://github.com/keep-starknet-strange/alexandria.git", tag = "cairo-v2.6.0" }
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.10.0" }
erc4906 = { git = "https://github.com/carbonable-labs/cairo-erc-4906" }

Expand Down
5 changes: 0 additions & 5 deletions src/components/minter/booking.cairo
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
// Core imports

use traits::{Into, TryInto, PartialEq};
use option::OptionTrait;
use debug::PrintTrait;

#[derive(Drop, Copy)]
enum BookingStatus {
Unknown: (),
Expand Down Expand Up @@ -56,7 +52,6 @@ impl BookingStatusIntoU8 of Into<BookingStatus, u8> {

impl U8TryIntoBookingStatus of TryInto<u8, BookingStatus> {
fn try_into(self: u8) -> Option<BookingStatus> {
self.print();
if self == 0 {
return Option::Some(BookingStatus::Unknown);
} else if self == 1 {
Expand Down
2 changes: 1 addition & 1 deletion src/components/minter/mint.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod MintComponent {

use openzeppelin::token::erc20::interface::ERC20ABIDispatcherTrait;
use starknet::ContractAddress;
use starknet::{get_caller_address, get_contract_address, get_block_timestamp};
use starknet::{get_caller_address, get_contract_address};

// External imports
use openzeppelin::token::erc20::interface::{IERC20Dispatcher, IERC20DispatcherTrait};
Expand Down
4 changes: 1 addition & 3 deletions src/components/offsetter/offset_handler.cairo
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#[starknet::component]
mod OffsetComponent {
// Core imports

use core::hash::LegacyHash;
use hash::HashStateTrait;
use poseidon::PoseidonTrait;


// Starknet imports

Expand Down
4 changes: 0 additions & 4 deletions src/components/resale/resale_handler.cairo
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#[starknet::component]
mod ResaleComponent {
// Core imports

use core::option::OptionTrait;
use core::num::traits::zero::Zero;
use core::hash::LegacyHash;
use hash::HashStateTrait;

// Starknet imports

Expand Down
10 changes: 5 additions & 5 deletions src/components/vintage/vintage.cairo
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#[starknet::component]
mod VintageComponent {
// Starknet imports
use starknet::{get_block_timestamp, get_caller_address};
use starknet::get_caller_address;

// Internal imports
use carbon_v3::components::vintage::interface::IVintage;
use carbon_v3::models::carbon_vintage::{CarbonVintage, CarbonVintageType};

// Constants
use carbon_v3::models::constants::{CC_DECIMALS};
use carbon_v3::models::constants::CC_DECIMALS;
use carbon_v3::contracts::project::Project::OWNER_ROLE;

// Roles
Expand Down Expand Up @@ -71,8 +71,8 @@ mod VintageComponent {
}

mod Errors {
const INVALID_ARRAY_LENGTH: felt252 = 'Absorber: invalid array length';
const INVALID_STARTING_YEAR: felt252 = 'Absorber: invalid starting year';
const INVALID_ARRAY_LENGTH: felt252 = 'Vintage: invalid array length';
const INVALID_STARTING_YEAR: felt252 = 'Vintage: invalid starting year';
}

#[embeddable_as(VintageImpl)]
Expand Down Expand Up @@ -200,7 +200,7 @@ mod VintageComponent {
) {
self.assert_only_role(OWNER_ROLE);

assert(yearly_absorptions.len() > 0, 'Vintages length is 0');
assert(yearly_absorptions.len() > 0, Errors::INVALID_ARRAY_LENGTH);
let vintages_num = yearly_absorptions.len();

// [Effect] Update storage
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/minter.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use starknet::ContractAddress;

#[starknet::contract]
mod Minter {
use starknet::{get_caller_address, ContractAddress, ClassHash};
use starknet::ContractAddress;

// Ownable
use openzeppelin::access::ownable::OwnableComponent;
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/offsetter.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use starknet::ContractAddress;

#[starknet::contract]
mod Offsetter {
use starknet::{ContractAddress, ClassHash};
use starknet::ContractAddress;

// Constants
const OWNER_ROLE: felt252 = selector!("Owner");
Expand Down
10 changes: 3 additions & 7 deletions src/contracts/project.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ trait IExternal<TContractState> {

#[starknet::contract]
mod Project {
use core::starknet::event::EventEmitter;
use carbon_v3::components::vintage::interface::IVintageDispatcher;
use starknet::{get_caller_address, get_contract_address, ContractAddress, ClassHash};
use starknet::{get_caller_address, ContractAddress, ClassHash};

// Ownable
use openzeppelin::access::ownable::OwnableComponent;
Expand Down Expand Up @@ -110,10 +109,6 @@ mod Project {

// ERC1155
impl ERC1155Impl = ERC1155Component::ERC1155Impl<ContractState>;
// #[abi(embed_v0)]
// impl ERC1155MetadataURIImpl =
// ERC1155Component::ERC1155MetadataURIImpl<ContractState>;
impl ERC1155Camel = ERC1155Component::ERC1155CamelImpl<ContractState>;
#[abi(embed_v0)]
impl OwnableImpl = OwnableComponent::OwnableImpl<ContractState>;
#[abi(embed_v0)]
Expand All @@ -139,9 +134,10 @@ mod Project {
impl ERC4906InternalImpl = ERC4906Component::ERC4906HelperInternal<ContractState>;

// Constants
use carbon_v3::models::constants::CC_DECIMALS_MULTIPLIER;

const IERC165_BACKWARD_COMPATIBLE_ID: felt252 = 0x80ac58cd;
const OLD_IERC1155_ID: felt252 = 0xd9b67a26;
use carbon_v3::models::constants::CC_DECIMALS_MULTIPLIER;
const MINTER_ROLE: felt252 = selector!("Minter");
const OFFSETTER_ROLE: felt252 = selector!("Offsetter");
const OWNER_ROLE: felt252 = selector!("Owner");
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/resale.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use starknet::ContractAddress;

#[starknet::contract]
mod Resale {
use starknet::{ContractAddress, ClassHash};
use starknet::ContractAddress;

// Constants
const OWNER_ROLE: felt252 = selector!("Owner");
Expand Down
1 change: 0 additions & 1 deletion src/mock/metadata.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#[starknet::contract]
mod TestContract {
use starknet::ContractAddress;
use carbon_v3::components::metadata::{MetadataComponent, IMetadataHandler};

component!(path: MetadataComponent, storage: metadata_uri, event: MetadataEvent);
Expand Down
1 change: 0 additions & 1 deletion src/mock/usdcarb.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ mod USDCarb {

#[abi(embed_v0)]
impl ERC20MetadataImpl of IERC20Metadata<ContractState> {
/// Returns the name of the token.
fn name(self: @ContractState) -> ByteArray {
self.erc20.ERC20_name.read()
}
Expand Down
5 changes: 2 additions & 3 deletions tests/test_merkle_tree.cairo
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use starknet::{ContractAddress, contract_address_const};
use snforge_std as snf;
use snforge_std::{
ContractClassTrait, test_address, spy_events, EventSpy, start_cheat_caller_address,
stop_cheat_caller_address, EventSpyAssertionsTrait
ContractClassTrait, spy_events, EventSpy, start_cheat_caller_address, stop_cheat_caller_address,
EventSpyAssertionsTrait
};

// Contracts
use carbon_v3::models::carbon_vintage::{CarbonVintage, CarbonVintageType};
use carbon_v3::components::offsetter::interface::{
IOffsetHandlerDispatcher, IOffsetHandlerDispatcherTrait
};
Expand Down
12 changes: 2 additions & 10 deletions tests/test_mint.cairo
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
use openzeppelin::token::erc20::interface::ERC20ABIDispatcherTrait;
use snforge_std::cheatcodes::events::EventSpyAssertionsTrait;

// Starknet deps

use starknet::{ContractAddress, contract_address_const};

// External deps

use openzeppelin::utils::serde::SerializedAppend;
use openzeppelin::token::erc20::interface::{IERC20Dispatcher, IERC20DispatcherTrait};
use openzeppelin::token::erc20::interface::ERC20ABIDispatcherTrait;
use openzeppelin::token::erc1155::ERC1155Component;

use snforge_std as snf;
use snforge_std::{
ContractClassTrait, test_address, spy_events, EventSpy, CheatSpan, start_cheat_caller_address,
stop_cheat_caller_address
stop_cheat_caller_address, EventSpyAssertionsTrait
};

// Components

use carbon_v3::components::vintage::interface::{IVintageDispatcher, IVintageDispatcherTrait};
use carbon_v3::components::vintage::VintageComponent;
use carbon_v3::components::vintage::VintageComponent::{Event};
use carbon_v3::models::carbon_vintage::{CarbonVintage, CarbonVintageType};


use carbon_v3::components::minter::interface::{IMintDispatcher, IMintDispatcherTrait};
use carbon_v3::components::minter::MintComponent;

Expand Down Expand Up @@ -182,7 +175,6 @@ fn test_redeem_without_cancel() {
let project = IProjectDispatcher { contract_address: project_address };
let vintage = IVintageDispatcher { contract_address: project_address };
let minter = IMintDispatcher { contract_address: minter_address };
let erc20 = IERC20Dispatcher { contract_address: erc20_address };
start_cheat_caller_address(project_address, owner_address);
project.grant_minter_role(minter_address);

Expand Down
10 changes: 1 addition & 9 deletions tests/test_offsetter.cairo
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
// Core deps

use hash::HashStateTrait;
use pedersen::PedersenTrait;

// Starknet deps

use starknet::{ContractAddress, contract_address_const};
use starknet::{deploy_syscall, get_block_timestamp};
use starknet::testing::{set_caller_address, set_contract_address};

// External deps

Expand All @@ -23,8 +16,7 @@ use snforge_std::cheatcodes::events::{EventsFilterTrait, EventSpyTrait, EventSpy
// Components

use carbon_v3::components::vintage::interface::{IVintageDispatcher, IVintageDispatcherTrait};
use carbon_v3::components::vintage::vintage::VintageComponent::Event;
use carbon_v3::models::carbon_vintage::{CarbonVintage, CarbonVintageType};
use carbon_v3::models::carbon_vintage::CarbonVintageType;
use carbon_v3::components::vintage::VintageComponent;
use carbon_v3::components::erc1155::interface::{IERC1155Dispatcher, IERC1155DispatcherTrait};
use carbon_v3::components::offsetter::interface::{
Expand Down
9 changes: 3 additions & 6 deletions tests/test_project.cairo
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
use snforge_std::cheatcodes::events::EventsFilterTrait;
use snforge_std::cheatcodes::events::EventSpyTrait;
use snforge_std::cheatcodes::events::EventSpyAssertionsTrait;
// Starknet deps

use starknet::{ContractAddress, contract_address_const, get_caller_address, ClassHash};
use starknet::{ContractAddress, contract_address_const, get_caller_address};

// External deps

use openzeppelin::utils::serde::SerializedAppend;
use openzeppelin::token::erc1155::ERC1155Component;
use snforge_std as snf;
use snforge_std::{
ContractClassTrait, EventSpy, start_cheat_caller_address, stop_cheat_caller_address, spy_events
ContractClassTrait, EventSpy, start_cheat_caller_address, stop_cheat_caller_address, spy_events,
cheatcodes::events::{EventSpyAssertionsTrait, EventSpyTrait, EventsFilterTrait}
};

// Models
Expand Down
3 changes: 1 addition & 2 deletions tests/test_resale.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ use snforge_std::cheatcodes::events::{EventsFilterTrait, EventSpyTrait, EventSpy
// Components

use carbon_v3::components::vintage::interface::{IVintageDispatcher, IVintageDispatcherTrait};
use carbon_v3::components::vintage::vintage::VintageComponent::{Event};
use carbon_v3::models::carbon_vintage::{CarbonVintage, CarbonVintageType};
use carbon_v3::models::carbon_vintage::CarbonVintageType;
use carbon_v3::components::vintage::VintageComponent;
use carbon_v3::components::erc1155::interface::{IERC1155Dispatcher, IERC1155DispatcherTrait};
use carbon_v3::components::resale::interface::{
Expand Down
3 changes: 0 additions & 3 deletions tests/test_vintage.cairo
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// Starknet deps

use starknet::{ContractAddress, contract_address_const};
use starknet::get_block_timestamp;

// External deps

use openzeppelin::utils::serde::SerializedAppend;
use openzeppelin::token::erc20::interface::{IERC20Dispatcher, IERC20DispatcherTrait};
use snforge_std as snf;
use snforge_std::{
Expand All @@ -16,7 +14,6 @@ use snforge_std::{
// Components

use carbon_v3::components::vintage::interface::{IVintageDispatcher, IVintageDispatcherTrait};
use carbon_v3::components::vintage::VintageComponent::{Event};
use carbon_v3::models::carbon_vintage::{CarbonVintage, CarbonVintageType};
use carbon_v3::components::vintage::VintageComponent;

Expand Down
1 change: 0 additions & 1 deletion tests/tests_lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use starknet::{ContractAddress, contract_address_const};

// External deps

use openzeppelin::utils::serde::SerializedAppend;
use snforge_std as snf;
use snforge_std::{
ContractClassTrait, EventSpy, spy_events, EventSpyTrait, EventSpyAssertionsTrait,
Expand Down

0 comments on commit fafd19c

Please sign in to comment.