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
108 changes: 0 additions & 108 deletions PR_DESCRIPTION.md

This file was deleted.

3 changes: 2 additions & 1 deletion contracts/teachlink/src/access_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ impl AccessControlManager {

/// Enforce a role check, panicking if unauthorized
pub fn check_role(env: &Env, address: &Address, role: AccessRole) {
address.require_auth();
if !Self::has_role(env, address, role) {
panic!("Unauthorized: Missing required role");
}
Expand All @@ -49,6 +48,7 @@ impl AccessControlManager {
target: Address,
role: AccessRole,
) -> Result<(), BridgeError> {
caller.require_auth();
// Only Admin can grant roles
Self::check_role(env, &caller, AccessRole::Admin);

Expand Down Expand Up @@ -88,6 +88,7 @@ impl AccessControlManager {
target: Address,
role: AccessRole,
) -> Result<(), BridgeError> {
caller.require_auth();
Self::check_role(env, &caller, AccessRole::Admin);

let mut roles: Map<Address, Vec<AccessRole>> = env
Expand Down
16 changes: 0 additions & 16 deletions contracts/teachlink/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,3 @@ pub enum CommonError {
TransferFailed = 403,
StorageError = 404,
}

/// Result type alias for bridge operations
#[allow(dead_code)]
pub type BridgeResult<T> = core::result::Result<T, BridgeError>;

/// Result type alias for escrow operations
#[allow(dead_code)]
pub type EscrowResult<T> = core::result::Result<T, EscrowError>;

/// Result type alias for rewards operations
#[allow(dead_code)]
pub type RewardsResult<T> = core::result::Result<T, RewardsError>;

/// Result type alias for common operations
#[allow(dead_code)]
pub type CommonResult<T> = core::result::Result<T, CommonError>;
16 changes: 2 additions & 14 deletions contracts/teachlink/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ use soroban_sdk::contractevent;

use crate::types::{
BridgeTransaction, ContentMetadata, ContributionType, CrossChainMessage, DisputeOutcome,
Escrow, EscrowStatus, OperationType, PacketStatus, ProposalStatus, ProvenanceRecord,
RewardType, SlashingReason, SwapStatus,
Escrow, EscrowStatus, OperationType, ProposalStatus, ProvenanceRecord, RewardType,
SlashingReason,
};

// Include notification events
// pub use crate::notification_events::*;

use soroban_sdk::{Address, Bytes, String};

// ================= Bridge Events =================
Expand Down Expand Up @@ -345,15 +342,6 @@ pub struct AuditRecordCreatedEvent {
pub timestamp: u64,
}

// #[contractevent]
// #[derive(Clone, Debug)]
// pub struct ComplianceReportGeneratedEvent {
// pub report_id: u64,
// pub period_start: u64,
// pub period_end: u64,
// pub total_volume: i128,
// }

// ================= Atomic Swap Events =================

#[contractevent]
Expand Down
132 changes: 0 additions & 132 deletions contracts/teachlink/src/notification_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,135 +227,3 @@ pub struct NotificationThrottlingActivatedEvent {
pub activated_at: u64,
}

// Events exceeding 32 character limit commented out
/*
#[contractevent]
#[derive(Clone, Debug)]
pub struct NotificationValidationFailedEvent {
pub notification_id: u64,
pub validation_errors: Vec<Bytes>,
pub failed_at: u64,
}

#[contractevent]
#[derive(Clone, Debug)]
pub struct NotificationDeliveryOptimizedEvent {
pub notification_id: u64,
pub original_channel: NotificationChannel,
pub optimized_channel: NotificationChannel,
pub optimization_reason: Bytes,
pub optimized_at: u64,
}

#[contractevent]
#[derive(Clone, Debug)]
pub struct NotificationUserPreferencesMigratedEvent {
pub user: Address,
pub old_preferences: Vec<NotificationPreference>,
pub new_preferences: Vec<NotificationPreference>,
pub migrated_at: u64,
}

#[contractevent]
#[derive(Clone, Debug)]
pub struct NotificationSystemInitializedEvent {
pub initialized_by: Address,
pub default_templates: Vec<u64>,
pub initialized_at: u64,
}

#[contractevent]
#[derive(Clone, Debug)]
pub struct NotificationConfigurationUpdatedEvent {
pub config_type: Bytes, // "rate_limits", "compliance", "templates", etc.
pub updated_by: Address,
pub old_config: Bytes,
pub new_config: Bytes,
pub updated_at: u64,
}

#[contractevent]
#[derive(Clone, Debug)]
pub struct NotificationEmergencyModeActivatedEvent {
pub activated_by: Address,
pub reason: Bytes,
pub affected_channels: Vec<NotificationChannel>,
pub activated_at: u64,
}

#[contractevent]
#[derive(Clone, Debug)]
pub struct NotificationEmergencyModeDeactivatedEvent {
pub deactivated_by: Address,
pub deactivated_at: u64,
}

#[contractevent]
#[derive(Clone, Debug)]
pub struct NotificationBatchCreatedEvent {
pub batch_id: u64,
pub notification_count: u32,
pub channels: Vec<NotificationChannel>,
pub created_at: u64,
}

#[contractevent]
#[derive(Clone, Debug)]
pub struct NotificationDeliveryRetryEvent {
pub notification_id: u64,
pub retry_attempt: u32,
pub max_retries: u32,
pub retry_reason: Bytes,
pub scheduled_at: u64,
}

#[contractevent]
#[derive(Clone, Debug)]
pub struct NotificationUserActivityTrackedEvent {
pub user: Address,
pub activity_type: Bytes, // "login", "transaction", "profile_update", etc.
pub timestamp: u64,
pub metadata: Bytes,
}

#[contractevent]
#[derive(Clone, Debug)]
pub struct NotificationContentRenderedEvent {
pub notification_id: u64,
pub template_id: u64,
pub user: Address,
pub render_time_ms: u32,
pub rendered_at: u64,
}

#[contractevent]
#[derive(Clone, Debug)]
pub struct NotificationLocalizationAppliedEvent {
pub notification_id: u64,
pub language_code: Bytes,
pub original_subject: Bytes,
pub localized_subject: Bytes,
pub applied_at: u64,
}

#[contractevent]
#[derive(Clone, Debug)]
pub struct NotificationFeedbackReceivedEvent {
pub notification_id: u64,
pub user: Address,
pub feedback_type: u32, // 0=positive, 1=negative, 2=neutral
pub feedback_message: Bytes,
pub received_at: u64,
}

#[contractevent]
#[derive(Clone, Debug)]
pub struct NotificationPerformanceReportedEvent {
pub period_start: u64,
pub period_end: u64,
pub total_notifications: u64,
pub delivery_rate: u32,
pub engagement_rate: u32,
pub reported_at: u64,
}
*/
32 changes: 0 additions & 32 deletions contracts/teachlink/src/provenance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,36 +109,4 @@ impl ProvenanceTracker {

true
}

/// Get the original creator of a token
#[allow(dead_code)]
pub fn get_creator(env: &Env, token_id: u64) -> Option<Address> {
let history = Self::get_provenance(env, token_id);
if history.is_empty() {
return None;
}

let first = history.first().unwrap();
if first.transfer_type == TransferType::Mint {
Some(first.to)
} else {
None
}
}

/// Get all addresses that have owned this token
#[allow(dead_code)]
pub fn get_all_owners(env: &Env, token_id: u64) -> Vec<Address> {
let history = Self::get_provenance(env, token_id);
let mut owners = Vec::new(env);

for record in history.iter() {
// Add the 'to' address (new owner)
if !owners.contains(record.to.clone()) {
owners.push_back(record.to);
}
}

owners
}
}
Loading
Loading