Skip to content
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
7 changes: 5 additions & 2 deletions contracts/dao/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ use soroban_sdk::{
const DEFAULT_TIMELOCK_LEDGERS: u32 = 17_280;

/// Minimum quorum required for a proposal to pass (numerator out of 10 000).
const QUORUM_BPS: u32 = 1_000; // 10 %
const QUORUM_BPS: u32 = 1_000; // 10 % (1_000 / 10_000)

/// Basis-point denominator: 10_000 bps = 100 %.
const BPS_DENOMINATOR: u32 = 10_000;

// ── Data Types ────────────────────────────────────────────────────────────────

Expand Down Expand Up @@ -353,7 +356,7 @@ impl DaoGovernance {

// Check quorum: total votes cast must be ≥ QUORUM_BPS of total supply.
let total_votes = proposal.votes_for + proposal.votes_against;
let quorum = (total_supply * QUORUM_BPS as i128) / 10_000;
let quorum = (total_supply * QUORUM_BPS as i128) / BPS_DENOMINATOR as i128;

let passed = total_votes >= quorum && proposal.votes_for > proposal.votes_against;

Expand Down
10 changes: 7 additions & 3 deletions contracts/nft/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ pub mod errors;

use errors::NftError;

/// Maximum royalty a creator may set on secondary sales, in basis points.
/// 3000 bps = 30%; the cap protects buyers from prohibitive resale fees.
const MAX_ROYALTY_BPS: u32 = 3000;

// ── Data Types ────────────────────────────────────────────────────────────────

/// Current state of an NFT certificate.
Expand Down Expand Up @@ -119,7 +123,7 @@ impl NftOwnership {
/// * `owner` — initial owner (may differ from creator on primary sale).
/// * `title` — human-readable certificate name.
/// * `metadata_uri` — URI pointing to off-chain metadata (IPFS / HTTPS).
/// * `royalty_bps` — basis points paid to creator on secondary sales (≤ 3000).
/// * `royalty_bps` — basis points paid to creator on secondary sales (≤ MAX_ROYALTY_BPS).
/// * `commission_id` — linked commission id; 0 if standalone.
/// * `transferable` — whether the NFT may be transferred after minting.
/// * `burnable` — whether the NFT may be burned by the owner.
Expand All @@ -137,7 +141,7 @@ impl NftOwnership {
burnable: bool,
) -> Result<u64, NftError> {
creator.require_auth();
if royalty_bps > 3000 {
if royalty_bps > MAX_ROYALTY_BPS {
return Err(NftError::RoyaltyTooHigh);
}

Expand Down Expand Up @@ -302,7 +306,7 @@ impl NftOwnership {
/// Only the original creator may update royalties.
pub fn update_royalty(env: Env, creator: Address, nft_id: u64, new_royalty_bps: u32) -> Result<(), NftError> {
creator.require_auth();
if new_royalty_bps > 3000 {
if new_royalty_bps > MAX_ROYALTY_BPS {
return Err(NftError::RoyaltyTooHigh);
}

Expand Down
Loading