Not logged in
SOROBAN • RUST • WASM

🔄 DEX Contract

Automated Market Maker — OLIGHFT SMART COIN Mastercard Tier Smart Contract

MC DEX AMM
OLIGHFT SMART COIN Liquidity Protocol
📊
Contract ID
CCMC5DEX8QK3AMMNTF6EHJG9SVX4PLQ
Network
Stellar Testnet
Model
x*y=k AMM
Swap Fee
0.3%
SOROBAN RUNTIME v21
Total Pools
32
TVL
$4.2M
Total Swaps
247K

💧 Liquidity Pools

⭐ XLM / USDC
TVL$1.8M
APY12.4%
24h Vol$342K
Fee Tier0.3%
💎 wETH / XLM
TVL$980K
APY8.7%
24h Vol$218K
Fee Tier0.3%
🔶 wBTC / USDC
TVL$720K
APY6.2%
24h Vol$156K
Fee Tier0.3%
💵 USDC / EURC
TVL$680K
APY3.1%
24h Vol$176K
Fee Tier0.05%

📝 Contract Source

Rust — dex.rs
#![no_std]
use soroban_sdk::{
    contract, contractimpl, contracttype,
    Address, Env, token,
};

#[contracttype]
pub struct Pool {
    pub token_a: Address,
    pub token_b: Address,
    pub reserve_a: i128,
    pub reserve_b: i128,
    pub total_shares: i128,
    pub fee_bps: u32,
}

#[contract]
pub struct McSwapDex;

#[contractimpl]
impl McSwapDex {
    /// Create a new liquidity pool
    pub fn create_pool(
        env: Env, admin: Address,
        token_a: Address, token_b: Address,
        fee_bps: u32,
    ) -> Pool {
        admin.require_auth();
        let pool = Pool {
            token_a, token_b,
            reserve_a: 0, reserve_b: 0,
            total_shares: 0, fee_bps,
        };
        // Store pool in persistent storage
        pool
    }

    /// Add liquidity and receive LP shares
    pub fn add_liquidity(
        env: Env, user: Address,
        amount_a: i128, amount_b: i128,
    ) -> i128 {
        user.require_auth();
        // Transfer tokens to pool
        // Calculate LP shares: sqrt(amount_a * amount_b)
        // Mint LP tokens to user
        0 // returns shares minted
    }

    /// Swap token_a for token_b (or vice versa)
    pub fn swap(
        env: Env, user: Address,
        token_in: Address, amount_in: i128,
        min_out: i128, // slippage protection
    ) -> i128 {
        user.require_auth();

        // x * y = k constant product formula
        // fee = amount_in * fee_bps / 10000
        // amount_out = reserve_b - (k / (reserve_a + net_in))

        assert!(amount_out >= min_out, "slippage exceeded");
        amount_out
    }

    /// Remove liquidity by burning LP shares
    pub fn remove_liquidity(
        env: Env, user: Address, shares: i128,
    ) -> (i128, i128) {
        user.require_auth();
        // Proportional withdrawal
        (0, 0)
    }

    /// Get swap quote without executing
    pub fn get_quote(
        env: Env, token_in: Address, amount_in: i128,
    ) -> i128 { 0 }
}

⚙️ Contract Functions

FunctionDescriptionAuthGas (XLM)
create_poolInitialize a new token pair poolAdmin~0.018
add_liquidityDeposit tokens, receive LP sharesUser~0.014
remove_liquidityBurn LP shares, withdraw tokensUser~0.012
swapExchange one token for anotherUser~0.010
get_quotePreview swap output (read-only)None~0.001
get_reservesQuery pool reservesNone~0.001
get_priceCurrent spot price of pairNone~0.001
collect_feesWithdraw accrued protocol feesAdmin~0.008

✨ Mastercard DEX Features

📊

x*y=k AMM

Constant product market maker for trustless swaps

CORE
💧

LP Shares

Earn swap fees proportional to your liquidity

YIELD
🛡️

Slippage Guard

min_out parameter prevents sandwich attacks

SAFETY

Atomic Swaps

All-or-nothing execution in single transaction

ATOMIC
💱

Multi-Fee Tiers

0.05% stablecoins, 0.3% standard, 1% exotic

FLEXIBLE
🔍

On-Chain Quotes

Query swap output before executing

PREVIEW

💰 Mastercard Staking Contract

Stake $50 to activate your Mastercard tier and earn $3 daily rewards. Choose your contract period:

Activation Stake
$50
Daily Earnings
$3 / day
Service Fee
$20
Contract Period
3 Months
90 Days
Total Payout$270
Stake + Fee-$70
Net Profit
$200
POPULAR
Contract Period
6 Months
180 Days
Total Payout$540
Stake + Fee-$70
Net Profit
$470
BEST VALUE
Contract Period
1 Year
365 Days
Total Payout$1,095
Stake + Fee-$70
Net Profit
$1,025

⚡ Activate Mastercard Staking

Select your contract period and enter your sponsor code to activate:
Required — commissions flow through 8-generation binary tree
You Pay
$70
$50 stake + $20 fee
Period
180 days
Net Profit
$470
Stellar Testnet • Transaction requires wallet signature

📋 How It Works

1
Stake $50 to Activate
Deposit $50 to activate your Mastercard tier staking contract
2
Choose Your Period
Select 3 months (90 days), 6 months (180 days), or 1 year (365 days)
3
Earn $3 Daily
Receive $3 in rewards every day for your chosen contract period
4
$20 System Service Fee
A one-time $20 service fee is deducted for platform maintenance
5
Collect Your Rewards
3mo: $270 ($200 profit) • 6mo: $540 ($470 profit) • 1yr: $1,095 ($1,025 profit)

🌳 $50 Activation Fee Distribution — 8-Generation Binary Tree

When a user activates with $50, the fee is distributed across the 8-level upline binary tree:

GenerationRoleCommissionAmount
Main Wallet (Platform)$30
Gen 1Direct Inviter10%$5
Gen 2Inviter’s Inviter6%$3
Gen 3Upline Level 34%$2
Gen 4Upline Level 44%$2
Gen 5Upline Level 54%$2
Gen 6Upline Level 64%$2
Gen 7Upline Level 74%$2
Gen 8Upline Level 84%$2
TOTAL$50
🌳
Binary Tree Structure: Each user has 2 direct slots (left & right). Commissions flow upward through 8 generations. If an upline slot is empty, that generation’s commission rolls to the main wallet.

📜 Staking Contract Source

Rust — mc_staking.rs
#[contracttype]
pub struct McStake {
    pub staker: Address,
    pub stake_amount: i128,      // $50 activation
    pub daily_reward: i128,      // $3 per day
    pub duration_days: u32,     // 90 | 180 | 365 days
    pub service_fee: i128,      // $20 platform fee
    pub sponsor: Address,       // direct inviter (Gen 1)
    pub start_time: u64,
    pub claimed_days: u32,
}

// 8-generation binary tree commission rates (in $)
const GEN_COMMISSIONS: [i128; 8] = [
    5_0000000,  // Gen 1: $5 (direct inviter)
    3_0000000,  // Gen 2: $3
    2_0000000,  // Gen 3: $2
    2_0000000,  // Gen 4: $2
    2_0000000,  // Gen 5: $2
    2_0000000,  // Gen 6: $2
    2_0000000,  // Gen 7: $2
    2_0000000,  // Gen 8: $2
];  // Total referral: $20 | Main wallet: $30 | Grand total: $50

#[contractimpl]
impl McSwapDex {

    /// Activate Mastercard staking — $50 deposit + $20 service fee
    /// duration: 90 (3 mo) | 180 (6 mo) | 365 (1 yr)
    /// $50 split: $30 main wallet + $20 across 8-gen binary tree
    pub fn activate_stake(
        env: Env, staker: Address, sponsor: Address, duration: u32,
    ) {
        staker.require_auth();
        assert!(duration == 90 || duration == 180 || duration == 365,
                "invalid period");

        let token = get_payment_token(&env);
        let tok = token::Client::new(&env, &token);
        let activation = 50_0000000;  // $50
        let fee = 20_0000000;         // $20 service fee

        // Transfer $50 + $20 fee from user to contract
        tok.transfer(&staker, &env.current_contract_address(),
                     &(activation + fee));

        // ── Distribute $50 activation across binary tree ──
        let main_wallet = get_main_wallet(&env);
        let mut remaining = activation; // $50
        let mut current = sponsor.clone();

        for gen in 0..8 {
            let commission = GEN_COMMISSIONS[gen];
            if let Some(upline) = get_sponsor(&env, ¤t) {
                tok.transfer(
                    &env.current_contract_address(),
                    ¤t, &commission,
                );
                remaining -= commission;
                current = upline;
            } else {
                // No upline — remaining goes to main wallet
                break;
            }
        }

        // Send remainder ($30 or more) to main wallet
        tok.transfer(
            &env.current_contract_address(),
            &main_wallet, &remaining,
        );

        let stake = McStake {
            staker: staker.clone(),
            stake_amount: activation,
            daily_reward: 3_0000000,  // $3/day
            duration_days: duration,
            service_fee: fee,
            sponsor: sponsor.clone(),
            start_time: env.ledger().timestamp(),
            claimed_days: 0,
        };
        env.storage().persistent().set(&staker, &stake);
    }

    /// Claim accrued daily rewards
    pub fn claim_rewards(env: Env, staker: Address) -> i128 {
        staker.require_auth();
        let mut stake: McStake = env.storage().persistent().get(&staker).unwrap();

        let elapsed = (env.ledger().timestamp() - stake.start_time) / 86400;
        let claimable = elapsed.min(stake.duration_days as u64) as u32
                        - stake.claimed_days;

        let payout = (claimable as i128) * stake.daily_reward;
        stake.claimed_days += claimable;
        env.storage().persistent().set(&staker, &stake);

        // Transfer rewards to staker
        token::Client::new(&env, &get_payment_token(&env))
            .transfer(&env.current_contract_address(), &staker, &payout);
        payout  // 90d→$270 | 180d→$540 | 365d→$1,095
    }
}
FunctionDescriptionAuthCost
activate_stakeDeposit $50 + $20 fee, choose period (90/180/365 days)User$70 total
claim_rewardsClaim accrued $3/day rewardsUser~0.01 XLM
get_sponsorGet upline address for a given userNone~0.001 XLM

🧪 Unit Test

Rust — test.rs
#[test]
fn test_swap_constant_product() {
    let env = Env::default();
    env.mock_all_auths();
    let client = McSwapDexClient::new(&env,
        &env.register_contract(None, McSwapDex));

    // Add liquidity: 10000 XLM + 5000 USDC
    client.add_liquidity(&lp, &10000_0000000, &5000_0000000);

    // Swap 100 XLM for USDC
    let out = client.swap(&user, &xlm, &100_0000000, &40_0000000);
    assert!(out >= 40_0000000, "min_out not met");

    // Verify k is preserved (with fees)
    let (r_a, r_b) = client.get_reserves();
    assert!(r_a * r_b >= 10000_0000000 * 5000_0000000);
}
🏠 Home 💳 Wallet ⚙️ Admin 🔒 Login 🏆 Gold Token 💳 Visa Payment 🔄 MC DEX 🏛️ Amex DAO ⛏️ Plat Staking 🗄️ Black Vault

OLIGHFT SMART COIN MC DEX Contract v2.1.0 • Stellar Testnet • Rust/WASM

Built with soroban-sdk 21.0.0 • April 2026

🧪 Email Code Verification Tests

Code Generation
1. Code is 6 digits
_genEmailCode() returns exactly 6 numeric chars
pending
2. Code is numeric only
No letters or special chars
pending
3. Different codes each call
Two consecutive calls produce different codes
pending
Verification Logic
4. Correct code passes
Matching code accepted
pending
5. Wrong code rejected
Mismatched code shows error
pending
6. Partial code rejected
Less than 6 digits not accepted
pending
7. Empty code rejected
No input shows error message
pending
8. Old code invalid after new gen
Previous code no longer works
pending
Modal UI Flow
9. Modal opens on withdraw
requireVerify shows overlay
pending
10. Cancel closes modal
cancelW2fa hides overlay and clears pending
pending
11. Email badge shown
Email method displays correct badge
pending
12. Demo code shown in timer text
Timer area displays the demo code for testing
pending
Security
13. Pending cleared after verify
_w2faPending is null after successful confirm
pending
14. Google Auth hidden when not set up
Gauth button hidden if cw_2fa not enabled
pending
15. Withdraw blocked without verify
withdrawCardStake calls requireVerify, not _doWithdraw directly
pending

🛡️ Wallet Security Tests

Security Toggles
1. Toggle 2FA Persists to cw_security
toggleSec writes tog2fa=true to cw_security JSON
pending
2. Toggle Withdrawal Lock Off/On
togLock key toggles between true and false
pending
3. restoreSecToggles Restores Saved State
Reading cw_security restores each toggle correctly
pending
4. All 5 Toggles Write Independent Keys
tog2fa, togEmail, togSms, togWhitelist, togLock each stored separately
pending
Seed & Key Storage
5. Seed Stored as Base64
cw_seed is btoa(mnemonic) and decodes to space-separated words
pending
6. Secret Key Stored as Base64
cw_secret decodes to a string starting with S
pending
7. seedContinue Clears Mnemonic From Memory
After continue, in-memory mnemonic variable is empty string
pending
Single-Signer Auth
8. Master Key Weight = 255
SetOptions config uses masterWeight 255
pending
9. All Thresholds = 1
low, med, high thresholds all set to 1
pending
10. msCreateTx Signs Instantly
Transaction stored with weight 255/1 and created immediately
pending
11. No Additional Signers Allowed
SetOptions preview contains no addSigner operations
pending
Logout & Input Guards
12. Logout Clears All Sensitive Keys
cw_user, cw_seed, cw_secret, cw_accounts, cw_security all removed
pending
13. Accounts Stored as Base64 JSON
cw_accounts decodes to valid JSON array with publicKey fields
pending
14. Terms Checkbox Required for Register
register() rejects when agreeTerms is unchecked
pending
15. Password Mismatch Blocks Register
register() rejects when pass !== confirm
pending

🔒 Verify Withdrawal

Confirm your identity before withdrawing funds
🔐 Google Authenticator