Skip to content

Commit

Permalink
chore: refactor contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
Darlington02 committed Dec 17, 2024
1 parent 680f7f0 commit 977075e
Show file tree
Hide file tree
Showing 30 changed files with 173 additions and 321 deletions.
97 changes: 24 additions & 73 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = 1
[[package]]
name = "alexandria_bytes"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#0aa7cca8a1acb1f35cff32420614f7f58e38de5e"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#6a989d636243494a0529fc3af06a924493499564"
dependencies = [
"alexandria_data_structures",
"alexandria_math",
Expand All @@ -13,15 +13,15 @@ dependencies = [
[[package]]
name = "alexandria_data_structures"
version = "0.2.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#0aa7cca8a1acb1f35cff32420614f7f58e38de5e"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#6a989d636243494a0529fc3af06a924493499564"
dependencies = [
"alexandria_encoding",
]

[[package]]
name = "alexandria_encoding"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#0aa7cca8a1acb1f35cff32420614f7f58e38de5e"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#6a989d636243494a0529fc3af06a924493499564"
dependencies = [
"alexandria_bytes",
"alexandria_math",
Expand All @@ -30,16 +30,13 @@ dependencies = [

[[package]]
name = "alexandria_math"
version = "0.2.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#0aa7cca8a1acb1f35cff32420614f7f58e38de5e"
dependencies = [
"alexandria_data_structures",
]
version = "0.2.1"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#6a989d636243494a0529fc3af06a924493499564"

[[package]]
name = "alexandria_numeric"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#0aa7cca8a1acb1f35cff32420614f7f58e38de5e"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#6a989d636243494a0529fc3af06a924493499564"
dependencies = [
"alexandria_math",
"alexandria_searching",
Expand All @@ -48,7 +45,7 @@ dependencies = [
[[package]]
name = "alexandria_searching"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#0aa7cca8a1acb1f35cff32420614f7f58e38de5e"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#6a989d636243494a0529fc3af06a924493499564"
dependencies = [
"alexandria_data_structures",
]
Expand All @@ -58,33 +55,18 @@ name = "coloniz"
version = "0.1.0"
dependencies = [
"alexandria_bytes",
"openzeppelin",
"snforge_std",
"token_bound_accounts",
]

[[package]]
name = "openzeppelin"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_finance",
"openzeppelin_governance",
"openzeppelin_introspection",
"openzeppelin_merkle_tree",
"openzeppelin_presets",
"openzeppelin_security",
"openzeppelin_token",
"openzeppelin_upgrades",
"openzeppelin_utils",
"snforge_std",
"token_bound_accounts",
]

[[package]]
name = "openzeppelin_access"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:541bb8fdf1ad17fe0d275b00acb9f0d7f56ea5534741e21535ac3fda2c600281"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_utils",
Expand All @@ -93,25 +75,18 @@ dependencies = [
[[package]]
name = "openzeppelin_account"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:c4e11609fdd1f4c3d3004cd1468711bd2ea664739c9e59a4b270567fe4c23ee3"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_finance"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_access",
"openzeppelin_token",
]

[[package]]
name = "openzeppelin_governance"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:b7e0142d88d69a8c367aea8c9dc7f659f27372551efc23f39a0cf71a189c1302"
dependencies = [
"openzeppelin_access",
"openzeppelin_introspection",
Expand All @@ -120,50 +95,25 @@ dependencies = [
[[package]]
name = "openzeppelin_introspection"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"

[[package]]
name = "openzeppelin_merkle_tree"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"

[[package]]
name = "openzeppelin_presets"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_finance",
"openzeppelin_introspection",
"openzeppelin_token",
"openzeppelin_upgrades",
]

[[package]]
name = "openzeppelin_security"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:892433a4a1ea0fc9cf7cdb01e06ddc2782182abcc188e4ea5dd480906d006cf8"

[[package]]
name = "openzeppelin_token"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:77997a7e217b69674c34b402dc0c7b2210540db66a56087572679c31896eaabb"
dependencies = [
"openzeppelin_account",
"openzeppelin_governance",
"openzeppelin_introspection",
]

[[package]]
name = "openzeppelin_upgrades"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"

[[package]]
name = "openzeppelin_utils"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:36d93e353f42fd6b824abcd8b4b51c3f5d02c893c5f886ae81403b0368aa5fde"

[[package]]
name = "snforge_scarb_plugin"
Expand All @@ -181,7 +131,8 @@ dependencies = [
[[package]]
name = "token_bound_accounts"
version = "0.3.0"
source = "git+https://github.com/horuslabsio/TBA?branch=v3#6a7ea81d619cb3b5f3bd7c4360bdc1619799d884"
source = "git+https://github.com/horuslabsio/TBA?branch=v3.1.0#944b3ca7366b7724620b346bf54201a505663068"
dependencies = [
"openzeppelin",
"openzeppelin_introspection",
"openzeppelin_token",
]
8 changes: 5 additions & 3 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ keywords = ["coloniz", "SocialFi", "tokenbound", "cairo", "contracts", "starknet

[dependencies]
starknet = "2.8.2"
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.17.0" }
token_bound_accounts= { git = "https://github.com/horuslabsio/TBA", branch = "v3"}
token_bound_accounts= { git = "https://github.com/horuslabsio/TBA", branch = "v3.1.0"}
alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.git" }
openzeppelin_token = "0.17.0"
openzeppelin_introspection = "0.17.0"
openzeppelin_access = "0.17.0"

[dev-dependencies]
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.31.0" }
Expand All @@ -31,4 +33,4 @@ unstable-add-statements-code-locations-debug-info = true
unstable-add-statements-functions-debug-info = true
inlining-strategy = "avoid"

[lib]
[lib]
2 changes: 1 addition & 1 deletion src/channel/channel.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub mod ChannelComponent {
StoragePointerReadAccess, StoragePointerWriteAccess, Map, StorageMapReadAccess,
StorageMapWriteAccess
};
use openzeppelin::access::ownable::OwnableComponent;
use openzeppelin_access::ownable::OwnableComponent;

use coloniz::jolt::jolt::JoltComponent;
use coloniz::community::community::CommunityComponent;
Expand Down
7 changes: 3 additions & 4 deletions src/coloniznft/coloniznft.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ pub mod ColonizNFT {
constants::types::ProfileVariants,
token_uris::profile_token_uri::ProfileTokenUri::get_token_uri,
};
use openzeppelin::{
access::ownable::OwnableComponent, token::erc721::{ERC721Component, ERC721HooksEmptyImpl},
introspection::{src5::SRC5Component}
};
use openzeppelin_access::ownable::OwnableComponent;
use openzeppelin_token::erc721::{ERC721Component, ERC721HooksEmptyImpl};
use openzeppelin_introspection::{src5::SRC5Component};
component!(path: OwnableComponent, storage: ownable, event: OwnableEvent);
component!(path: SRC5Component, storage: src5, event: SRC5Event);
component!(path: ERC721Component, storage: erc721, event: ERC721Event);
Expand Down
2 changes: 1 addition & 1 deletion src/community/community.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub mod CommunityComponent {
StorageMapWriteAccess
}
};
use openzeppelin::access::ownable::OwnableComponent;
use openzeppelin_access::ownable::OwnableComponent;

use coloniz::jolt::jolt::JoltComponent;
use coloniz::interfaces::{
Expand Down
4 changes: 2 additions & 2 deletions src/community/communitynft.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ pub mod CommunityNFT {
// *************************************************************************
use starknet::{ContractAddress, get_block_timestamp};
use core::num::traits::zero::Zero;
use openzeppelin::introspection::src5::SRC5Component;
use openzeppelin::token::erc721::{ERC721Component, ERC721HooksEmptyImpl};
use openzeppelin_introspection::src5::SRC5Component;
use openzeppelin_token::erc721::{ERC721Component, ERC721HooksEmptyImpl};

use coloniz::interfaces::ICustomNFT::ICustomNFT;

Expand Down
7 changes: 3 additions & 4 deletions src/follownft/follownft.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ pub mod Follow {
constants::{errors::Errors, types::FollowData},
utils::hubrestricted::HubRestricted::hub_only, token_uris::follow_token_uri::FollowTokenUri,
};
use openzeppelin::{
access::ownable::OwnableComponent, token::erc721::{ERC721Component, ERC721HooksEmptyImpl},
introspection::{src5::SRC5Component}
};
use openzeppelin_access::ownable::OwnableComponent;
use openzeppelin_token::erc721::{ERC721Component, ERC721HooksEmptyImpl};
use openzeppelin_introspection::{src5::SRC5Component};

component!(path: OwnableComponent, storage: ownable, event: OwnableEvent);
component!(path: SRC5Component, storage: src5, event: SRC5Event);
Expand Down
2 changes: 1 addition & 1 deletion src/hub/hub.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub mod ColonizHub {
};
use coloniz::profile::profile::ProfileComponent;
use coloniz::publication::publication::PublicationComponent;
use openzeppelin::access::ownable::OwnableComponent;
use openzeppelin_access::ownable::OwnableComponent;
use coloniz::community::community::CommunityComponent;
use coloniz::channel::channel::ChannelComponent;
use coloniz::jolt::jolt::JoltComponent;
Expand Down
3 changes: 1 addition & 2 deletions src/interfaces/IHub.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ pub trait IHub<TState> {
// *************************************************************************
fn create_profile(
ref self: TState,
coloniznft_contract_address: ContractAddress,
registry_hash: felt252,
registry_contract_address: ContractAddress,
implementation_hash: felt252,
salt: felt252,
profile_variants: ProfileVariants
Expand Down
3 changes: 1 addition & 2 deletions src/interfaces/IProfile.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ pub trait IProfile<TState> {
// *************************************************************************
fn create_profile(
ref self: TState,
coloniznft_contract_address: ContractAddress,
registry_hash: felt252,
registry_contract_address: ContractAddress,
implementation_hash: felt252,
salt: felt252,
profile_variants: ProfileVariants
Expand Down
4 changes: 2 additions & 2 deletions src/jolt/jolt.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ pub mod JoltComponent {
};
use coloniz::interfaces::{IJolt::IJolt, IERC20::{IERC20Dispatcher, IERC20DispatcherTrait}};

use openzeppelin::access::ownable::OwnableComponent;
use openzeppelin::access::ownable::OwnableComponent::{OwnableMixinImpl, InternalImpl};
use openzeppelin_access::ownable::OwnableComponent;
use openzeppelin_access::ownable::OwnableComponent::{OwnableMixinImpl, InternalImpl};

// *************************************************************************
// STORAGE
Expand Down
2 changes: 1 addition & 1 deletion src/mocks/ERC20.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[starknet::contract]
mod USDT {
use openzeppelin::token::erc20::{ERC20Component, ERC20HooksEmptyImpl};
use openzeppelin_token::erc20::{ERC20Component, ERC20HooksEmptyImpl};
use starknet::ContractAddress;

component!(path: ERC20Component, storage: erc20, event: ERC20Event);
Expand Down
4 changes: 2 additions & 2 deletions src/mocks/ERC721.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ trait IERC721<TContractState> {

#[starknet::contract]
pub mod ERC721 {
use openzeppelin::introspection::src5::SRC5Component;
use openzeppelin::token::erc721::{ERC721Component, ERC721HooksEmptyImpl};
use openzeppelin_introspection::src5::SRC5Component;
use openzeppelin_token::erc721::{ERC721Component, ERC721HooksEmptyImpl};
use starknet::ContractAddress;

component!(path: ERC721Component, storage: erc721, event: ERC721Event);
Expand Down
1 change: 0 additions & 1 deletion src/mocks/interfaces.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pub mod IComposable;
pub mod IJoltUpgrade;
pub mod IChannelComposable;
3 changes: 1 addition & 2 deletions src/mocks/interfaces/IComposable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ pub trait IComposable<TState> {
// *************************************************************************
fn create_profile(
ref self: TState,
coloniznft_contract_address: ContractAddress,
registry_hash: felt252,
registry_contract_address: ContractAddress,
implementation_hash: felt252,
salt: felt252,
profile_variants: ProfileVariants
Expand Down
13 changes: 0 additions & 13 deletions src/mocks/interfaces/IJoltUpgrade.cairo

This file was deleted.

Loading

0 comments on commit 977075e

Please sign in to comment.