Skip to content

Commit

Permalink
chore: more tests, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Darlington02 committed Oct 30, 2024
1 parent 6db51b9 commit e807bda
Show file tree
Hide file tree
Showing 7 changed files with 261 additions and 190 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
</a>
</p>

coloniz is a permissionless and composable social graph built on Starknet, empowering creators to own every part of their social experience.
Coloniz empowers you to build smart, dynamic communities effortlessly.

With coloniz, creators no longer need to worry about losing their content, audience, and livelihood based on the whims of an individual platform's algorithms and policies.
Create your own colony, define custom rules, and leverage a powerful AI assistant that learns from community discussions to provide personalized support to your colonists.

## Architecture

<img width="100%" alt="Screenshot 2024-05-24 at 00 11 16" src="https://github.com/horuslabsio/coloniz-core/blob/main/img/architecture.png?raw=true">

## Development Setup
You will need to have Scarb and Starknet Foundry installed on your system. Refer to the documentations below:
Expand Down
Binary file modified img/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/karst archieture.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/base/constants/errors.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub mod Errors {
pub const ALREADY_MEMBER: felt252 = 'coloniz: already a Member';
pub const COMMUNITY_DOES_NOT_EXIST: felt252 = 'coloniz: Comm does not exist';
pub const NOT_COMMUNITY_OWNER: felt252 = 'coloniz: Not Community owner';
pub const ONLY_PREMIUM_COMMUNITIES: felt252 = 'coloniz: only premium communiti';
pub const ONLY_PREMIUM_COMMUNITIES: felt252 = 'coloniz: not premium community';
pub const NOT_COMMUNITY_MEMBER: felt252 = 'coloniz: Not Community Member';
pub const NOT_COMMUNITY_MOD: felt252 = 'coloniz: Not a community mod';
pub const BANNED_MEMBER: felt252 = 'coloniz: Profile is banned!';
Expand Down
2 changes: 1 addition & 1 deletion src/base/constants/types.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ pub struct CommunityGateKeepDetails {
pub community_id: u256,
pub gate_keep_type: GateKeepType,
pub gatekeep_nft_address: ContractAddress,
pub paid_gating_details: (ContractAddress, u256)
pub paid_gating_details: (u256, ContractAddress, u256)
}

///**
Expand Down
17 changes: 13 additions & 4 deletions src/community/community.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,20 @@ pub mod CommunityComponent {
);
}

// create subscription item
let mut sub_id = 0;
let (erc20_contract_address, amount) = paid_gating_details;
if(gate_keep_type == GateKeepType::PaidGating) {
let mut jolt_comp = get_dep_component_mut!(ref self, Jolt);
sub_id = jolt_comp.create_subscription(self.fee_address.read(community_id), amount, erc20_contract_address);
}

// update gatekeep details
let mut community_gate_keep_details = CommunityGateKeepDetails {
community_id: community_id,
gate_keep_type: gate_keep_type.clone(),
gatekeep_nft_address: nft_contract_address,
paid_gating_details: paid_gating_details
paid_gating_details: (sub_id, erc20_contract_address, amount)
};

// permissioned gatekeeping
Expand Down Expand Up @@ -544,7 +553,7 @@ pub mod CommunityComponent {
community_id: community_id,
gate_keep_type: GateKeepType::None,
gatekeep_nft_address: contract_address_const::<0>(),
paid_gating_details: (contract_address_const::<0>(), 0)
paid_gating_details: (0, contract_address_const::<0>(), 0)
};

self.communities.write(community_id, community_details);
Expand Down Expand Up @@ -752,15 +761,15 @@ pub mod CommunityComponent {
// enforce paid gatekeeping
GateKeepType::PaidGating => {
let fee_address = self.fee_address.read(community_id);
let (erc20_contract_address, entry_fee) = gatekeep_details.paid_gating_details;
let (sub_id, erc20_contract_address, entry_fee) = gatekeep_details.paid_gating_details;

let jolt_params = JoltParams {
jolt_type: JoltType::Transfer,
recipient: fee_address,
memo: "Joined Community",
amount: entry_fee,
expiration_stamp: 0,
subscription_details: (0, false, 0),
subscription_details: (sub_id, false, 0),
erc20_contract_address: erc20_contract_address
};

Expand Down
Loading

0 comments on commit e807bda

Please sign in to comment.