-
-
Save melwyn95/6ec752891ed445e46fa069970189a621 to your computer and use it in GitHub Desktop.
Notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TZIP-21 (https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-21/tzip-21.md) | |
TZIP-16 (https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-16/tzip-16.md) | |
TZIP-12 (https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-12/tzip-12.md) | |
- interface | |
single token type & multi token type | |
- token transfer semantics | |
- metadata | |
token & contract level | |
token_type - (token_contract_address, token_id [nat]) | |
(if single token_type then token_id - 0n) | |
FA2 contract <- list of parameters (single operation query) - must not be reordered, | |
deduplicated, and processed in the same order | |
balance_of - empty - call callback with empty response | |
-- Interface Specification -- | |
entrypoints - transfer, balance_of, update_operators | |
-- `transfer` | |
- transfer [ (`from_` address, `txs` [ (`to_` address, (`token_id` nat, `amount` nat)) ]) ] | |
1 source & multiple destinations | |
mint?? burn?? (specialized versions of transfer can be invoked by special administrative address only) | |
-- Core Transfer Behaviour | |
- atomic & in order | |
- must decrement the balance of `from_` & increment the balance of `to_` by amount of transfer | |
- if tranfer amount > balance of `from_` fail with `FA2_INSUFFICIENT_BALANCE` | |
- if token_owner does not hold any token of type `token_id` balance is 0 (no token owner can have -ve balance) | |
- tranfer operation must not add/remove additional transfer (transaction fees) | |
- 0 amount transfer is normal transfer | |
- same `from_` & `to_` is normal transfer | |
- if one of the `toke_id` is not defined fail with `FA2_TOKEN_UNDEFINED` | |
- transfer must apply transfer permission policy, if logic rejects whole operation must fail | |
x additonal contraints can be invokes if failed fail with custom mnemonic | |
-- Default Transfer Policy | |
- Token owner address must be able to perform transfer of own tokens (Tezos.sender = `from_`) | |
- An Operator must be permitted to manage specific owners tokens before it invokes a transfer tx (permission must be give before) | |
- If address that 'invokes' transfer is neither one of permitted operators not token owner the tx must fail with `FA2_NOT_OPERATOR` | |
(If atleast one of transfer is not permitted the whole batch/transaction must fail) | |
-- `balance_of` | |
- balance_of ( | |
`requests` [ (`owner` address, `token_id` nat) ], | |
`callback` contract [ (`request` (`owner` address, `token_id` nat), `balance` nat) ] | |
) | |
- there can be duplicate `balance_of_requests` | |
- if account does not hold any tokens , balance = 0 | |
- if one of the `token_id` is not present then fail with `FA2_TOKEN_UNDEFINED` | |
Operator - Tezos address that originates transfer on behalf of owner | |
Owner - Tezos address which can hold tokens | |
-- `update_operators` | |
- operators are permitted per token_owner & token_id, once permitted the operator can transfer tokens of type belonging to owner | |
- update_operators [ | |
| `add_operator` (`owner` address, (`operator` address, `token_id` nat)) | |
| `remove_operator` (`owner` address, (`operator` address, `token_id` nat)) | |
] | |
- takes a list of `update_operator` commands, if 2 different commands in list add & remove an operator for same token_owner, token_id | |
the last command must take effect | |
- it is possible to update operator for token that does not have any balance yet | |
- operator relation is not transitive. c -operator-> b, b -operator-> a, then c cannot transfer a's token on behalf of b | |
- it is not specified who can `update_operators` but in some implementations (Tezos.sender = owner) | |
-- Token Metadata -- | |
- used for user facing contexts (wallets, explorers, marketplaces) | |
-- Token Metadata Values -- | |
https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-12/tzip-12.md#token-metadata-values | |
NFT Tutorial (https://github.com/oxheadalpha/nft-tutorial) | |
NFT Boilerplate (https://github.com/klarluft/tzklar-boilerplate) | |
-- add tests for the NFT contract | |
-- add views to PE contract (token metadata) -- talk about it ask if mint entrypoint is needed? | |
-- add tests for views | |
Tests | |
- Read all the contracts once | |
transfer: | |
1. balance_of empty request, callback with empty response | |
2. atomic transfer | |
+success - check balances after transfer, | |
+failure | |
3. transfer amount > balance amount (assert the error) | |
4. do 0 amount transfer and token_owner cannot have -ve balance | |
5. same to & from transfer | |
5. token_id not defined | |
(tests these in update operators tests) | |
6. transfer permission policy ?? | |
+ token owner should be able to transfer | |
+ operator must be able to transfer on behalf of token owner | |
+ not owner & not operator | |
balance_of: | |
7. duplicate balance_of requests | |
8. if account does not hold any tokens balance is 0 | |
9. if token_id not present error undefined token | |
update_operators: | |
1. add operator - remove - add & do transfer | |
2. remove operator & do transfer | |
3. non transitive operator check (should fail) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment