Skip to content

Commit

Permalink
update limit for number of creator dao tokens per user
Browse files Browse the repository at this point in the history
  • Loading branch information
ravi-sawlani-yral committed Nov 13, 2024
1 parent 099b79b commit 23fb999
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
27 changes: 15 additions & 12 deletions src/canister/individual_user_template/src/api/cdao/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,17 @@ use ic_nns_governance::pb::v1::{
SettleNeuronsFundParticipationRequest, SettleNeuronsFundParticipationResponse,
};
use shared_utils::{
canister_specific::individual_user_template::{
consts::CDAO_TOKEN_LIMIT,
types::{
cdao::{AirdropInfo, DeployedCdaoCanisters},
error::CdaoDeployError,
session::SessionType,
},
canister_specific::individual_user_template::types::{
cdao::{AirdropInfo, DeployedCdaoCanisters},
error::CdaoDeployError,
session::SessionType,
},
common::types::known_principal::KnownPrincipalType,
constant::{
NNS_LEDGER_CANISTER_ID, SNS_TOKEN_ARCHIVE_MODULE_HASH, SNS_TOKEN_GOVERNANCE_MODULE_HASH,
SNS_TOKEN_INDEX_MODULE_HASH, SNS_TOKEN_LEDGER_MODULE_HASH, SNS_TOKEN_ROOT_MODULE_HASH,
SNS_TOKEN_SWAP_MODULE_HASH, USER_SNS_CANISTER_INITIAL_CYCLES,
MAX_LIMIT_FOR_CREATOR_DAO_SNS_TOKEN, NNS_LEDGER_CANISTER_ID, SNS_TOKEN_ARCHIVE_MODULE_HASH,
SNS_TOKEN_GOVERNANCE_MODULE_HASH, SNS_TOKEN_INDEX_MODULE_HASH,
SNS_TOKEN_LEDGER_MODULE_HASH, SNS_TOKEN_ROOT_MODULE_HASH, SNS_TOKEN_SWAP_MODULE_HASH,
USER_SNS_CANISTER_INITIAL_CYCLES,
},
};

Expand Down Expand Up @@ -113,11 +111,16 @@ async fn deploy_cdao_sns(
let (registered, limit_hit) = CANISTER_DATA.with(|cdata| {
let cdata = cdata.borrow();
let registered = matches!(cdata.session_type, Some(SessionType::RegisteredSession));
(registered, cdata.cdao_canisters.len() == CDAO_TOKEN_LIMIT)
(
registered,
cdata.cdao_canisters.len() == MAX_LIMIT_FOR_CREATOR_DAO_SNS_TOKEN,
)
});

if limit_hit {
return Err(CdaoDeployError::TokenLimit(CDAO_TOKEN_LIMIT));
return Err(CdaoDeployError::TokenLimit(
MAX_LIMIT_FOR_CREATOR_DAO_SNS_TOKEN,
));
}

// Alloting 0.5T more to the user canister to be on safer side while deploying canisters
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pub mod types;
pub mod consts;
2 changes: 2 additions & 0 deletions src/lib/shared_utils/src/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ pub const RESERVED_NUMBER_OF_INSTRUCTIONS_FOR_INSTALL_CODE: u128 = 200_000_000_0
pub const THRESHOLD_NUMBER_OF_DAYS_TO_KEEP_CANISTER_RUNNING: u128 = 1;
pub const MAX_NUMBER_OF_DAYS_TO_KEEP_CANISTER_RUNNING: u128 = 7;

pub const MAX_LIMIT_FOR_CREATOR_DAO_SNS_TOKEN: usize = 2;

pub const SNS_TOKEN_GOVERNANCE_MODULE_HASH: &'static str =
"bc91fd7bc4d6c01ea814b12510a1ff8f4f74fcac9ab16248ad4af7cb98d9c69d";
pub const SNS_TOKEN_LEDGER_MODULE_HASH: &'static str =
Expand Down

0 comments on commit 23fb999

Please sign in to comment.