Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compensation for V4 publishers: script #343

Open
Ivshti opened this issue Mar 23, 2021 · 0 comments
Open

Compensation for V4 publishers: script #343

Ivshti opened this issue Mar 23, 2021 · 0 comments
Assignees

Comments

@Ivshti
Copy link
Member

Ivshti commented Mar 23, 2021

Implement a script that:

  • scans all known v4 channels (via getting them from ${cfg.validatorUrl}/channel/list, not via DB cause we may run v5 validators in a different setup) and gets the last balance tree map (by getting the latest NewState+ApproveState via /channel/last-approved), and for each record in the tree, subtracts outpaceV4.withdrawnPerUser(channelId, user), and finally sums all the remaining maps - that way we calculate all the un-withdrawn DAI for all users
  • deposits enough USDT from the validator's identity into the main v5 channel (configurable) to cover the entire un-withdrawn amount; should use 1 USDT = 1 DAI exchange rate
  • saves a SpenderAggregate in the DB that spends this deposited amount to distribute it to the users with un-withdrawn funds; should use 1 USDT = 1 DAI exchange rate
  • ensure it can only be ran once - mark the SpenderAggregate somehow (extra prop) so that we first check if it exists, and if so, we quit the script

Few additional notes:

  • yes, it will be possible to double spend by withdrawing on the new channel AND on the new old channels, if there are old channels that are not expired; we do not care about this, so we won't filter for expired channels only
@Ivshti Ivshti changed the title Compensation for v4 publishers: script Compensation for V4 publishers: script Mar 23, 2021
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

No branches or pull requests

2 participants