Skip to content

feat: implement metadata security, fund recovery, unfunded escrows and upgrade timelock#216

Merged
Agbeleshe merged 1 commit into
Hub-of-Evolution:mainfrom
0xVida:main
Apr 28, 2026
Merged

feat: implement metadata security, fund recovery, unfunded escrows and upgrade timelock#216
Agbeleshe merged 1 commit into
Hub-of-Evolution:mainfrom
0xVida:main

Conversation

@0xVida
Copy link
Copy Markdown
Contributor

@0xVida 0xVida commented Apr 27, 2026

Overview

This PR addresses four critical issues across security, logic, and UX by enhancing the EscrowContract core logic and storage schema.

1. Metadata Security & Authorization

Updated the metadata reveal functions to require explicit authorization. Only the buyer, seller, or arbitrator of a specific escrow can now trigger these verifications, preventing unauthorized off-chain data leaks.
Closes #210

2. Recovery of Unallocated Funds

Implemented a fund-tracking system using TotalLocked and TotalStaked keys. Added a sweep_unallocated_funds function that allows the admin to recover any tokens sent to the contract address that are not associated with active escrows or stakes.
Closes #212

3. Support for Unfunded Escrows

Upgraded the Escrow struct to Version 3, adding a funded boolean. This enables a two-step creation process where an escrow can be initialized without funds and either funded later via fund_escrow or cleaned up if it remains stale for 24 hours.
Closes #213

4. WASM Upgrade Timelock Enforcement

Renamed the upgrade execution method to execute_upgrade to reflect its governance role and ensured that the timelock ETA is strictly validated before any contract update is performed.
Closes #215

Technical Changes

  • Storage: Incremented CURRENT_ESCROW_VERSION to 3 and added funded: bool to Escrow.
  • New Methods: Added create_unfunded_escrow, fund_escrow, cancel_unfunded_escrow, and sweep_unallocated_funds.
  • Authorization: Added require_auth() and role-based checks to metadata verifications.
  • Migration: Updated get_stored_escrow to automatically migrate legacy (v1/v2) escrows to the new v3 schema.

@Agbeleshe Agbeleshe merged commit ef72627 into Hub-of-Evolution:main Apr 28, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants