Closed jevonearth closed 3 years ago
The delphi net material is no longer avilabale. Perhaps the equivalent from mainnet is here: https://better-call.dev/mainnet/KT1K9gCRgaLRFKTErYt1wVxA3Frb9FjasjTV/code
The example above uses a governance contract that is at: https://better-call.dev/mainnet/KT1JBmbYxTv3xptk2CadgEdMfjUCUXKEfe5u/operations
I have found a simpler example to follow by Michael Klien: https://github.com/tqtezos/lorentz-contract-metadata
The existing Test: tzip12-token-metadata.spec.ts is for tokens that have multiple ids, not tokens that are only id = 0
Here is the originated contract getMetadata entrpoint on Better Call Dev: https://better-call.dev/granadanet/KT1TS8gncRVzT3RsZYbXXht6nxxvUXYd66cP/interact?entrypoint=getMetadata
the example contract I have made by Michael Klien with Lorentz does not have a metadata bigmap
The Taquito docs say: There are two scenarios to obtain the metadata of a token:
They can be obtained from executing an off-chain view named token_metadata present in the contract metadata or from a big map named token_metadata in the contract storage.
The storage is just this:
storage (pair (big_map address (pair nat (map address nat)))
(pair address (pair bool nat)));
There is a getMetadata entrypoint that has parameter:
(pair %getMetadata (list nat)
(contract (list (pair nat
(pair string
(pair string
(pair nat
(map
string
string))))))))))));
and the code ends with this:
{ DUP ;
CAR ;
DIP { CDR } ;
DIP { DIP { DUP } ; SWAP } ;
PAIR ;
CAR ;
ITER { PUSH nat 0 ;
COMPARE ;
EQ ;
IF
{}
{ PUSH string "single token only has id 0" ; FAILWITH } } ;
PUSH (list (pair nat
(pair string
(pair string (pair nat (map string string)))))) { Pair 0 (Pair "TOK" (Pair "Token" (Pair 0 {}))) } ;
DIP { AMOUNT } ;
TRANSFER_TOKENS ;
NIL operation ;
SWAP ;
CONS ;
PAIR } } } } }}`;
for this contract, the tzip12 and tzip16 abstract extensions do not apply
If the token id is not 0, then it fails. That defines the FA2 part. If it is 0, it creates the token.
I have not figured out how to obtain the token for this contract with Taquito.
The above contract requires to be called by another contract. It won't be appropriate for this test.
The integration test "contract-originate-token-contract.spec.ts" creates a token from a similar contract, and does not have metadata. So that test shows a tzip-7 contract with tokens.
Closing based on the above comments.
A proposal (https://gitlab.com/tzip/tzip/-/merge_requests/140) to use FA2/TZIP-12 metadata in FA1.2 contracts is in the process of being finalised.
The single difference is that FA1.2 contracts use only token id
0
.An example FA1.2 contract with token metadata from Kolibri exists here https://delphi.tzstats.com/KT1CiJv61tJ7CUK7oKMmNYRSjpxGJ4GC9TX5
Appears to work okay in the Taquito Metadata explorer. See: https://taquito-metadata-explorer.netlify.app/#/delphinet/KT1CiJv61tJ7CUK7oKMmNYRSjpxGJ4GC9TX5
We need to evaluate the impact of this in Taquito, and how to document/present how to get fa1.2 metadata. The provider is named tzip-12 at the moment.
Acceptance criteria: