Skip to content

Commit

Permalink
test: new test for new features
Browse files Browse the repository at this point in the history
  • Loading branch information
heswithme committed Oct 17, 2024
1 parent 1d44d6a commit d2a531d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/unitary/rewards_handler/test_process_rewards.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,23 @@ def test_no_rewards(rewards_handler, rate_manager):

with boa.reverts("no rewards to distribute"):
rewards_handler.process_rewards()


def test_snapshots_taking(rewards_handler, rate_manager, crvusd):
rewards_handler.set_distribution_time(1234, sender=rate_manager) # to enable process_rewards
assert rewards_handler.get_len_snapshots() == 0
boa.deal(crvusd, rewards_handler, 1)
rewards_handler.process_rewards()
assert crvusd.balanceOf(rewards_handler) == 0 # crvusd gone
assert rewards_handler.get_len_snapshots() == 1 # first snapshot taken

boa.deal(crvusd, rewards_handler, 1)
rewards_handler.process_rewards()
assert crvusd.balanceOf(rewards_handler) == 0 # crvusd gone (again)
assert rewards_handler.get_len_snapshots() == 1 # not changed since dt has not passed

boa.env.time_travel(seconds=rewards_handler.min_snapshot_dt_seconds())
boa.deal(crvusd, rewards_handler, 1)
rewards_handler.process_rewards()
assert crvusd.balanceOf(rewards_handler) == 0 # crvusd gone (they always go)
assert rewards_handler.get_len_snapshots() == 2 # changed since dt has passed

0 comments on commit d2a531d

Please sign in to comment.