Skip to content
Closed
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
1 change: 1 addition & 0 deletions contracts/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Rust's output directory
target
test_snapshots

# Local settings
.soroban
Expand Down
30 changes: 30 additions & 0 deletions contracts/build-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -e

# Run from workspace root (contracts/) - script lives in contracts/
cd "$(dirname "$0")"
WASM_OUT="target/wasm32-unknown-unknown/release/boxmeout.wasm"
DEST_DIR=".." # project root (BOXMEOUT_STELLA)

echo "🏗️ Building Market contract..."
cargo build --release --target wasm32-unknown-unknown -p boxmeout --features market --no-default-features
cp "$WASM_OUT" "$DEST_DIR/market.wasm"

echo "🏗️ Building Oracle contract..."
cargo build --release --target wasm32-unknown-unknown -p boxmeout --features oracle --no-default-features
cp "$WASM_OUT" "$DEST_DIR/oracle.wasm"

echo "🏗️ Building AMM contract..."
cargo build --release --target wasm32-unknown-unknown -p boxmeout --features amm --no-default-features
cp "$WASM_OUT" "$DEST_DIR/amm.wasm"

echo "🏗️ Building Factory contract..."
cargo build --release --target wasm32-unknown-unknown -p boxmeout --features factory --no-default-features
cp "$WASM_OUT" "$DEST_DIR/factory.wasm"

echo "🏗️ Building Treasury contract..."
cargo build --release --target wasm32-unknown-unknown -p boxmeout --features treasury --no-default-features
cp "$WASM_OUT" "$DEST_DIR/treasury.wasm"

echo "✅ All 5 contracts built successfully!"
ls -lh "$DEST_DIR"/*.wasm
3 changes: 2 additions & 1 deletion contracts/contracts/boxmeout/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ crate-type = ["cdylib", "rlib"]
# cargo build --target wasm32-unknown-unknown --release --features factory
# cargo build --target wasm32-unknown-unknown --release --features treasury
[features]
# No default - you MUST specify which contract to build
default = ["testutils"]
# Use --no-default-features when building individual contracts for deployment
market = []
oracle = []
amm = []
Expand Down
9 changes: 6 additions & 3 deletions contracts/contracts/boxmeout/src/amm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,12 @@ impl AMM {
}

// Calculate trading fee (20 basis points = 0.2%)
let trading_fee_bps: u128 = env
let trading_fee: u32 = env
.storage()
.persistent()
.get(&Symbol::new(&env, TRADING_FEE_KEY))
.unwrap_or(20);
let trading_fee_bps: u128 = trading_fee as u128;

let fee_amount = (amount * trading_fee_bps) / 10000;
let amount_after_fee = amount - fee_amount;
Expand Down Expand Up @@ -356,11 +357,12 @@ impl AMM {
};

// Calculate trading fee (20 basis points = 0.2%)
let trading_fee_bps: u128 = env
let trading_fee: u32 = env
.storage()
.persistent()
.get(&Symbol::new(&env, TRADING_FEE_KEY))
.unwrap_or(20);
let trading_fee_bps: u128 = trading_fee as u128;

let fee_amount = (payout * trading_fee_bps) / 10000;
let payout_after_fee = payout - fee_amount;
Expand Down Expand Up @@ -677,11 +679,12 @@ impl AMM {
}

// Get trading fee (default 20 basis points = 0.2%)
let trading_fee_bps: u128 = env
let trading_fee: u32 = env
.storage()
.persistent()
.get(&Symbol::new(&env, TRADING_FEE_KEY))
.unwrap_or(20);
let trading_fee_bps: u128 = trading_fee as u128;

let total_liquidity = yes_reserve + no_reserve;

Expand Down
16 changes: 8 additions & 8 deletions contracts/contracts/boxmeout/src/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,42 +156,42 @@ impl MarketFactory {
}

/// Get market info by market_id
pub fn get_market_info(env: Env, market_id: BytesN<32>) {
pub fn get_market_info(_env: Env, _market_id: BytesN<32>) {
todo!("See get market info TODO above")
}

/// Get all active markets (paginated)
pub fn get_active_markets(env: Env, offset: u32, limit: u32) -> Vec<Symbol> {
pub fn get_active_markets(_env: Env, _offset: u32, _limit: u32) -> Vec<Symbol> {
todo!("See get active markets TODO above")
}

/// Get user's created markets
pub fn get_creator_markets(env: Env, creator: Address) {
pub fn get_creator_markets(_env: Env, _creator: Address) {
todo!("See get creator markets TODO above")
}

/// Get market resolution
pub fn get_market_resolution(env: Env, market_id: BytesN<32>) -> Symbol {
pub fn get_market_resolution(_env: Env, _market_id: BytesN<32>) -> Symbol {
todo!("See get market resolution TODO above")
}

/// Admin: Pause market creation (emergency)
pub fn set_market_creation_pause(env: Env, paused: bool) {
pub fn set_market_creation_pause(_env: Env, _paused: bool) {
todo!("See set market creation pause TODO above")
}

/// Get factory statistics
pub fn get_factory_stats(env: Env) {
pub fn get_factory_stats(_env: Env) {
todo!("See get factory stats TODO above")
}

/// Get collected fees
pub fn get_collected_fees(env: Env) {
pub fn get_collected_fees(_env: Env) {
todo!("See get collected fees TODO above")
}

/// Admin function: Withdraw collected fees to treasury
pub fn withdraw_fees(env: Env, amount: i128) {
pub fn withdraw_fees(_env: Env, _amount: i128) {
todo!("See withdraw fees TODO above")
}
}
1 change: 1 addition & 0 deletions contracts/contracts/boxmeout/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Soroban WASM smart contracts for prediction market platform on Stellar

#![no_std]
#![allow(deprecated)] // TODO: migrate env.events().publish() to #[contractevent]

// ============================================================================
// CONTRACT MODULES - Conditionally compiled based on features
Expand Down
Loading
Loading