Recurring Payments
Last updated
Last updated
In traditional systems, subscription payments are automated and seamless. However, in blockchain environments, smart contracts require explicit calls to operate, posing challenges for background operations. Consequently, processing subscription payments necessitates individual calls to deduct the agreed-upon amount from each subscriber.
To address this, Papaya employs a time series mechanism. By tracking spending and earning rates per second, we can calculate user balances in real-time. Papaya represents each user through incoming and outgoing streams.
To determine the per-second token transfer rate, use the formula: Desired Value / Time (seconds). For example, to receive 30 USDT monthly, calculate as follows:
Despite USDT having 8 decimals, we standardize all tokens to 1e18. Therefore, upon deposit, tokens are multiplied by the appropriate factor to align with this standard.