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
3 changes: 2 additions & 1 deletion contracts/predict-iq/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,9 @@ impl PredictIQ {
pub fn claim_creation_deposit(
e: Env,
market_id: u64,
caller: Address,
) -> Result<(), ErrorCode> {
crate::modules::markets::claim_creation_deposit(&e, market_id)
crate::modules::markets::claim_creation_deposit(&e, market_id, caller)
}

// Governance and Upgrade Functions
Expand Down
8 changes: 6 additions & 2 deletions contracts/predict-iq/src/modules/markets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,15 @@ pub fn set_creation_deposit(e: &Env, amount: i128) -> Result<(), ErrorCode> {
pub fn claim_creation_deposit(
e: &Env,
market_id: u64,
caller: soroban_sdk::Address,
) -> Result<(), ErrorCode> {
let mut market = get_market(e, market_id).ok_or(ErrorCode::MarketNotFound)?;

// 1. Only the creator can claim their own deposit
market.creator.require_auth();
// Only the creator can claim their own deposit
if caller != market.creator {
return Err(ErrorCode::NotAuthorized);
}
caller.require_auth();

// 2. Market must be fully resolved
if market.status != MarketStatus::Resolved {
Expand Down
Loading