Skip to content

[Contract] Implement Token Lock/Unlock and Ownership Percentage #469

@yusuftomilola

Description

@yusuftomilola

Allows token holders to be temporarily locked (e.g. during a voting window or vesting period), preventing token transfers.

Requirements

lock_tokens(env, asset_id, holder, until_timestamp) — Stores a lock record for the holder until the given ledger timestamp.

unlock_tokens(env, asset_id, holder) — Removes the lock record.

Transfer gate: In transfer_tokens, before executing, check if the from address has an active lock. If env.ledger().timestamp() < lock.until_timestamp, return Error::TokensLocked.

is_tokens_locked(env, asset_id, holder) — Read-only check.

Acceptance Criteria

  • Locked tokens cannot be transferred
  • Lock expires automatically when timestamp passes (checked in transfer)
  • unlock_tokens clears the lock regardless of timestamp

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions