Fungible Token Fixed Supply #97
Replies: 3 comments 1 reply
-
|
You can't iterate through the owner directory because that is potentially unbounded work for a transactor. You can't really keep the total because there is no guarantee the math will work out due to finite precision. You can already accomplish this by creating an issuing account, allowing rippling by default, and extending trust to other accounts that totals the desired maximum issued amount (or just issuing the desired amount), and then blackholing the issuing account. |
Beta Was this translation helpful? Give feedback.
-
|
Deleted unfeasible approaches. See Approach 2 for the new method. |
Beta Was this translation helpful? Give feedback.
-
|
This discussion has not been updated in over a year and will be closed in 30 days if there is no further activity. If you would like to continue this discussion, please add a comment. Otherwise, this discussion will be automatically closed and locked. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Fungible Token Fixed Supply
Requirements:
Ensure that an issuer can only issue a fixed number of tokens by implementing a fixed supply policy.
Goal:
Create trust and predictability in the cryptocurrency market, as users can be assured that the supply of their chosen currency is fixed and the value of their holdings will not be diluted by unexpected inflation.
Problem statements:
Account needs to be blackholed to ensure a fixed supply
5. Fees burnt today
6. Re-issue tokens that were "burned" by being sent (returned) directly to the issuer
Public trust: the issuer may or may not blackhole the account sufficiently for the community to follow accurately.7.
The current mechanism is to use a recommended address that is publically recognizedWorkflow Example
If a fixed supply limit has been set for a token, then the issuer cannot issue more than the specified limit. There are two main transactions that involve tokens:
PaymentandOfferCreate.Here is a sample workflow of how supply limit interact with these transactions:
TrustLineto Alice forUSDtokenUSDto Bob through aPaymenttransactionUSDUSDUSD, and is successfulOfferCreatetransaction of params:USDand TakerPays is 100XRPOfferhas not been consumed immediately, but we know if Alice sets her offering to 150USD, then there is a possibility that in the future, her total amount of issuedUSDwill reach 250 (considering she has already issued 100USDto Bob), which goes over the supply limit (200USD)OfferCreatetransaction of params:USDand TakerPays is 100XRPOfferbecomes fully consumed in the future, the total amount ofUSDAlice issues will total up to 180, which is less than the limit (200USD)Hence, whenever a token is issued through new
OfferCreateorPaymenttransactions, the resulting balance(or potential balance in the case of Offers) of the token needs to be compared with the fixed supply limit.Design/Implementation
To find the current balance of a token, we must iterate through the owner directory of the account to find the total amount of an issued currency. Below is a pseudo code to find the total amount of USD that an account has issued:
When the issuer creates a new
Paymenttransaction with USD, we must make sureWhen the issuer creates a new
OfferCreatetransaction with USD as the currency forTakerGets, we must make sureApproaches
Approach 1: New
FungibleTokenledger objectSince there isn’t anywhere on the ledger that keeps track of a fungible token in one place, we will introduce a new object type called
FungibleTokento keep track of the information for a token. It would have a schema similar to the following:With this approach, each fungible token has its own object on the ledger and does not need to populate other objects. It will be easier and cleaner to fetch the information for a token as it will now be stored in one single place. Each new object would require an additional reserve.
This object would only be created when the user sets a
FixedSupplyLimit, this would likely need a new transaction as well.Evaluation
Pros:
AccountRootobject for bookkeepingTotalTokenAmountin the FungibleToken object.Cons:
TotalTokenAmountmay still need recomputation during a transaction, as there is a risk of incorrect data. Again, this requires iterating the owner directory to recompute the total, which is expensive. We need some level of confidence that theTotalTokenAmountis the right number and does not diverge from the actual sum. This is an implementation detail that is open to further discussion.Approach 2: New
FungibleTokenobject with modifiersThe
FungibleTokenobjectThe
FungibleTokenobject represents a single fungible token. The object is created by aTokenSettransaction. However, this object does not exist for each fungible token unless explicity set by aTokenSet.Fields
An
FungibleTokenobject can have the following required and optional fields.CurrencystringUINT16Indicates the fungible token currency.
IssuerstringACCOUNT IDThe issuer of the currency
FixedSupplyLimitobjectAMOUNTIndicates the total issued amount allowed.
ReceiverstringACCOUNT IDThe receiver of the token amount specified in
FixedSupplyLimit.LockedboolboolIndicates if the currency has locked. If
true, no more tokens of this currency can be issued.This is set to
trueafter a sucessfulTokenSettransaction withtfSetLimitflagFlagsnumberUINT32The
TokenSettransactionTransactionTypestringUINT16Indicates the new transaction type
TokenSet. The recommended name isttTOKENSET.FlagsnumberUINT32Specifies the flags for this transaction.
AccountstringACCOUNT IDIndicates the account which is executing this transaction. The account MUST be the issuer of the asset.
FixSupplyLimitobjectAMOUNTOnly valid if
tfSetLimitflag is on. Indicates the amount specified for fixed supply limit.If the token already exists, MUST leave this field out, because
AMOUNTdoesn't support finite precision, so unable to find out the total.ReceiverstringACCOUNT IDOnly valid if
tfSetLimitflag is on. Indicates the account which receivesFixSupplyLimitamount of token.If the token already exists, MUST leave this field out.
How to use
TokenSetScenario 1: Limit a token that already exists
Set
tfSetLimitto true(even though we don't set a limit, but we need this flag to indicate that we want to discontinue from issuing and blackhole the issuer). If theissuerhas already issued the token, leave theReceiverandFixSupplyLimitparameters out for theTrustSetrequest. This is because we have no good way of finding out the precise total of the already issued token.Scenario 2: Set limit for a new token
Set
tfSetLimitto true. Set theFixSupplyLimitto the amount of token that you want to limit. Set theReceiverto the account that you want to receive the tokens.Receiveraddress will receive exactly what is specified in theFixSupplyLimitfield.A successful
TokenSetWhen the result of a
TokenSetwithtfSetLimitflag is successful, it will:Issueraccount will be blackholed, such that there is a limit to the total amount of token.Issuer, if enabled.Receiveraddress will receive the amount specified byFixSupplyLimitAdvantages
FungibleTokenobject could be utilized in the future for other features like MemoDisadvantages
TokenSetdoes could be replicated by doing multiple transactions on the ledger alreadyApproach 3: Compact Fungible Token
Compact Fungible Token is discussed in proposal. It is a type of token that allows finite precision and set maximum limit on the total amount, which addresses exactly what the requirements tries to solve.
Advantages
Disadvantages
Beta Was this translation helpful? Give feedback.
All reactions