livepeer / protocol

Livepeer protocol
MIT License
152 stars 45 forks source link

bonding: Support address + amount params in withdrawFees #511

Closed yondonfu closed 2 years ago

yondonfu commented 2 years ago

What does this pull request do? Explain your changes. (required)

This PR adds support for specifying a recipient address and amount in withdrawFees() in the BondingManager. This feature is required for https://github.com/livepeer/protocol/issues/495.

This is a breaking change to the withdrawFees() function and WithdrawFees() event API and will require the following updates:

The rationale for this breaking change:

May want to consider updating slimming down the BondingManager and TicketBroker further by removing *for* functions in favor of accepting args, but we can consider that after completing the current set of tasks to get to feature complete milestone.

Specific updates (required)

See commit history.

How did you test each of these updates (required)

Updated tests.

Does this pull request close any open issues?

Fixes #503

Checklist:

kautukkundan commented 2 years ago

How about we add a test case validating this order of events?

  1. claims fees partially
  2. more fees is rewarded
  3. claims again (fully or partially)

and check if the saved/claimed fees is correct.

yondonfu commented 2 years ago

How about we add a test case validating this order of events?

Added the following test cases in dd72a12:

Will rebase to resolve conflicts after the above commit is reviewed.