Skip to content

Implement Share Transfer Lock-Up Period After Deposit #103

@Jayy4rl

Description

@Jayy4rl

Description

RWA securities typically have lock-up periods where shares cannot be transferred or redeemed for a specified duration after purchase. The current contract allows immediate transfer of shares after deposit — a user can deposit, receive shares, and transfer them in the same ledger. This undermines:

  1. Regulatory compliance — many jurisdictions require holding periods for securities
  2. Anti-speculation — prevents deposit-and-flip arbitrage
  3. Yield fairness — prevents gaming the epoch snapshot system by depositing just before a yield distribution and transferring immediately after

Requirements

  • Add a lock_up_period: u64 field to InitParams (seconds after deposit during which shares are non-transferable)
  • Store DataKey::DepositTimestamp(Address) → u64 — the timestamp of the user's last deposit
  • In transfer, transfer_from, withdraw, redeem, and request_early_redemption: check that e.ledger().timestamp() >= deposit_timestamp + lock_up_period
  • redeem_at_maturity should bypass the lock-up (the vault has matured, users must be able to exit)
  • Add error variant: Error::SharesLocked
  • Add a view function: lock_up_remaining(user: Address) -> u64
  • Allow admin to update lock_up_period for future deposits (existing deposits keep their original lock-up)

Key Files

  • types.rsInitParams new field
  • lib.rstransfer, transfer_from, withdraw, redeem, request_early_redemption
  • storage.rs — new LockUpPeriod, DepositTimestamp(Address) keys
  • errors.rs — new SharesLocked variant

Definition of Done

  • Shares cannot be transferred or redeemed during lock-up
  • Lock-up is configurable at construction and updatable by admin
  • redeem_at_maturity bypasses lock-up
  • View function shows remaining lock-up time
  • Tests cover lock-up enforcement and bypass scenarios

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions