Skip to content

Comments

[Feature] Implement Revocable Vesting#54

Merged
JerryIdoko merged 2 commits intoVesting-Vault:mainfrom
gelluisaac:build
Feb 23, 2026
Merged

[Feature] Implement Revocable Vesting#54
JerryIdoko merged 2 commits intoVesting-Vault:mainfrom
gelluisaac:build

Conversation

@gelluisaac
Copy link
Contributor

@gelluisaac gelluisaac commented Feb 23, 2026

closes #1
Implements a revoke(vault_id) function that allows the Admin to revoke vesting for employees who leave before their cliff. Unvested tokens are returned to the Admin, while vested tokens remain claimable by the beneficiary.

Changes

  • Added is_revocable field to Vault struct - Boolean flag indicating whether a vesting schedule can be revoked by admin

  • Added calculate_vested_amount() helper - Calculates linear vesting based on current ledger timestamp between start_time and end_time

  • Implemented revoke(vault_id) function (Admin only):

    • Verifies caller is admin
    • Checks vault is revocable
    • Calculates vested vs unvested amounts
    • Returns unvested tokens to admin balance
    • Marks all tokens as released (beneficiary can claim vested portion)
    • Emits TokensRevoked event with detailed info
  • Updated vault creation functions - create_vault_full() and create_vault_lazy() now accept is_revocable parameter; batch operations default to is_revocable: true

  • Updated TokensRevoked event - Now includes vault_id, vested_amount, unvested_amount, beneficiary, and timestamp

Acceptance Criteria

  • Add is_revocable boolean to VestingSchedule
  • Implement revoke function (Admin only)
  • Calculate vested vs unvested based on linear vesting
  • Send vested to user (marked as claimable), unvested to Admin

Tests Added

  • Revoke before cliff (0% vested)
  • Revoke halfway (50% vested)
  • Revoke after fully vested (100% vested)
  • Non-revocable vault rejection
  • Unauthorized access rejection
  • Double revoke prevention
  • Non-existent vault handling

@JerryIdoko JerryIdoko merged commit 9c63e95 into Vesting-Vault:main Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

# Issue: [Feature] Implement Revocable Vesting

2 participants