Skip to content

feat(contract): session storage, lock_funds, dispute window & upgrade#613

Open
authenticeasy-sys wants to merge 1 commit into
MentoNest:mainfrom
authenticeasy-sys:feat/escrow-session-storage-lock-dispute-upgrade
Open

feat(contract): session storage, lock_funds, dispute window & upgrade#613
authenticeasy-sys wants to merge 1 commit into
MentoNest:mainfrom
authenticeasy-sys:feat/escrow-session-storage-lock-dispute-upgrade

Conversation

@authenticeasy-sys
Copy link
Copy Markdown

Summary

Implements four open issues for the Soroban escrow contract.

Changes

#525 — Session struct storage mapping

  • Status enum: Locked | Completed | Approved | Refunded | Disputed | Resolved
  • SessionData struct: buyer, seller, amount, status, created_at, completed_at, dispute_resolved_at
  • Storage key SkillSyncKey::Session(Bytes32) using persistent storage
  • Public helpers get_session(id) and save_session(id, session) (save is admin-gated)

#523 — Lock funds function

  • lock_funds(session_id, buyer, seller, amount, token_id)
  • Buyer require_auth + token transfer to contract
  • Guards: amount > 0, duplicate session ID rejected
  • Emits FundsLocked event

#521 — Dispute window configuration

  • set_dispute_window(window_ledgers: u32) — admin-only
  • get_dispute_window() — returns stored value or default 1000 ledgers
  • Emits DisputeWindowUpdated event

#522 — Upgradeability pattern

  • upgrade(new_wasm_hash: BytesN<32>) — admin-only
  • Calls env.deployer().update_current_contract_wasm()
  • Emits ContractUpgraded event

CI workflow

  • .github/workflows/contract-ci.yml — builds WASM target and runs cargo test on every push/PR touching contract/

Tests

New test module test_skillsync_escrow covers all acceptance criteria: session storage, token transfer, event emission, zero-amount revert, duplicate-session revert, default dispute window, and window update event.

Closes #521
Closes #522
Closes #523
Closes #525

- Add Session struct (Bytes32 key, Status enum, all fields) and
  get_session/save_session helpers — closes MentoNest#525
- Add lock_funds(session_id, buyer, seller, amount, token_id) with
  FundsLocked event, duplicate-session guard, amount > 0 check — closes MentoNest#523
- Add set_dispute_window/get_dispute_window (default 1000 ledgers)
  with DisputeWindowUpdated event, admin-only — closes MentoNest#521
- Add upgrade(new_wasm_hash) admin-only with ContractUpgraded event — closes MentoNest#522
- Add CI workflow (.github/workflows/contract-ci.yml) for contract
  build (wasm32) and test on every PR/push touching contract/
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@authenticeasy-sys Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session struct storage mapping Lock funds function Upgradeability pattern implementation Dispute window configuration

1 participant