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
13 changes: 5 additions & 8 deletions src/access_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
//! 3. Leave `propose_role_change` as a stub or integrate with DAO's public interface.

use soroban_sdk::{contracterror, contracttype, symbol_short, Address, Env, Symbol, Vec};
use soroban_sdk::storage::Instance;
use crate::error_standard::{ErrorDescriptor, ErrorKind, StandardContractError};

// ═══════════════════════════════════════════════════════════════════════════════
Expand Down Expand Up @@ -785,11 +784,11 @@ pub fn init_roles(env: &Env, admin: Address) -> Result<(), AccessControlError> {
/// # Returns
/// - Always `Err(NotImplemented)` until DAO integration is implemented.
pub fn propose_role_change(
env: &Env,
_env: &Env,
proposer: Address,
role: Symbol,
grantee: Address,
action_type: Symbol,
_role: Symbol,
_grantee: Address,
_action_type: Symbol,
) -> Result<u64, AccessControlError> {
// Stub: revert immediately
proposer.require_auth();
Expand Down Expand Up @@ -944,13 +943,11 @@ pub fn approve_proposal(
) -> Result<(), AccessControlError> {
approver.require_auth();

let config: MultiSigConfig = env
let _config: MultiSigConfig = env
.storage()
.persistent()
.get(&AccessControlKey::MultiSigConfig)
.ok_or(AccessControlError::MultiSigNotConfigured)?;

// Verify approver is a signer
let signers: Vec<Address> = env
.storage()
.persistent()
Expand Down
2 changes: 1 addition & 1 deletion src/achievement_engine.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Achievement eligibility evaluation and badge issuance.
//!
use soroban_sdk::{contracterror, contracttype, symbol_short, Address, Env, String, Symbol, Vec};
use soroban_sdk::{contracterror, contracttype, symbol_short, Address, Env, String, Vec};

use crate::health_monitor;
use crate::player_profile::{get_profile_by_owner, mark_achievement_unlocked};
Expand Down
2 changes: 1 addition & 1 deletion src/bounty_board.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Bounty publication, claiming, and settlement.
//!
use soroban_sdk::{
contracterror, contracttype, symbol_short, Address, BytesN, Env, Vec, Map, String,
contracterror, contracttype, symbol_short, Address, BytesN, Env, String,
};

/// Default bounty expiry duration: 14 days in seconds.
Expand Down
2 changes: 1 addition & 1 deletion src/cache_ttl_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ pub fn invalidate_namespace(

/// Automatic cleanup of expired entries (called periodically).
pub fn clear_stale_entries(env: &Env, namespace: Symbol) -> u32 {
let mut cleared = 0u32;
let cleared = 0u32;

// In a real implementation, iterate through all entries in the namespace
// and remove those where age > ttl_seconds. For this example, we track
Expand Down
4 changes: 2 additions & 2 deletions src/composability_examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub struct ComposableResponse {
}

impl ComposableResponse {
pub fn new(env: &Env, success: bool, data: Bytes, gas_used: u64) -> Self {
pub fn new(_env: &Env, success: bool, data: Bytes, gas_used: u64) -> Self {
Self {
success,
data,
Expand Down Expand Up @@ -296,7 +296,7 @@ pub struct CompositionBuilder {
}

impl CompositionBuilder {
pub fn new(env: &Env) -> Self {
pub fn new(_env: &Env) -> Self {
Self {
target: None,
method: None,
Expand Down
4 changes: 2 additions & 2 deletions src/content_tools.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Administrative tools for managed game content.
//!
use soroban_sdk::{
contracterror, contracttype, symbol_short, Address, Bytes, Env, Map, String, Symbol, Vec,
contracterror, contracttype, symbol_short, Address, Bytes, Env, String, Symbol, Vec,
};

use crate::input_validation;
Expand Down Expand Up @@ -345,7 +345,7 @@ pub fn delete_content(

// Remove from creator's list
let creator_key = ContentDataKey::CreatorContent(creator.clone());
let mut creator_contents: Vec<u64> = env
let creator_contents: Vec<u64> = env
.storage()
.persistent()
.get(&creator_key)
Expand Down
2 changes: 1 addition & 1 deletion src/contract_versioning.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Contract version metadata and compatibility checks.
//!
use soroban_sdk::{
contracterror, contracttype, symbol_short, Address, Bytes, Env, Vec, Map,
contracterror, contracttype, symbol_short, Address, Bytes, Env, Vec,
};

/// Current contract version (starts at 1 at deployment).
Expand Down
2 changes: 1 addition & 1 deletion src/difficulty_curve.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Reusable progression and difficulty curves.
//!
use soroban_sdk::{contracterror, contracttype, symbol_short, Address, Env, Symbol, Vec};
use soroban_sdk::{contracterror, contracttype, symbol_short, Address, Env, Symbol};

use crate::health_monitor;
use crate::nebula_explorer::NebulaLayout;
Expand Down
2 changes: 1 addition & 1 deletion src/economics/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub fn get_resource_metrics(env: &Env, resource_type: Symbol) -> ResourceMetrics
}

/// Calculate inflation rate based on supply growth
pub fn calculate_inflation_rate(env: &Env, old_supply: i128, new_supply: i128) -> u32 {
pub fn calculate_inflation_rate(_env: &Env, old_supply: i128, new_supply: i128) -> u32 {
if old_supply == 0 {
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/energy_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ pub fn get_energy_balance(env: &Env, ship_id: u64) -> Result<EnergyBalance, Ener
.unwrap_or(BASE_PASSIVE_REGEN);

let regen_key = EnergyKey::LastRegen(ship_id);
let last_regen: u64 = env.storage().persistent().get(&regen_key).unwrap_or(0);
let _last_regen: u64 = env.storage().persistent().get(&regen_key).unwrap_or(0);

Ok(EnergyBalance {
ship_id,
Expand Down
2 changes: 1 addition & 1 deletion src/environment_simulator.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Deterministic environmental state simulation.
//!
use soroban_sdk::{contracterror, contracttype, symbol_short, Env, Symbol, Vec};
use soroban_sdk::{contracterror, contracttype, symbol_short, Env, Symbol};

const ENVIRONMENTAL_PRESETS: [&str; 8] = [
"calm",
Expand Down
8 changes: 4 additions & 4 deletions src/fractional_resources.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use soroban_sdk::{contracterror, contracttype, symbol_short, Address, BytesN, Env, Symbol, Vec};
use soroban_sdk::{contracterror, contracttype, symbol_short, Address, Env, Symbol, Vec};

// ─── Configuration ─────────────────────────────────────────────────────────

Expand Down Expand Up @@ -90,7 +90,7 @@ pub struct FractionalConfig {
}

impl FractionalConfig {
pub fn new(env: &Env, admin: &Address) -> Self {
pub fn new(_env: &Env, admin: &Address) -> Self {
Self {
min_share_size: MIN_SHARE_SIZE,
max_fractions_per_tx: MAX_FRACTIONS_PER_TX,
Expand Down Expand Up @@ -188,7 +188,7 @@ pub fn fractionalize_resource(
// Create fractional shares
let mut share_ids = Vec::new(env);

for i in 0..shares {
for _i in 0..shares {
let share_id = next_share_id(env);
let share = FractionalShare {
share_id,
Expand Down Expand Up @@ -294,7 +294,7 @@ pub fn merge_fractions(

// Update original resource
let resource_type = expected_type.unwrap();
let original_id = expected_original_id.unwrap();
let _original_id = expected_original_id.unwrap();

let mut original: OriginalResource = env
.storage()
Expand Down
4 changes: 2 additions & 2 deletions src/gas_optimized_compute.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/// Gas-optimized computation utilities
/// Provides efficient algorithms and patterns for common computations
use soroban_sdk::{Env, Vec, BytesN};
use soroban_sdk::{Env, Vec};

/// Fast hash for small inputs (optimized for gas)
pub fn fast_hash_u64(env: &Env, input: u64) -> u64 {
pub fn fast_hash_u64(_env: &Env, input: u64) -> u64 {
// Simple but fast hash for u64
let mut hash = input;
hash ^= hash >> 33;
Expand Down
2 changes: 1 addition & 1 deletion src/gas_optimized_storage.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// Gas-optimized storage utilities
/// Provides efficient storage patterns for common operations
use soroban_sdk::{Env, Address, Symbol, Vec, Map};
use soroban_sdk::{Env, Symbol, Vec};

/// Recommended TTL values for different data types
pub const TTL_TEMPORARY: u32 = 17_280; // 1 day
Expand Down
2 changes: 1 addition & 1 deletion src/gas_recovery.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use soroban_sdk::{
contracterror, contracttype, symbol_short, Address, BytesN, Env, Vec, Map,
contracterror, contracttype, symbol_short, Address, BytesN, Env, Vec,
};

/// Default refund percentage in basis points (100 = 1%).
Expand Down
6 changes: 3 additions & 3 deletions src/governance.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use soroban_sdk::{contracterror, contracttype, symbol_short, Address, Bytes, BytesN, Env, String, Symbol, Vec};
use soroban_sdk::{contracterror, contracttype, symbol_short, Address, BytesN, Env, String, Symbol};

#[contracterror]
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[repr(u32)]
pub enum GovError {
VotingClosed = 1,
Expand Down Expand Up @@ -51,7 +51,7 @@ enum GovernanceDataKey {
pub fn create_proposal(env: Env, creator: Address, description: String, param_change: BytesN<128>) -> Result<u64, GovError> {
creator.require_auth();

let mut proposal_id = env.storage().instance().get::<_, u64>(&symbol_short!("next_gid")).unwrap_or(0);
let proposal_id = env.storage().instance().get::<_, u64>(&symbol_short!("next_gid")).unwrap_or(0);

let proposal = Proposal {
id: proposal_id,
Expand Down
2 changes: 1 addition & 1 deletion src/indexer_callbacks.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use soroban_sdk::{contracterror, contracttype, symbol_short, Address, BytesN, Env, Symbol, Vec};
use soroban_sdk::{contracterror, contracttype, symbol_short, Address, BytesN, Env, Symbol};

#[contracterror]
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
Expand Down
8 changes: 4 additions & 4 deletions src/leaderboards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ fn validate_region(env: &Env, region: &Symbol) -> Result<(), LeaderboardError> {

// ── Sorting Helpers ─────────────────────────────────────────────────────────

fn sort_entries_descending(env: &Env, entries: &mut Vec<LeaderboardEntry>) {
fn sort_entries_descending(_env: &Env, entries: &mut Vec<LeaderboardEntry>) {
let n = entries.len();
for i in 0..n {
for j in (i + 1)..n {
Expand All @@ -780,7 +780,7 @@ fn sort_entries_descending(env: &Env, entries: &mut Vec<LeaderboardEntry>) {
}
}

fn sort_guild_entries_descending(env: &Env, entries: &mut Vec<GuildEntry>) {
fn sort_guild_entries_descending(_env: &Env, entries: &mut Vec<GuildEntry>) {
let n = entries.len();
for i in 0..n {
for j in (i + 1)..n {
Expand All @@ -796,7 +796,7 @@ fn sort_guild_entries_descending(env: &Env, entries: &mut Vec<GuildEntry>) {
}
}

fn sort_regional_entries_descending(env: &Env, entries: &mut Vec<RegionalEntry>) {
fn sort_regional_entries_descending(_env: &Env, entries: &mut Vec<RegionalEntry>) {
let n = entries.len();
for i in 0..n {
for j in (i + 1)..n {
Expand All @@ -812,7 +812,7 @@ fn sort_regional_entries_descending(env: &Env, entries: &mut Vec<RegionalEntry>)
}
}

fn sort_achievement_entries_descending(env: &Env, entries: &mut Vec<AchievementEntry>) {
fn sort_achievement_entries_descending(_env: &Env, entries: &mut Vec<AchievementEntry>) {
let n = entries.len();
for i in 0..n {
for j in (i + 1)..n {
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1868,7 +1868,7 @@ impl NebulaNomadContract {
shared_lib::validate_address(&env, auth)
}

pub fn calculate_yield(env: Env, base: i128, multiplier: u32) -> Result<i128, SharedError> {
pub fn calculate_yield(_env: Env, base: i128, multiplier: u32) -> Result<i128, SharedError> {
shared_lib::calculate_yield(base, multiplier)
}

Expand Down Expand Up @@ -2350,7 +2350,7 @@ impl NebulaNomadContract {
}

/// Calculate travel cost between two nebulae.
pub fn calculate_travel_cost(env: Env, origin_nebula: u64, destination: u64) -> u32 {
pub fn calculate_travel_cost(_env: Env, origin_nebula: u64, destination: u64) -> u32 {
wormhole_traveler::calculate_travel_cost(origin_nebula, destination)
}

Expand Down
2 changes: 1 addition & 1 deletion src/metadata_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn validate_api_token(token: &Bytes) -> bool {
/// On Soroban, the actual HTTP POST is performed off-chain via the
/// authorization callback mechanism. This function prepares the payload
/// that the off-chain pinning client consumes.
fn build_pin_request(cid: &Bytes, token_id: u64, replication_factor: u32) -> Bytes {
fn build_pin_request(cid: &Bytes, _token_id: u64, _replication_factor: u32) -> Bytes {
// In Soroban contracts, we store the CID for off-chain pinning.
// The actual HTTP request is made by an external service watching
// the `meta.pinned` event. This function validates and tags the CID.
Expand Down
6 changes: 3 additions & 3 deletions src/migration_framework.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use soroban_sdk::{
contracterror, contracttype, symbol_short, Address, Bytes, Env, Vec, Symbol,
contracterror, contracttype, symbol_short, Address, Bytes, BytesN, Env, Vec, Symbol,
};

// ─── Migration Framework for Soroban Contract Upgrades ──────────────────────
Expand Down Expand Up @@ -350,7 +350,7 @@ pub fn record_migration_completion(
to_version: u32,
record_count: u32,
) {
let record = MigrationRecord {
let _record = MigrationRecord {
id: migration_id,
from_version,
to_version,
Expand All @@ -373,4 +373,4 @@ pub fn record_migration_completion(
);
}

use soroban_sdk::BytesN;

2 changes: 1 addition & 1 deletion src/notifications/alerts.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use soroban_sdk::{symbol_short, Address, Env, Symbol};
use soroban_sdk::{symbol_short, Address, Env};
use crate::notifications::push_service::emit_notification;

pub fn check_low_resources(env: &Env, player: Address, balance: u32, threshold: u32) {
Expand Down
2 changes: 1 addition & 1 deletion src/notifications/push_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct Notification {
}

pub fn emit_notification(env: &Env, player: Address, message: Symbol) {
let notification = Notification {
let _notification = Notification {
user: player.clone(),
message: message.clone(),
timestamp: env.ledger().timestamp(),
Expand Down
7 changes: 3 additions & 4 deletions src/pvp_combat.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use soroban_sdk::{
contracterror, contracttype, symbol_short, Address, BytesN, Env, Map, String, Symbol, Vec,
contracterror, contracttype, symbol_short, Address, Env, Symbol, Vec,
};

// ── Error ─────────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -877,12 +877,11 @@ pub fn leave_matchmaking(env: &Env, player: &Address) -> Result<(), PvPError> {
player.require_auth();

let key = PvPDataKey::MatchmakingQueue;
let mut queue: Vec<MatchmakingEntry> = env
let queue: Vec<MatchmakingEntry> = env
.storage()
.persistent()
.get(&key)
.unwrap_or_else(|| Vec::new(env));

let mut found = false;
let mut new_queue = Vec::new(env);
for i in 0..queue.len() {
Expand Down Expand Up @@ -911,7 +910,7 @@ pub fn leave_matchmaking(env: &Env, player: &Address) -> Result<(), PvPError> {

pub fn process_matchmaking(env: &Env) -> Result<Option<(Address, Address)>, PvPError> {
let key = PvPDataKey::MatchmakingQueue;
let mut queue: Vec<MatchmakingEntry> = env
let queue: Vec<MatchmakingEntry> = env
.storage()
.persistent()
.get(&key)
Expand Down
4 changes: 2 additions & 2 deletions src/recycling_crafter.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use soroban_sdk::{
contracterror, contracttype, symbol_short, vec, Address, Env, Vec, Map, Symbol,
contracterror, contracttype, symbol_short, Address, Env, Vec, Symbol,
};

/// Maximum batch size for recycle/craft operations.
Expand Down Expand Up @@ -197,7 +197,7 @@ pub fn craft_new_item(
let output_quantities = recipe.output_quantities;
for i in 0..recipe.outputs.len() {
let base_qty = output_quantities.get(i).unwrap();
let boosted_qty = (base_qty as f32 * efficiency_multiplier) as u32;
let _boosted_qty = (base_qty as f32 * efficiency_multiplier) as u32;
final_outputs.push_back(recipe.outputs.get(i).unwrap().clone());
}

Expand Down
5 changes: 2 additions & 3 deletions src/resource_minter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
// at the top of mint_resource() before any state mutation.
// • RateLimitHit events are emitted inside check_rate_limit.

#![no_std]
use soroban_sdk::{
contract, contracterror, contractimpl, contracttype, log, symbol_short, Address, Env, String,
contract, contracterror, contractimpl, contracttype, symbol_short, Address, Env,
Symbol,
};

Expand Down Expand Up @@ -63,7 +62,7 @@ pub enum MinterKey {

// ── Error ─────────────────────────────────────────────────────
#[contracterror]
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[repr(u32)]
pub enum MinterError {
/// Amount must be > 0.
Expand Down
Loading