Skip to content
Merged
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
14 changes: 11 additions & 3 deletions contracts/escrow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,18 @@ impl EscrowContract {

/// Check if a token is allowed.
pub fn is_token_allowed(env: Env, token: Address) -> bool {
env.storage()
let key = DataKey::AllowedToken(token.clone());
let allowed: bool = env
.storage()
.persistent()
.get(&DataKey::AllowedToken(token))
.unwrap_or(false)
.get(&key)
.unwrap_or(false);
if allowed {
env.storage()
.persistent()
.extend_ttl(&key, MATCH_TTL_LEDGERS, MATCH_TTL_LEDGERS);
}
allowed
}

/// Create a new match. Both players must call `deposit` before the game starts.
Expand Down
Loading