Skip to content
Open
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
20 changes: 10 additions & 10 deletions contracts/admin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ pub enum AdminKey {
Admin,
/// Role assignments: (Role, Address) -> bool
Role(Role, Address),
/// The pool of administrator addresses for multi-sig.
AdminPool,
/// Minimum signatures required for multi-sig actions.
Threshold,
/// Active proposals: proposal_id -> Proposal.
Proposal(u64),
/// Counter for generating unique proposal IDs.
ProposalIdCounter,
}

/// Enumeration of available roles.
Expand All @@ -25,14 +33,6 @@ pub enum Role {
Admin = 0,
/// Account authorized to mint tokens.
Minter = 1,
/// The pool of administrator addresses for multi-sig.
AdminPool,
/// Minimum signatures required for multi-sig actions.
Threshold,
/// Active proposals: proposal_id -> Proposal.
Proposal(u64),
/// Counter for generating unique proposal IDs.
ProposalIdCounter,
}

/// A proposal for a multi-signature action.
Expand Down Expand Up @@ -93,7 +93,7 @@ pub fn has_role(env: &Env, role: Role, address: &Address) -> bool {
return true;
}
env.storage().persistent().has(&AdminKey::Role(role, address.clone()))
// ─── Multi-Sig Primitives ───────────────────────────────────────────────────
}

/// Configures the multi-signature admin pool.
pub fn set_admin_pool(env: &Env, pool: Vec<Address>, threshold: u32) {
Expand Down Expand Up @@ -137,7 +137,7 @@ pub fn require_role(env: &Env, role: Role, address: &Address) {
panic!("unauthorized: missing role");
}
address.require_auth();
// ─── Proposals ──────────────────────────────────────────────────────────────
}

/// Creates a new proposal for an administrative action.
pub fn create_proposal(env: &Env, creator: Address, description: String) -> u64 {
Expand Down
20 changes: 18 additions & 2 deletions contracts/token/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ pub fn emit_ownership_proposed(env: &Env, old_admin: &Address, pending_admin: &A
/// Emitted when pending admin accepts ownership.
pub fn emit_ownership_accepted(env: &Env, old_admin: &Address, new_admin: &Address) {
env.events().publish(
(symbol_short!("own_accept"),),
(symbol_short!("own_acpt"),),
(old_admin.clone(), new_admin.clone()),
);
}

/// Emitted when ownership transfer is cancelled.
pub fn emit_ownership_cancelled(env: &Env, admin: &Address, cancelled_admin: &Address) {
env.events().publish(
(symbol_short!("own_cancel"),),
(symbol_short!("own_cncl"),),
(admin.clone(), cancelled_admin.clone()),
);
}
Expand Down Expand Up @@ -162,3 +162,19 @@ pub fn emit_update_symbol(env: &Env, admin: &Address, old_symbol: &String, new_s
(admin.clone(), old_symbol.clone(), new_symbol.clone()),
);
}

/// Emitted when the Minter role is granted to an address.
pub fn emit_minter_granted(env: &Env, admin: &Address, minter: &Address) {
env.events().publish(
(symbol_short!("mtr_grnt"),),
(admin.clone(), minter.clone()),
);
}

/// Emitted when the Minter role is revoked from an address.
pub fn emit_minter_revoked(env: &Env, admin: &Address, minter: &Address) {
env.events().publish(
(symbol_short!("mtr_rvk"),),
(admin.clone(), minter.clone()),
);
}
Loading
Loading