Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade to V2.8.3 #117

Merged
merged 8 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test_contract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
- uses: software-mansion/setup-scarb@v1
- uses: foundry-rs/setup-snfoundry@v3
with:
starknet-foundry-version: 0.22.0
starknet-foundry-version: 0.31.0
- name: Run cairo tests
run: snforge test
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
scarb 2.6.3
starknet-foundry 0.22.0
scarb 2.8.3
starknet-foundry 0.31.0
113 changes: 109 additions & 4 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,118 @@ dependencies = [

[[package]]
name = "openzeppelin"
version = "0.11.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.11.0#a83f36b23f1af6e160288962be4a2701c3ecbcda"
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",
]

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

[[package]]
name = "openzeppelin_account"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
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"
dependencies = [
"openzeppelin_access",
"openzeppelin_introspection",
]

[[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"

[[package]]
name = "openzeppelin_token"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
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"

[[package]]
name = "snforge_scarb_plugin"
version = "0.31.0"
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.31.0#72ea785ca354e9e506de3e5d687da9fb2c1b3c67"

[[package]]
name = "snforge_std"
version = "0.22.0"
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.22.0#9b215944c6c5871c738381b4ded61bbf06e7ba35"
version = "0.31.0"
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.31.0#72ea785ca354e9e506de3e5d687da9fb2c1b3c67"
dependencies = [
"snforge_scarb_plugin",
]

[[package]]
name = "token_bound_accounts"
Expand Down
9 changes: 5 additions & 4 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "karst"
version = "0.1.0"
edition = "2023_10"
edition = "2024_07"
authors = ["Horus Labs <[email protected]>"]
description = "Decentralized Social Graph on Starknet"
repository = "https://github.com/horuslabsio/karst-core"
Expand All @@ -10,13 +10,14 @@ keywords = ["Karst", "SocialFi", "tokenbound", "cairo", "contracts", "starknet"]
# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html

[dependencies]
starknet = "2.6.3"
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.11.0" }
starknet = "2.8.2"
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.17.0" }
token_bound_accounts= { git = "https://github.com/Starknet-Africa-Edu/TBA", tag = "v0.3.0" }
alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.git" }

[dev-dependencies]
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.22.0" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.31.0" }


[sncast.default]
url= "https://starknet-sepolia.public.blastapi.io"
Expand Down
4 changes: 2 additions & 2 deletions src/base/constants.cairo
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
mod errors;
mod types;
pub mod errors;
pub mod types;
114 changes: 61 additions & 53 deletions src/base/constants/types.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use core::option::OptionTrait;
// *************************************************************************
// TYPES
// *************************************************************************
Expand All @@ -9,30 +8,32 @@ use starknet::ContractAddress;
// *
// * @param followed_profile_address The ID of the profile being followed.
// * @param follower_profile_address The ID of the profile following.
// * @param followTimestamp The timestamp of the current follow, if a profile is using the token to follow.
// * @param followTimestamp The timestamp of the current follow, if a profile is using the token to
// follow.
// * @param block_status true if follower is blocked, false otherwise
// */
#[derive(Drop, Serde, starknet::Store)]
pub struct FollowData {
followed_profile_address: ContractAddress,
follower_profile_address: ContractAddress,
follow_timestamp: u64,
block_status: bool,
pub followed_profile_address: ContractAddress,
pub follower_profile_address: ContractAddress,
pub follow_timestamp: u64,
pub block_status: bool,
}

// * @notice A struct containing profile data.
// * profile_address The profile ID of a karst profile
// * profile_address The profile ID of a karst profile
// * profile_owner The address that created the profile_address
// * @param pub_count The number of publications made to this profile.
// * @param metadataURI MetadataURI is used to store the profile's metadata, for example: displayed name, description, interests, etc.
// * @param metadataURI MetadataURI is used to store the profile's metadata, for example: displayed
// name, description, interests, etc.
// * @param follow_nft profile follow nft token contract
#[derive(Drop, Serde, starknet::Store)]
pub struct Profile {
profile_address: ContractAddress,
profile_owner: ContractAddress,
pub_count: u256,
metadata_URI: ByteArray,
follow_nft: ContractAddress
pub profile_address: ContractAddress,
pub profile_owner: ContractAddress,
pub pub_count: u256,
pub metadata_URI: ByteArray,
pub follow_nft: ContractAddress
}

// /**
Expand All @@ -44,33 +45,37 @@ pub struct Profile {
// * - Mirrors
// * - Comments
// * - Quotes
// * @param content_URI The URI to set for the content of publication (can be ipfs, arweave, http, etc).
// * @param content_URI The URI to set for the content of publication (can be ipfs, arweave, http,
// etc).
// * @param pub_Type The type of publication, can be Nonexistent, Post, Comment, Mirror or Quote.
// * @param root_profile_address The profile ID of the root post (to determine if comments/quotes and mirrors come from it).
// * @param root_pub_id The publication ID of the root post (to determine if comments/quotes and mirrors come from it).
// * @param root_profile_address The profile ID of the root post (to determine if comments/quotes
// and mirrors come from it).
// * @param root_pub_id The publication ID of the root post (to determine if comments/quotes and
// mirrors come from it).
// */
#[derive(Debug, Drop, Serde, starknet::Store)]
pub struct Publication {
pointed_profile_address: ContractAddress,
pointed_pub_id: u256,
content_URI: ByteArray,
pub_Type: PublicationType,
root_profile_address: ContractAddress,
root_pub_id: u256,
upvote: u256,
downvote: u256,
pub pointed_profile_address: ContractAddress,
pub pointed_pub_id: u256,
pub content_URI: ByteArray,
pub pub_Type: PublicationType,
pub root_profile_address: ContractAddress,
pub root_pub_id: u256,
pub upvote: u256,
pub downvote: u256,
}

// /**
// * @notice An enum specifically used in a helper function to easily retrieve the publication type for integrations.
// * @notice An enum specifically used in a helper function to easily retrieve the publication type
// for integrations.
// *
// * @param Nonexistent An indicator showing the queried publication does not exist.
// * @param Post A standard post, having an URI, and no pointer to another publication.
// * @param Comment A comment, having an URI, and a pointer to another publication.
// * @param Mirror A mirror, having a pointer to another publication, but no URI.
// */
#[derive(Debug, Drop, Serde, starknet::Store, Clone, PartialEq)]
enum PublicationType {
pub enum PublicationType {
Nonexistent,
Post,
Comment,
Expand All @@ -85,8 +90,8 @@ enum PublicationType {
// */
#[derive(Drop, Serde, starknet::Store, Clone)]
pub struct PostParams {
content_URI: ByteArray,
profile_address: ContractAddress,
pub content_URI: ByteArray,
pub profile_address: ContractAddress,
}

// /**
Expand All @@ -98,36 +103,37 @@ pub struct PostParams {
// * @param pointed_pub_id ID of the pointed publication
// */
#[derive(Drop, Serde, starknet::Store, Clone)]
struct CommentParams {
profile_address: ContractAddress,
content_URI: ByteArray,
pointed_profile_address: ContractAddress,
pointed_pub_id: u256,
reference_pub_type: PublicationType,
pub struct CommentParams {
pub profile_address: ContractAddress,
pub content_URI: ByteArray,
pub pointed_profile_address: ContractAddress,
pub pointed_pub_id: u256,
pub reference_pub_type: PublicationType,
}


#[derive(Drop, Serde, starknet::Store)]
pub struct ReferencePubParams {
profile_address: ContractAddress,
content_URI: ByteArray,
pointed_profile_address: ContractAddress,
pointed_pub_id: u256
pub profile_address: ContractAddress,
pub content_URI: ByteArray,
pub pointed_profile_address: ContractAddress,
pub pointed_pub_id: u256
}

// /**
// * @notice A struct containing the parameters required for the `mirror()` function.
// *
// * @param profile_address The address of the profile to publish to.
// * @param metadata_URI the URI containing metadata attributes to attach to this mirror publication.
// * @param metadata_URI the URI containing metadata attributes to attach to this mirror
// publication.
// * @param pointed_profile_id The profile address to point the mirror to.
// * @param pointed_pub_id The publication ID to point the mirror to.
// */
#[derive(Drop, Serde, starknet::Store, Clone)]
pub struct RepostParams {
profile_address: ContractAddress,
pointed_profile_address: ContractAddress,
pointed_pub_id: u256,
pub profile_address: ContractAddress,
pub pointed_profile_address: ContractAddress,
pub pointed_pub_id: u256,
}

// /**
Expand All @@ -140,21 +146,23 @@ pub struct RepostParams {
// */
#[derive(Drop, Serde, starknet::Store, Clone)]
pub struct QuoteParams {
profile_address: ContractAddress,
content_URI: ByteArray,
pointed_profile_address: ContractAddress,
pointed_pub_id: u256,
reference_pub_type: PublicationType
pub profile_address: ContractAddress,
pub content_URI: ByteArray,
pub pointed_profile_address: ContractAddress,
pub pointed_pub_id: u256,
pub reference_pub_type: PublicationType
}

#[derive(Debug, Drop, Serde, starknet::Store, Clone)]
pub struct Upvote {
publication_id: u256,
transaction_executor: ContractAddress,
block_timestamp: u64,
pub publication_id: u256,
pub transaction_executor: ContractAddress,
pub block_timestamp: u64,
}

#[derive(Debug, Drop, Serde, starknet::Store, Clone)]
pub struct Downvote {
publication_id: u256,
transaction_executor: ContractAddress,
block_timestamp: u64,
pub publication_id: u256,
pub transaction_executor: ContractAddress,
pub block_timestamp: u64,
}
8 changes: 4 additions & 4 deletions src/base/token_uris.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod follow_token_uri;
mod handle_token_uri;
mod profile_token_uri;
mod traits;
pub mod follow_token_uri;
pub mod handle_token_uri;
pub mod profile_token_uri;
pub mod traits;
Loading
Loading