DGX's fees calculation
demurrage_base(default to 10000000) and
demurrage_rate(default to 165)
last_demurrage_payment_timestamp(in seconds), which is initialized to be the current time when A first receives any DGXs
days_elapsed = (current_time - last_demurrage_payment_timestamp) / ONE_DAY_DURATION_IN_SECONDS
demurrage_fees = days_elapsed * user_balance * demurrage_rate / demurrage_base
As such, the new
last_demurrage_payment_timestamp += days_elapsed * ONE_DAY_DURATION_IN_SECONDS
last_demurrage_payment_timestampis not necessarily the current timestamp.
last_demurrage_payment_timestampis 27 hours ago, then we will deduct A's demurrage for 1 day, and update his
last_demurrage_timestampto be 27 - 24 = 3 hours ago
function calculateDemurrage(uint256 _initial_balance, uint256 _days_elapsed) public view returns (uint256 _demurrage_fees, bool _no_demurrage_fees)
_demurrage_feesis the demurrage fees for a DGX balance of
_initial_balanceover a period of
_days_elapseddays, if demurrage is turned on.
_no_demurrage_feesis true if global demurrage fees is currently turned off.
balanceOfof the DGX Token contract
balanceOfof the DGX Token contract always takes into account the demurrage fees up until the current time, as if demurrage has just been deducted.
transfer_fees_base(default to 10000) and
transfer_fees_rate(default to 13)
transfer_fees = transfer_amount * transfer_fees_rate / transfer_fees_base
XDGXs to B, A's balance will be deducted
Xand B's balance will increase
X - transfer_fees.
transfer_feeswill go to
All the configurations related to the DGX token (such as the
transfer_fees_rate,...) can be read from this contract: link to etherscan