Skip to content

forge-vesting — add test verifying pause() and unpause() shift start_time correctly and tokens accrue only for active time #334

@Austinaminu2

Description

@Austinaminu2

Summary

unpause() shifts start_time forward by the pause duration:

let delta = now.saturating_sub(config.paused_at);
config.start_time = config.start_time.saturating_add(delta);

There is no test verifying this shift produces correct vesting amounts. If the shift is wrong, paused time would count toward vesting which is incorrect.

Tasks

  • Initialize with cliff=0, duration=1000, total=10_000, at t=0
  • At t=200, pause (should have 2_000 vested, 8_000 remaining)
  • At t=400, unpause (paused for 200s — start_time shifts to 200)
  • At t=600, assert vested = 10_000 * (600-200)/1000 = 4_000 (200s active pre-pause + 200s active post-resume)
  • Call claim() at t=600 and assert it returns 4_000
  • At t=1200 (equivalent to 1000 active seconds), assert fully_vested == true

Labels: testing, forge-vesting

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave program

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions