-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Token standard #390
Token standard #390
Conversation
3057bf5
to
4019555
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added My feedback/doubts
) | ||
|
||
assert :ok = PendingTransactionValidation.validate(tx) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An additional Test for failing case would be better,
supply: 2 , but three properties or vice versa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
properties | ||
|> Enum.with_index() | ||
|> Enum.map(fn {_item_properties, index} -> | ||
%UnspentOutput{from: address, amount: 1 * @unit_uco, type: {:NFT, address, index + 1}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we need to check if the id is pre determined by the property "id" as specified in AEIP2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes right I missed this one 👍
with {:ok, json_token} <- Jason.decode(content), | ||
:ok <- ExJsonSchema.Validator.validate(schema, json_token), | ||
%{"type" => "non-fungible", "supply" => supply, "properties" => properties} | ||
when length(properties) == supply <- json_token do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As AEIP2 specifiate that we can pre determine the id, if one index of properties have the property "id", all index should have it too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, as the token id is use and makes sense for token and nft, I think we should rename id to id
instead of nft_id
as defined in AEIP2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I will add the check
2dc35ed
to
ffa51f6
Compare
Description
Implement the token standard
Fixes #378 #303
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
To create a token, we can use the libjs example transaction builder and create transaction of type 'nft' and enter your token specification, for example:
This should create a new transaction where the unspent outputs should be 100.
This test can also be done with fungible tokens:
This PR also implement a fee for the NFT creation and minting being logarithmic, so token with high supply will cost more than other with small supply as the UTXO must be created and will cost space and bandwidth.
But providing a fair transaction's fee compared to UCO transfers.
Checklist: