Skip to content

Commit f8f07a1

Browse files
author
Collins C Augustine
committed
feat: implement Trade Insurance Integration
1 parent 0fbc1e2 commit f8f07a1

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

contract/src/lib.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@ impl StellarEscrowContract {
323323
let resolution = multisig::resolve_expired_dispute(&env, trade_id, &admin)?;
324324
let trade = get_trade(&env, trade_id)?;
325325
StellarEscrowContract::execute_dispute_resolution(env, trade_id, resolution, trade)
326-
// Arbitrator Reputation
326+
}
327+
327328
// -------------------------------------------------------------------------
328329

329330
/// Rate the arbitrator of a disputed trade (buyer or seller, once each).
@@ -1000,7 +1001,10 @@ impl StellarEscrowContract {
10001001
save_trade(&env, trade_id, &trade);
10011002
events::emit_trade_cancelled(&env, trade_id);
10021003
analytics::on_trade_cancelled(&env);
1003-
Ok(()): anyone can call this once the expiry has
1004+
Ok(())
1005+
}
1006+
1007+
/// anyone can call this once the expiry has
10041008
/// passed and the trade is Funded or Completed (not Disputed/Cancelled).
10051009
/// Funds are released to the seller minus the platform fee.
10061010
pub fn claim_time_release(env: Env, trade_id: u64) -> Result<(), ContractError> {
@@ -1179,23 +1183,14 @@ impl StellarEscrowContract {
11791183
events::emit_unpaused(&env, admin);
11801184
Ok(())
11811185
}
1182-
11831186
/// Emergency withdrawal of all contract token balance (admin only).
1184-
pub fn emergency_withdraw(env: Env, to: Address) -> Result<(), ContractError> {
1185-
if !is_initialized(&env) {
1186-
return Err(ContractError::NotInitialized);
1187-
}
1188-
let admin = get_admin(&env)?;
1189-
admin.require_auth();
1190-
let token = get_usdc_token(&env)?;
1191-
let token_client = token::Client::new(&env, &token);
11921187
/// Allowed even while paused so funds can always be recovered.
11931188
pub fn emergency_withdraw(env: Env, to: Address) -> Result<(), ContractError> {
11941189
require_initialized(&env)?;
11951190
let admin = get_admin(&env)?;
11961191
admin.require_auth();
11971192
let token = get_usdc_token(&env)?;
1198-
let token_client = TokenClient::new(&env, &token);
1193+
let token_client = token::Client::new(&env, &token);
11991194
let balance = token_client.balance(&env.current_contract_address());
12001195
if balance > 0 {
12011196
token_client.transfer(&env.current_contract_address(), &to, &balance);

0 commit comments

Comments
 (0)