Skip to content

Issue #3: [Feature] Add update_vault, close_vault, and cancel_escrow functions #3

Description

@GoodnessJohn

Description:

Currently, once a tenant calls create_vault, the vault is permanent and immutable. There is no way to:

Change the designated landlord (e.g., tenant moves)
Adjust the savings goal or lock period (e.g., rent changes)
Close the vault and recover remaining funds
Cancel a pending escrow before lock_until (e.g., lease dispute, landlord agreement)
This makes the contract unusable for real-world tenancy life cycles.

Proposed additions:

// Update vault parameters (tenant auth required)
pub fn update_vault(env, tenant, new_landlord?, new_target?, new_monthly_target?) -> Result<(), Error>

// Close vault — withdraw remaining balance and delete storage entry
pub fn close_vault(env, tenant) -> Result<(), Error>

// Cancel escrow by mutual agreement (both tenant + landlord auth)
pub fn cancel_escrow(env, tenant, landlord, escrow_id) -> Result<(), Error>
Acceptance criteria:

update_vault allows changing landlord, target goal, and monthly target
close_vault drains balance back to tenant and clears the storage entry
cancel_escrow requires both parties' signatures and refunds tenant
All new functions respect the is_paused check
Unit tests cover happy paths and auth failure cases

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions