Skip to content

Commit

Permalink
Add tests to check RewardsWithdrawn is emitted
Browse files Browse the repository at this point in the history
  • Loading branch information
manumonti committed Aug 27, 2024
1 parent d2a09c6 commit 5d38e7f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/application/test_reward.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,19 @@ def test_withdraw(accounts, token, threshold_staking, taco_application, child_ap
assert token.balanceOf(beneficiary) == earned
assert token.balanceOf(taco_application.address) == reward_portion - earned

events = taco_application.RewardPaid.from_receipt(tx)
assert events == [
reward_paid_events = taco_application.RewardPaid.from_receipt(tx)
assert reward_paid_events == [
taco_application.RewardPaid(
stakingProvider=staking_provider,
beneficiary=beneficiary,
reward=earned,
sender=beneficiary,
)
]
rewards_withdrawn_events = taco_application.RewardsWithdrawn.from_receipt(tx)
assert rewards_withdrawn_events == [
taco_application.RewardsWithdrawn(stakingProvider=staking_provider, amount=earned)
]

# Add one more staking provider, push reward again and drop operator
chain.pending_timestamp += min_operator_seconds
Expand Down Expand Up @@ -430,15 +434,19 @@ def test_withdraw(accounts, token, threshold_staking, taco_application, child_ap
assert token.balanceOf(beneficiary) == earned + new_earned
assert token.balanceOf(taco_application.address) == 2 * reward_portion - earned - new_earned

events = taco_application.RewardPaid.from_receipt(tx)
assert events == [
reward_paid_events = taco_application.RewardPaid.from_receipt(tx)
assert reward_paid_events == [
taco_application.RewardPaid(
stakingProvider=staking_provider,
beneficiary=beneficiary,
reward=new_earned,
sender=reward_contract,
)
]
rewards_withdrawn_events = taco_application.RewardsWithdrawn.from_receipt(tx)
assert rewards_withdrawn_events == [
taco_application.RewardsWithdrawn(stakingProvider=staking_provider, amount=new_earned)
]

# Reset reward contract
taco_application.setRewardContract(ZERO_ADDRESS, sender=creator)
Expand Down

0 comments on commit 5d38e7f

Please sign in to comment.