TZIP-16
{
"name": "$HUX 4 ALL",
"version": "1.0.0",
"description": "I dream of a world where everybody $HUX everybody.",
"interfaces": [
"TZIP-012",
"TZIP-016"
],
"authors": [
"YourName/Username/ProjectName/CompanyName"
],
"homepage": "https://your.website",
"source": {
"tools": [
"SmartPy"
],
"location": "https://gitlab.com/SmartPy/smartpy/-/raw/master/python/templates/FA2.py"
},
"permissions": {
"receiver": "owner-no-hook",
"sender": "owner-no-hook",
"operator": "owner-or-operator-transfer"
},
"views": [
{
"name": "all_tokens",
"pure": true,
"description": "OffchainView: Return the list of all the token IDs known to the contract.",
"implementations": [
{
"michelsonStorageView": {
"returnType": {
"prim": "list",
"args": [
{
"prim": "nat"
}
]
},
"code": [
{
"prim": "DUP"
},
{
"prim": "CAR"
},
{
"prim": "GET",
"args": [
{
"int": "3"
}
]
},
{
"prim": "NIL",
"args": [
{
"prim": "nat"
}
]
},
{
"prim": "SWAP"
},
{
"prim": "PUSH",
"args": [
{
"prim": "nat"
},
{
"int": "0"
}
]
},
{
"prim": "DUP"
},
{
"prim": "DUP",
"args": [
{
"int": "3"
}
]
},
{
"prim": "COMPARE"
},
{
"prim": "GT"
},
{
"prim": "LOOP",
"args": [
[
{
"prim": "DUP"
},
{
"prim": "DIG",
"args": [
{
"int": "3"
}
]
},
{
"prim": "SWAP"
},
{
"prim": "CONS"
},
{
"prim": "DUG",
"args": [
{
"int": "2"
}
]
},
{
"prim": "PUSH",
"args": [
{
"prim": "nat"
},
{
"int": "1"
}
]
},
{
"prim": "ADD"
},
{
"prim": "DUP"
},
{
"prim": "DUP",
"args": [
{
"int": "3"
}
]
},
{
"prim": "COMPARE"
},
{
"prim": "GT"
}
]
]
},
{
"prim": "DROP",
"args": [
{
"int": "2"
}
]
},
{
"prim": "SWAP"
},
{
"prim": "DROP"
},
{
"prim": "NIL",
"args": [
{
"prim": "nat"
}
]
},
{
"prim": "SWAP"
},
{
"prim": "ITER",
"args": [
[
{
"prim": "CONS"
}
]
]
}
]
}
}
]
},
{
"name": "get_balance",
"pure": true,
"description": "Return the balance of an address for the specified `token_id`.",
"implementations": [
{
"michelsonStorageView": {
"parameter": {
"prim": "pair",
"args": [
{
"prim": "address",
"annots": [
"%owner"
]
},
{
"prim": "nat",
"annots": [
"%token_id"
]
}
]
},
"returnType": {
"prim": "nat"
},
"code": [
{
"prim": "UNPAIR"
},
{
"prim": "SWAP"
},
{
"prim": "DUP"
},
{
"prim": "DUG",
"args": [
{
"int": "2"
}
]
},
{
"prim": "GET",
"args": [
{
"int": "6"
}
]
},
{
"prim": "SWAP"
},
{
"prim": "DUP"
},
{
"prim": "DUG",
"args": [
{
"int": "2"
}
]
},
{
"prim": "CDR"
},
{
"prim": "MEM"
},
{
"prim": "IF",
"args": [
[
],
[
{
"prim": "PUSH",
"args": [
{
"prim": "string"
},
{
"string": "FA2_TOKEN_UNDEFINED"
}
]
},
{
"prim": "FAILWITH"
}
]
]
},
{
"prim": "SWAP"
},
{
"prim": "CAR"
},
{
"prim": "GET",
"args": [
{
"int": "4"
}
]
},
{
"prim": "SWAP"
},
{
"prim": "CAR"
},
{
"prim": "GET"
},
{
"prim": "IF_NONE",
"args": [
[
{
"prim": "PUSH",
"args": [
{
"prim": "nat"
},
{
"int": "0"
}
]
}
],
[
]
]
}
]
}
}
]
},
{
"name": "is_operator",
"pure": true,
"description": "Return whether `operator` is allowed to transfer `token_id` tokens owned by `owner`.",
"implementations": [
{
"michelsonStorageView": {
"parameter": {
"prim": "pair",
"args": [
{
"prim": "address",
"annots": [
"%owner"
]
},
{
"prim": "pair",
"args": [
{
"prim": "address",
"annots": [
"%operator"
]
},
{
"prim": "nat",
"annots": [
"%token_id"
]
}
]
}
]
},
"returnType": {
"prim": "bool"
},
"code": [
{
"prim": "UNPAIR"
},
{
"prim": "SWAP"
},
{
"prim": "GET",
"args": [
{
"int": "3"
}
]
},
{
"prim": "CDR"
},
{
"prim": "SWAP"
},
{
"prim": "MEM"
}
]
}
}
]
},
{
"name": "token_metadata",
"pure": false,
"description": "Returns the token-metadata URI for the given token.",
"implementations": [
{
"michelsonStorageView": {
"parameter": {
"prim": "nat"
},
"returnType": {
"prim": "pair",
"args": [
{
"prim": "nat",
"annots": [
"%token_id"
]
},
{
"prim": "map",
"args": [
{
"prim": "string"
},
{
"prim": "bytes"
}
],
"annots": [
"%token_info"
]
}
]
},
"code": [
{
"prim": "UNPAIR"
},
{
"prim": "SWAP"
},
{
"prim": "GET",
"args": [
{
"int": "6"
}
]
},
{
"prim": "SWAP"
},
{
"prim": "GET"
},
{
"prim": "IF_NONE",
"args": [
[
{
"prim": "PUSH",
"args": [
{
"prim": "int"
},
{
"int": "558"
}
]
},
{
"prim": "FAILWITH"
}
],
[
]
]
}
]
}
}
]
},
{
"name": "total_supply",
"pure": true,
"description": "Return the total number of tokens for the given `token_id`.",
"implementations": [
{
"michelsonStorageView": {
"parameter": {
"prim": "nat"
},
"returnType": {
"prim": "nat"
},
"code": [
{
"prim": "UNPAIR"
},
{
"prim": "SWAP"
},
{
"prim": "DUP"
},
{
"prim": "DUG",
"args": [
{
"int": "2"
}
]
},
{
"prim": "GET",
"args": [
{
"int": "6"
}
]
},
{
"prim": "SWAP"
},
{
"prim": "DUP"
},
{
"prim": "DUG",
"args": [
{
"int": "2"
}
]
},
{
"prim": "MEM"
},
{
"prim": "IF",
"args": [
[
],
[
{
"prim": "PUSH",
"args": [
{
"prim": "string"
},
{
"string": "FA2_TOKEN_UNDEFINED"
}
]
},
{
"prim": "FAILWITH"
}
]
]
},
{
"prim": "SWAP"
},
{
"prim": "DUP"
},
{
"prim": "DUG",
"args": [
{
"int": "2"
}
]
},
{
"prim": "GET",
"args": [
{
"int": "6"
}
]
},
{
"prim": "SWAP"
},
{
"prim": "MEM"
},
{
"prim": "IF",
"args": [
[
],
[
{
"prim": "PUSH",
"args": [
{
"prim": "string"
},
{
"string": "FA2_TOKEN_UNDEFINED"
}
]
},
{
"prim": "FAILWITH"
}
]
]
},
{
"prim": "GET",
"args": [
{
"int": "5"
}
]
}
]
}
}
]
}
]
}