Skip to content

[Feature] Add escrow contract upgrade authority — allow contract admin to migrate state to a new contract version #109

Description

@Dami24-hub

Context

contracts/escrow/src/lib.rs has no upgrade mechanism. When the escrow logic needs to change (e.g., adding partial release), all existing escrows using the old contract address are frozen in the old version. Soroban supports env.deployer().update_current_contract_wasm() for in-place upgrades.

Technical Requirements

  • Add DataKey::Admin and an admin: Address parameter to initialize
  • Add pub fn upgrade(env: Env, admin: Address, new_wasm_hash: BytesN<32>) requiring admin.require_auth() and admin == stored_admin
  • The upgrade should only be allowed when Released == false (funds still locked) — otherwise there is nothing to migrate
  • Add tests: test_upgrade_by_admin_succeeds, test_upgrade_by_non_admin_panics, test_upgrade_after_release_panics

Definition of Done

  • upgrade function exists in lib.rs
  • DataKey::Admin is a new storage key
  • ≥ 3 tests pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programenhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions