Skip to content

Commit ee2bae8

Browse files
chore: add docs for payment settlement, freeze and resume (#469)
1 parent c88f8cd commit ee2bae8

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

docs/bnb-greenfield/core-concept/billing-payment.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,49 @@ It will also provide a possibility for projects to sponsor the storage and bandw
7474

7575
For more details, you can refer to the [BEP of the paymaster](https://github.com/bnb-chain/BEPs/pull/362).
7676

77+
### Force Settlement, Freeze and Resume
78+
79+
If a user doesn't deposit for a long time, his previous deposit may be
80+
all used up for the stored objects. Greenfield has a forced settlement
81+
mechanism to ensure enough funds are secured for further service fees.
82+
83+
There are two configurations, `ReserveTime` and `ForcedSettleTime`.
84+
85+
Let's take an example where the `ReserveTime` is 7 days and the `ForcedSettleTime` is 1 day.
86+
If a user wants to store an object at the price of
87+
approximately $0.1 per month($0.00000004/second), he must reserve fees
88+
for 7 days in the buffer balance, which is `$0.00000004 * 7 * 86400 =
89+
$0.024192`. If the user deposits is $1 initially, the stream payment
90+
record will be as below:
91+
92+
- **CRUD Timestamp**: 100;
93+
94+
- **Static Balance**: $0.975808;
95+
96+
- **Netflow Rate**: -$0.00000004/sec;
97+
98+
- **Buffer Balance**: $0.024192.
99+
100+
After 10000 seconds, the dynamic balance of the user will be `0.975808 - 10000 * 0.00000004 = 0.975408`.
101+
102+
After 24395200 seconds(approximately 282 days), the dynamic balance of
103+
the user will become negative. Users should have some alarms for such
104+
events that remind them to supply more funds in time.
105+
106+
If no more funds are supplied and the dynamic balance plus buffer
107+
balance is under the forced settlement threshold, the account will be
108+
forcibly settled. All payment streams of the account will be closed and
109+
the account will be marked as frozen. The download speed for all
110+
objects associated with the account or payment account will be
111+
downgraded.
112+
113+
If someone deposits BNB tokens into a frozen payment account and the static balance is
114+
enough for reserved fees, the account will be resumed automatically
115+
(be noted, the deposit is payment deposit, not the general transfer).
116+
Usually, the payment account will be "active" quickly. However, if there
117+
are many outflows associated to the payment account, the payment account will be
118+
queued for resume and handled in the following blocks.
119+
77120
### Downgraded service
78121

79122
Once the payment accounts run out of BNB, the objects associated with these payment accounts will

0 commit comments

Comments
 (0)