-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
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 latestNewState+ApproveStatevia/channel/last-approved), and for each record in the tree, subtractsoutpaceV4.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
SpenderAggregatein 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
SpenderAggregatesomehow (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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels