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

Adjust monetization frequency for wallets with low asset scale #145

Open
3 tasks
raducristianpopa opened this issue Mar 7, 2024 · 0 comments
Open
3 tasks
Assignees

Comments

@raducristianpopa
Copy link
Member

raducristianpopa commented Mar 7, 2024

Context

Wallets with a low asset scale (eg: USD - scale 2) cannot process payments with a higher asset scale (eg: we cannot send $0.0001 to a wallet address that has an asset scale of 2). The rate of pay slider supports values between between $0 and $1. The default rate of pay is $0.60/hour, resulting in $0.0000167/second. Therefore, the monetization frequency (how often an outgoing payment is created) needs to be adjusted and only send the smallest possible unit of that scale (2 or 1, depending on @interledger/pay - not one of our dependencies - this is the library that is creating the +-1 issue when creating an outgoing payment, used in Rafiki).

Impact: An use-case example of this impact - To prevent overpaying each time a website gets refreshed, when a refresh happens, the extension must check the timestamp of the most recent payment for each valid wallet address on the page to calculate if, how much, and when next to pay the wallet address.

Todos

  • Re-calculate the monetization frequency if we cannot send the monetization amount and only send the smallest possible unit of that scale
  • Add a flag last_payment (saved in extension storage as a timestamp) that will represent when the last payment happened
  • Before creating the outgoing payment, verify the flag:
    • make sure that the current timestamp is greater than last_payment;
    • if the current timestamp is not greater than last_payment do not create the outgoing payment;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

1 participant