Skip to content

Commit

Permalink
Remove useless imports (#530)
Browse files Browse the repository at this point in the history
* remove useless space imports

* remove useless authenticators imports

* remove useless execution strategies imports

* remove useless ownable imports

* remove useless factory imports

* remove useless interfaces imports

* remove useless proposal validation strategies imports

* remove useless types imports

* remove useless utils imports

* remove useless voting strategies imports

* remove useless tests imports

* format
  • Loading branch information
pscott authored Sep 1, 2023
1 parent 1c97753 commit 5a697e5
Show file tree
Hide file tree
Showing 38 changed files with 19 additions and 147 deletions.
3 changes: 0 additions & 3 deletions starknet/src/authenticators/eth_sig.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,11 @@ trait IEthSigAuthenticator<TContractState> {
mod EthSigAuthenticator {
use super::IEthSigAuthenticator;
use starknet::{ContractAddress, EthAddress, syscalls::call_contract_syscall};
use core::array::{ArrayTrait, SpanTrait};
use clone::Clone;
use sx::{
space::space::{ISpaceDispatcher, ISpaceDispatcherTrait},
types::{Strategy, IndexedStrategy, Choice, UserAddress},
utils::{signatures, legacy_hash::{LegacyHashEthAddress, LegacyHashUsedSalts}}
};
use hash::LegacyHash;


#[storage]
Expand Down
4 changes: 0 additions & 4 deletions starknet/src/authenticators/eth_tx.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ trait IEthTxAuthenticator<TContractState> {
mod EthTxAuthenticator {
use super::IEthTxAuthenticator;
use starknet::{ContractAddress, EthAddress, Felt252TryIntoEthAddress, EthAddressIntoFelt252,};
use core::{serde::Serde, array::{ArrayTrait, SpanTrait}};
use traits::{PartialEq, TryInto, Into};
use option::OptionTrait;
use zeroable::Zeroable;
use sx::{
space::space::{ISpaceDispatcher, ISpaceDispatcherTrait},
types::{UserAddress, Strategy, IndexedStrategy, Choice},
Expand Down
2 changes: 0 additions & 2 deletions starknet/src/authenticators/stark_sig.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ trait IStarkSigAuthenticator<TContractState> {
mod StarkSigAuthenticator {
use super::IStarkSigAuthenticator;
use starknet::{ContractAddress, info};
use core::array::{ArrayTrait, SpanTrait};
use serde::Serde;
use sx::{
space::space::{ISpaceDispatcher, ISpaceDispatcherTrait},
types::{Strategy, IndexedStrategy, UserAddress, Choice}, utils::stark_eip712
Expand Down
1 change: 0 additions & 1 deletion starknet/src/authenticators/stark_tx.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ trait IStarkTxAuthenticator<TContractState> {
mod StarkTxAuthenticator {
use super::IStarkTxAuthenticator;
use starknet::{ContractAddress, info};
use core::array::ArrayTrait;
use sx::{
space::space::{ISpaceDispatcher, ISpaceDispatcherTrait},
types::{UserAddress, Strategy, IndexedStrategy, Choice},
Expand Down
1 change: 0 additions & 1 deletion starknet/src/authenticators/vanilla.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mod VanillaAuthenticator {
use super::IVanillaAuthenticator;
use starknet::ContractAddress;
use starknet::syscalls::call_contract_syscall;
use core::array::{ArrayTrait, SpanTrait};

#[storage]
struct Storage {}
Expand Down
3 changes: 0 additions & 3 deletions starknet/src/execution_strategies/simple_quorum.cairo
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
use core::traits::TryInto;
#[starknet::contract]
mod SimpleQuorumExecutionStrategy {
use traits::TryInto;
use option::OptionTrait;
use starknet::ContractAddress;
use starknet::get_caller_address;
use starknet::info;
use zeroable::Zeroable;
use sx::types::{Proposal, FinalizationStatus, ProposalStatus};

#[storage]
Expand Down
1 change: 0 additions & 1 deletion starknet/src/execution_strategies/vanilla.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ mod VanillaExecutionStrategy {
use sx::types::{Proposal, ProposalStatus};
use sx::execution_strategies::simple_quorum::SimpleQuorumExecutionStrategy;


#[storage]
struct Storage {
_num_executed: felt252
Expand Down
1 change: 0 additions & 1 deletion starknet/src/external/ownable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#[starknet::contract]
mod Ownable {
use starknet::{ContractAddress, get_caller_address};
use zeroable::Zeroable;

#[storage]
struct Storage {
Expand Down
2 changes: 0 additions & 2 deletions starknet/src/factory/factory.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ mod Factory {
ContractAddress, ClassHash, contract_address_const,
syscalls::{deploy_syscall, call_contract_syscall}
};
use result::ResultTrait;
use array::{ArrayTrait, SpanTrait};
use sx::utils::constants::INITIALIZE_SELECTOR;

#[event]
Expand Down
1 change: 0 additions & 1 deletion starknet/src/interfaces/i_account.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use array::{ArrayTrait, SpanTrait};
use starknet::account::Call;
use starknet::ContractAddress;

Expand Down
1 change: 0 additions & 1 deletion starknet/src/interfaces/i_execution_strategy.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use array::ArrayTrait;
use sx::types::Proposal;

#[starknet::interface]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ mod ProposingPowerProposalValidationStrategy {
utils::{bits::BitSetter, proposition_power::_validate}
};
use starknet::{ContractAddress, info};
use traits::{Into, TryInto};
use option::OptionTrait;
use result::ResultTrait;
use array::{ArrayTrait, SpanTrait};
use serde::Serde;
use box::BoxTrait;
use clone::Clone;

#[storage]
struct Storage {}
Expand Down
9 changes: 0 additions & 9 deletions starknet/src/space/space.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use core::traits::TryInto;
use core::traits::Destruct;
use starknet::{ClassHash, ContractAddress};
use sx::types::{UserAddress, Strategy, Proposal, IndexedStrategy, Choice, UpdateSettingsCalldata};

Expand Down Expand Up @@ -79,12 +77,6 @@ mod Space {
storage_access::{StorePacking, StoreUsingPacking}, ClassHash, ContractAddress, info, Store,
syscalls
};
use zeroable::Zeroable;
use array::{ArrayTrait, SpanTrait};
use clone::Clone;
use option::OptionTrait;
use hash::LegacyHash;
use traits::{Into, TryInto};
use sx::{
interfaces::{
IProposalValidationStrategyDispatcher, IProposalValidationStrategyDispatcherTrait,
Expand All @@ -105,7 +97,6 @@ mod Space {
},
external::ownable::Ownable
};
use hash::{HashStateTrait, Hash, HashStateExTrait};


#[storage]
Expand Down
3 changes: 0 additions & 3 deletions starknet/src/tests/mocks/executor.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ mod ExecutorExecutionStrategy {
use sx::interfaces::IExecutionStrategy;
use sx::types::{Proposal, ProposalStatus};
use starknet::ContractAddress;
use core::serde::Serde;
use core::array::ArrayTrait;
use option::OptionTrait;
use starknet::syscalls::call_contract_syscall;

#[storage]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
#[cfg(test)]
mod tests {
use starknet::syscalls::deploy_syscall;
use traits::{TryInto};
use starknet::SyscallResult;
use array::{ArrayTrait, SpanTrait};
use result::ResultTrait;
use option::OptionTrait;
use sx::voting_strategies::vanilla::{VanillaVotingStrategy};
use sx::voting_strategies::merkle_whitelist::{MerkleWhitelistVotingStrategy};
use sx::utils::merkle::Leaf;
use sx::proposal_validation_strategies::proposing_power::{
ProposingPowerProposalValidationStrategy
};
use sx::interfaces::{
IProposalValidationStrategy, IProposalValidationStrategyDispatcher,
IProposalValidationStrategyDispatcherTrait
};
use sx::types::{IndexedStrategy, Strategy, UserAddress};
use serde::Serde;
use starknet::contract_address_const;
use clone::Clone;
use sx::tests::test_merkle_whitelist::merkle_utils::{
generate_merkle_data, generate_merkle_root, generate_proof
use starknet::ContractAddress;
use sx::{
voting_strategies::{
vanilla::VanillaVotingStrategy, merkle_whitelist::MerkleWhitelistVotingStrategy,
erc20_votes::ERC20VotesVotingStrategy
},
utils::{merkle::Leaf},
proposal_validation_strategies::proposing_power::{ProposingPowerProposalValidationStrategy},
interfaces::{
IProposalValidationStrategy, IProposalValidationStrategyDispatcher,
IProposalValidationStrategyDispatcherTrait
},
types::{IndexedStrategy, Strategy, UserAddress},
tests::{
test_merkle_whitelist::merkle_utils::{
generate_merkle_data, generate_merkle_root, generate_proof
},
mocks::erc20_votes_preset::ERC20VotesPreset
}
};
use sx::tests::mocks::erc20_votes_preset::{ERC20VotesPreset};
use openzeppelin::token::erc20::interface::{IERC20Dispatcher, IERC20DispatcherTrait};
use openzeppelin::governance::utils::interfaces::votes::{
IVotes, IVotesDispatcher, IVotesDispatcherTrait
};
use traits::Into;
use sx::voting_strategies::erc20_votes::ERC20VotesVotingStrategy;
use starknet::ContractAddress;

#[test]
#[available_gas(10000000000)]
Expand Down
5 changes: 0 additions & 5 deletions starknet/src/tests/setup/setup.cairo
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#[cfg(test)]
mod setup {
use array::ArrayTrait;
use starknet::{ContractAddress, contract_address_const};
use traits::{Into, TryInto};
use serde::{Serde};
use result::ResultTrait;
use option::OptionTrait;
use sx::types::Strategy;
use sx::authenticators::vanilla::{VanillaAuthenticator};
use sx::execution_strategies::vanilla::VanillaExecutionStrategy;
Expand Down
1 change: 0 additions & 1 deletion starknet/src/tests/utils/strategy_trait.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use array::ArrayTrait;
use sx::types::Strategy;
use starknet::{ContractAddress, contract_address_const};

Expand Down
5 changes: 0 additions & 5 deletions starknet/src/tests/voting_strategies/erc20_votes.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ mod tests {
use sx::tests::setup::setup::setup::{setup as _setup, deploy, Config};
use starknet::syscalls::deploy_syscall;
use starknet::SyscallResult;
use result::ResultTrait;
use option::OptionTrait;
use traits::{Into, TryInto};
use array::{ArrayTrait, SpanTrait};
use sx::interfaces::{
IVotingStrategy, IVotingStrategyDispatcher, IVotingStrategyDispatcherTrait
};
Expand All @@ -31,7 +27,6 @@ mod tests {
use sx::tests::utils::strategy_trait::StrategyImpl;
use sx::utils::constants::{PROPOSE_SELECTOR, VOTE_SELECTOR};
use sx::execution_strategies::vanilla::VanillaExecutionStrategy;
use serde::Serde;

const NAME: felt252 = 'TEST';
const SYMBOL: felt252 = 'TST';
Expand Down
4 changes: 0 additions & 4 deletions starknet/src/types/choice.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
use serde::Serde;
use traits::Into;
use hash::LegacyHash;

#[derive(Copy, Drop, Serde)]
enum Choice {
Against: (),
Expand Down
3 changes: 0 additions & 3 deletions starknet/src/types/finalization_status.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
use serde::Serde;
use array::ArrayTrait;

#[derive(Drop, Serde, PartialEq, Copy, starknet::Store)]
enum FinalizationStatus {
Pending: (),
Expand Down
5 changes: 0 additions & 5 deletions starknet/src/types/indexed_strategy.cairo
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
use core::array::SpanTrait;
use option::OptionTrait;
use serde::Serde;
use clone::Clone;
use array::ArrayTrait;
use sx::utils::math;

#[derive(Option, Clone, Drop, Serde)]
Expand Down
4 changes: 0 additions & 4 deletions starknet/src/types/proposal.cairo
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
use clone::Clone;
use serde::Serde;
use starknet::{ContractAddress, storage_access::StorePacking, Store};
use sx::{
utils::math::pow, types::{FinalizationStatus, UserAddress, user_address::UserAddressTrait}
};
use traits::{Into, TryInto};
use option::OptionTrait;

const BITMASK_32: u128 = 0xffffffff;
const BITMASK_64: u128 = 0xffffffffffffffff;
Expand Down
2 changes: 0 additions & 2 deletions starknet/src/types/proposal_status.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use serde::Serde;

#[derive(Copy, Drop, Serde, PartialEq)]
enum ProposalStatus {
VotingDelay: (),
Expand Down
6 changes: 0 additions & 6 deletions starknet/src/types/strategy.cairo
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
use starknet::ContractAddress;
use array::ArrayTrait;
use serde::Serde;
use option::OptionTrait;
use clone::Clone;
use result::ResultTrait;
use traits::TryInto;
use starknet::{StorageBaseAddress, Store, SyscallResult};

#[derive(Clone, Drop, Option, Serde, starknet::Store)]
Expand Down
2 changes: 0 additions & 2 deletions starknet/src/types/update_settings_calldata.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use array::ArrayTrait;
use clone::Clone;
use starknet::{ContractAddress, contract_address_const};
use sx::types::Strategy;

Expand Down
6 changes: 0 additions & 6 deletions starknet/src/types/user_address.cairo
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
use starknet::{ContractAddress, EthAddress};
use traits::{PartialEq, TryInto, Into};
use zeroable::Zeroable;
use serde::Serde;
use array::ArrayTrait;
use hash::{LegacyHash};

#[derive(Copy, Drop, Serde, PartialEq, starknet::Store)]
enum UserAddress {
Expand Down Expand Up @@ -79,7 +74,6 @@ impl UserAddressZeroable of Zeroable<UserAddress> {

#[cfg(test)]
mod tests {
use zeroable::Zeroable;
use super::{UserAddress, UserAddressZeroable};
use starknet::{EthAddress, contract_address_const};

Expand Down
2 changes: 0 additions & 2 deletions starknet/src/utils/bits.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use traits::{Into};
use zeroable::Zeroable;
use integer::{Bitwise, U256BitOr, U256BitNot, U128IntoFelt252, Felt252IntoU256, BoundedInt};
use sx::utils::math::pow;

Expand Down
3 changes: 0 additions & 3 deletions starknet/src/utils/felt_arr_to_uint_arr.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
use array::ArrayTrait;
use traits::Into;

impl Felt252ArrayIntoU256Array of Into<Array<felt252>, Array<u256>> {
fn into(mut self: Array<felt252>) -> Array<u256> {
let mut arr = array![];
Expand Down
2 changes: 0 additions & 2 deletions starknet/src/utils/legacy_hash.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use hash::LegacyHash;
use traits::Into;
use array::SpanTrait;
use starknet::EthAddress;
use sx::types::{Choice, UserAddress};

Expand Down
3 changes: 0 additions & 3 deletions starknet/src/utils/math.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
use zeroable::Zeroable;
use traits::Into;

impl U64Zeroable of Zeroable<u64> {
fn zero() -> u64 {
0
Expand Down
5 changes: 0 additions & 5 deletions starknet/src/utils/merkle.cairo
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
use core::traits::Into;
use array::{ArrayTrait, Span, SpanTrait};
use option::OptionTrait;
use serde::Serde;
use clone::Clone;
use hash::{LegacyHash};
use sx::{types::UserAddress, utils::legacy_hash::LegacyHashSpanFelt252};

Expand Down
7 changes: 0 additions & 7 deletions starknet/src/utils/proposition_power.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ use sx::{
types::{UserAddress, IndexedStrategy, IndexedStrategyTrait, Strategy}, utils::bits::BitSetter
};
use starknet::{ContractAddress, info};
use traits::{Into, TryInto};
use option::OptionTrait;
use result::ResultTrait;
use array::{ArrayTrait, SpanTrait};
use serde::Serde;
use box::BoxTrait;
use clone::Clone;

fn _get_cumulative_power(
voter: UserAddress,
Expand Down
4 changes: 0 additions & 4 deletions starknet/src/utils/signatures.cairo
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use starknet::{EthAddress, ContractAddress, secp256_trait, contract_address_to_felt252};
use array::{ArrayTrait, SpanTrait};
use traits::Into;
use clone::Clone;
use core::keccak;
use integer::u256_from_felt252;
use sx::{
types::{Strategy, IndexedStrategy, Choice},
Expand Down
4 changes: 0 additions & 4 deletions starknet/src/utils/stark_eip712.cairo
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
use core::starknet::SyscallResultTrait;
use starknet::{ContractAddress, get_tx_info, get_contract_address};
use array::{ArrayTrait, SpanTrait};
use traits::Into;
use box::BoxTrait;
use serde::Serde;
use sx::{
types::{Strategy, IndexedStrategy, Choice},
utils::{
Expand Down
2 changes: 0 additions & 2 deletions starknet/src/utils/struct_hash.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use array::{ArrayTrait, SpanTrait};
use hash::LegacyHash;
use serde::Serde;
use sx::{
types::{Strategy, IndexedStrategy},
utils::{
Expand Down
Loading

0 comments on commit 5a697e5

Please sign in to comment.