Fungible Token Fixed Supply #97
shawnxie999
started this conversation in
Ideas (pre standard proposal)
Replies: 2 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.
0 replies
-
Deleted unfeasible approaches. See Approach 2 for the new method. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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:
Payment
andOfferCreate
.Here is a sample workflow of how supply limit interact with these transactions:
TrustLine
to Alice forUSD
tokenUSD
to Bob through aPayment
transactionUSD
USD
USD
, and is successfulOfferCreate
transaction of params:USD
and TakerPays is 100XRP
Offer
has 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 issuedUSD
will reach 250 (considering she has already issued 100USD
to Bob), which goes over the supply limit (200USD
)OfferCreate
transaction of params:USD
and TakerPays is 100XRP
Offer
becomes fully consumed in the future, the total amount ofUSD
Alice issues will total up to 180, which is less than the limit (200USD
)Hence, whenever a token is issued through new
OfferCreate
orPayment
transactions, 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
Payment
transaction with USD, we must make sureWhen the issuer creates a new
OfferCreate
transaction with USD as the currency forTakerGets
, we must make sureApproaches
Approach 1: New
FungibleToken
ledger 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
FungibleToken
to 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:
AccountRoot
object for bookkeepingTotalTokenAmount
in the FungibleToken object.Cons:
TotalTokenAmount
may 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 theTotalTokenAmount
is 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
FungibleToken
object with modifiersThe
FungibleToken
objectThe
FungibleToken
object represents a single fungible token. The object is created by aTokenSet
transaction. However, this object does not exist for each fungible token unless explicity set by aTokenSet
.Fields
An
FungibleToken
object can have the following required and optional fields.Currency
string
UINT16
Indicates the fungible token currency.
Issuer
string
ACCOUNT ID
The issuer of the currency
FixedSupplyLimit
object
AMOUNT
Indicates the total issued amount allowed.
Receiver
string
ACCOUNT ID
The receiver of the token amount specified in
FixedSupplyLimit
.Locked
bool
bool
Indicates if the currency has locked. If
true
, no more tokens of this currency can be issued.This is set to
true
after a sucessfulTokenSet
transaction withtfSetLimit
flagFlags
number
UINT32
The
TokenSet
transactionTransactionType
string
UINT16
Indicates the new transaction type
TokenSet
. The recommended name isttTOKENSET
.Flags
number
UINT32
Specifies the flags for this transaction.
Account
string
ACCOUNT ID
Indicates the account which is executing this transaction. The account MUST be the issuer of the asset.
FixSupplyLimit
object
AMOUNT
Only valid if
tfSetLimit
flag is on. Indicates the amount specified for fixed supply limit.If the token already exists, MUST leave this field out, because
AMOUNT
doesn't support finite precision, so unable to find out the total.Receiver
string
ACCOUNT ID
Only valid if
tfSetLimit
flag is on. Indicates the account which receivesFixSupplyLimit
amount of token.If the token already exists, MUST leave this field out.
How to use
TokenSet
Scenario 1: Limit a token that already exists
Set
tfSetLimit
to 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 theissuer
has already issued the token, leave theReceiver
andFixSupplyLimit
parameters out for theTrustSet
request. 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
tfSetLimit
to true. Set theFixSupplyLimit
to the amount of token that you want to limit. Set theReceiver
to the account that you want to receive the tokens.Receiver
address will receive exactly what is specified in theFixSupplyLimit
field.A successful
TokenSet
When the result of a
TokenSet
withtfSetLimit
flag is successful, it will:Issuer
account will be blackholed, such that there is a limit to the total amount of token.Issuer
, if enabled.Receiver
address will receive the amount specified byFixSupplyLimit
Advantages
FungibleToken
object could be utilized in the future for other features like MemoDisadvantages
TokenSet
does 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