Skip to content

Commit

Permalink
fix all warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
0xChqrles committed Sep 9, 2024
1 parent d82d5f3 commit cb14243
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 74 deletions.
51 changes: 28 additions & 23 deletions contracts/Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ version = 1

[[package]]
name = "openzeppelin"
version = "0.15.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.15.0#f57642960f1c8cffafefb88bfff418eca8510634"
version = "0.16.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_governance",
"openzeppelin_introspection",
"openzeppelin_merkle_tree",
"openzeppelin_presets",
"openzeppelin_security",
"openzeppelin_token",
Expand All @@ -19,41 +20,45 @@ dependencies = [

[[package]]
name = "openzeppelin_access"
version = "0.15.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.15.0#f57642960f1c8cffafefb88bfff418eca8510634"
version = "0.16.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_account"
version = "0.15.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.15.0#f57642960f1c8cffafefb88bfff418eca8510634"
version = "0.16.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_token",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_governance"
version = "0.15.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.15.0#f57642960f1c8cffafefb88bfff418eca8510634"
version = "0.16.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb"
dependencies = [
"openzeppelin_access",
"openzeppelin_introspection",
]

[[package]]
name = "openzeppelin_introspection"
version = "0.15.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.15.0#f57642960f1c8cffafefb88bfff418eca8510634"
version = "0.16.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb"

[[package]]
name = "openzeppelin_merkle_tree"
version = "0.16.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb"

[[package]]
name = "openzeppelin_presets"
version = "0.15.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.15.0#f57642960f1c8cffafefb88bfff418eca8510634"
version = "0.16.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
Expand All @@ -64,13 +69,13 @@ dependencies = [

[[package]]
name = "openzeppelin_security"
version = "0.15.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.15.0#f57642960f1c8cffafefb88bfff418eca8510634"
version = "0.16.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb"

[[package]]
name = "openzeppelin_token"
version = "0.15.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.15.0#f57642960f1c8cffafefb88bfff418eca8510634"
version = "0.16.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb"
dependencies = [
"openzeppelin_account",
"openzeppelin_governance",
Expand All @@ -79,18 +84,18 @@ dependencies = [

[[package]]
name = "openzeppelin_upgrades"
version = "0.15.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.15.0#f57642960f1c8cffafefb88bfff418eca8510634"
version = "0.16.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb"

[[package]]
name = "openzeppelin_utils"
version = "0.15.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.15.0#f57642960f1c8cffafefb88bfff418eca8510634"
version = "0.16.0"
source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb"

[[package]]
name = "snforge_std"
version = "0.26.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.26.0#50eb589db65e113efe4f09241feb59b574228c7e"
version = "0.27.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.27.0#2d99b7c00678ef0363881ee0273550c44a9263de"

[[package]]
name = "zkramp"
Expand Down
15 changes: 8 additions & 7 deletions contracts/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
name = "zkramp"
version = "0.1.0"
edition = "2023_11"
cairo-version = "2.7.0"
scarb-version = "2.7.0"
cairo-version = "2.8.0"
scarb-version = "2.8.0"

[dependencies]
starknet = "2.7.0"
openzeppelin = { git = "https://github.com/openzeppelin/cairo-contracts", tag = "v0.15.0" }
starknet = "2.8.0"
openzeppelin = { git = "https://github.com/openzeppelin/cairo-contracts", tag = "v0.16.0" }

[dev-dependencies]
cairo_test = "2.7.0"
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.26.0" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" }

[tool.fmt]
max-line-length = 120
sort-module-level-items = true

[[target.starknet-contract]]
sierra = true
casm = true
build-external-contracts = ["openzeppelin::presets::ERC20Upgradeable"]
allowed-libfuncs-list.name = "audited"
build-external-contracts = ["openzeppelin_presets::erc20::ERC20Upgradeable"]

[scripts]
test = "snforge test"
3 changes: 0 additions & 3 deletions contracts/src/components/escrow/escrow_mock.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ use super::escrow::EscrowComponent;

#[starknet::contract]
pub mod EscrowMock {
use starknet::ContractAddress;
use starknet::account::Call;
use zkramp::components::escrow::escrow::EscrowComponent;
use zkramp::components::escrow::interface::IEscrow;

component!(path: EscrowComponent, storage: escrow, event: EscrowEvent);

Expand Down
3 changes: 1 addition & 2 deletions contracts/src/components/escrow/escrow_test.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use core::starknet::get_contract_address;
use openzeppelin::presets::interfaces::ERC20UpgradeableABIDispatcherTrait;

use zkramp::components::escrow::escrow::EscrowComponent::EscrowImpl;
use zkramp::components::escrow::escrow_mock::{EscrowMock, TestingStateDefault, ComponentState};
use zkramp::components::escrow::escrow_mock::{TestingStateDefault, ComponentState};

use zkramp::tests::constants;
use zkramp::tests::utils;
Expand All @@ -28,4 +28,3 @@ fn test_lock_unlock() {

assert_eq!(escrow.deposits.read((constants::OWNER(), token_dispatcher.contract_address)), 0);
}

2 changes: 0 additions & 2 deletions contracts/src/components/escrow/interface.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use core::hash::HashStateExTrait;
use starknet::ContractAddress;

#[starknet::interface]
Expand All @@ -12,4 +11,3 @@ pub trait IEscrow<TState> {
amount: u256
);
}

5 changes: 1 addition & 4 deletions contracts/src/components/processors/tls/tls.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ pub mod TLSProcessorComponent {
use core::num::traits::zero::Zero;
use openzeppelin::access::ownable::OwnableComponent;
use openzeppelin::access::ownable::ownable::OwnableComponent::InternalTrait as OwnableInternalTrait;
use starknet::{
ContractAddress, get_caller_address, get_block_timestamp,
storage::{Map, StorageMapReadAccess, StorageMapWriteAccess}
};
use starknet::{ContractAddress, get_caller_address,};
use zkramp::components::processors::tls::interface;
use zkramp::contracts::nullifier_registry::interface::{
INullifierRegistryDispatcher, INullifierRegistryDispatcherTrait
Expand Down
1 change: 0 additions & 1 deletion contracts/src/components/registry/interface.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use core::hash::HashStateExTrait;
use starknet::ContractAddress;
use zkramp::utils::hash::HashSerializable;

Expand Down
3 changes: 0 additions & 3 deletions contracts/src/components/registry/registry_mock.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ use super::registry::RegistryComponent;

#[starknet::contract]
pub mod RegistryMock {
use starknet::ContractAddress;
use starknet::account::Call;
use zkramp::components::registry::interface::IRegistry;
use zkramp::components::registry::registry::RegistryComponent;

component!(path: RegistryComponent, storage: registry, event: RegistryEvent);
Expand Down
16 changes: 4 additions & 12 deletions contracts/src/components/registry/registry_test.cairo
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
use core::starknet::{ContractAddress, contract_address_const};
use snforge_std::{
declare, ContractClassTrait, ContractClass, start_cheat_caller_address, EventSpy,
EventSpyAssertionsTrait, spy_events, test_address, EventSpyTrait
};
use zkramp::components::registry::interface::{IRegistryDispatcher, IRegistryDispatcherTrait};
use core::starknet::ContractAddress;
use snforge_std::{start_cheat_caller_address, EventSpyAssertionsTrait, spy_events, test_address};
use zkramp::components::registry::registry::{
RegistryComponent, RegistryComponent::{Event, RegistrationEvent, RegistryImpl}
};
use zkramp::components::registry::registry_mock::{
RegistryMock, TestingStateDefault, ComponentState
RegistryComponent::{Event, RegistrationEvent, RegistryImpl}
};
use zkramp::components::registry::registry_mock::{TestingStateDefault, ComponentState};
use zkramp::tests::constants;
use zkramp::tests::utils;


//
// Externals
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/contracts/nullifier_registry/interface.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use starknet::{ContractAddress, storage::{Map, StorageMapReadAccess, StorageMapWriteAccess}};
use starknet::ContractAddress;

#[starknet::interface]
pub trait INullifierRegistry<TContractState> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ pub mod NullifierRegistry {
use core::option::OptionTrait;
use openzeppelin::access::ownable::OwnableComponent;
use starknet::{
ContractAddress, get_caller_address, get_block_timestamp,
storage::{Map, Vec, StorageMapReadAccess, StorageMapWriteAccess, VecTrait, MutableVecTrait}
};
use zkramp::contracts::nullifier_registry::interface::{
INullifierRegistry, INullifierRegistryDispatcher, INullifierRegistryDispatcherTrait
ContractAddress, get_caller_address,
storage::{Map, Vec, StorageMapReadAccess, StorageMapWriteAccess, MutableVecTrait}
};
use zkramp::contracts::nullifier_registry::interface::{INullifierRegistry};

component!(path: OwnableComponent, storage: ownable, event: OwnableEvent);

Expand Down Expand Up @@ -134,13 +132,11 @@ pub mod NullifierRegistry {
mod NullifierRegistry_tests {
use core::traits::Into;
use snforge_std::{
declare, ContractClass, ContractClassTrait, spy_events, EventSpyAssertionsTrait,
start_cheat_caller_address, stop_cheat_caller_address, EventSpy
declare, ContractClassTrait, start_cheat_caller_address, stop_cheat_caller_address
};
use starknet::{ContractAddress};
use super::NullifierRegistry;
use zkramp::contracts::nullifier_registry::interface::{
INullifierRegistry, INullifierRegistryDispatcher, INullifierRegistryDispatcherTrait
INullifierRegistryDispatcher, INullifierRegistryDispatcherTrait
};

const OWNER_ADDR: felt252 = 0x1;
Expand Down Expand Up @@ -318,4 +314,3 @@ mod NullifierRegistry_tests {
stop_cheat_caller_address(contract_address);
}
}

7 changes: 1 addition & 6 deletions contracts/src/tests/utils.cairo
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use core::traits::TryInto;

use openzeppelin::presets::interfaces::{
ERC20UpgradeableABIDispatcher, ERC20UpgradeableABIDispatcherTrait
};
use openzeppelin::presets::interfaces::{ERC20UpgradeableABIDispatcher};

use openzeppelin::utils::serde::SerializedAppend;

Expand All @@ -26,4 +22,3 @@ pub fn setup_erc20(recipient: ContractAddress) -> ERC20UpgradeableABIDispatcher

ERC20UpgradeableABIDispatcher { contract_address: contract_address }
}

0 comments on commit cb14243

Please sign in to comment.