From 8e00f39c4e16b7390d0c9cf7c0d592e1121dc09c Mon Sep 17 00:00:00 2001 From: Frank Hillard Date: Fri, 10 Jul 2020 18:00:00 +0200 Subject: [PATCH] Modify add metadata part in chapter fa2, fix exercise, update tzip-12 --- .../pages/Chapters/Reason/ChapterFA20/exercise.religo | 11 +++++++++-- .../pages/Chapters/Reason/ChapterFA20/solution.religo | 11 +++++++++-- .../Reason/ChapterFA20/tzip-12/fa2_interface.religo | 7 +++++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/pages/Chapters/Reason/ChapterFA20/exercise.religo b/src/frontend/src/pages/Chapters/Reason/ChapterFA20/exercise.religo index 1d877f2..efdcdb1 100644 --- a/src/frontend/src/pages/Chapters/Reason/ChapterFA20/exercise.religo +++ b/src/frontend/src/pages/Chapters/Reason/ChapterFA20/exercise.religo @@ -228,6 +228,12 @@ let updateOperators = ((updateOperatorsParameter, storage): (updateOperatorsPara (([]: list(operation)), storage) } +let tokenMetadataRegistry = ((tokenMetadataRegistryParameter, storage): (tokenMetadataRegistryParameter, storage)): entrypointReturn => { + let callbackTarget = tokenMetadataRegistryParameter; + let callbackOperation: operation = Tezos.transaction(Tezos.self_address, 0tez, callbackTarget); + ([callbackOperation], storage); +} + let main = ((parameter, storage): entrypointParameter): entrypointReturn => { switch (parameter) { | Fa2 fa2 => { @@ -236,12 +242,13 @@ let main = ((parameter, storage): entrypointParameter): entrypointReturn => { | Balance_of(balanceOfParameterMichelson) => balanceOf((balanceOfParameterMichelson, storage)) | Permissions_descriptor(permissionsDescriptorParameter) => permissionsDescriptor((permissionsDescriptorParameter, storage)) | Update_operators(updateOperatorsParameter) => updateOperators((updateOperatorsParameter, storage)) + | Token_metadata_registry(tokenMetadataRegistryParameter) => tokenMetadataRegistry((tokenMetadataRegistryParameter, storage)) } } | Asset ast => { switch (ast) { - | Mint(mintParameter) => (([]: list(operation)), storage) //mint(mintParameter) - | Burn(burnParameter) => (([]: list(operation)), storage) //burn(burnParameter) + | Mint(mintParameter) => (([]: list(operation)), storage) + | Burn(burnParameter) => (([]: list(operation)), storage) } } } diff --git a/src/frontend/src/pages/Chapters/Reason/ChapterFA20/solution.religo b/src/frontend/src/pages/Chapters/Reason/ChapterFA20/solution.religo index 9dcd436..2fe73e7 100644 --- a/src/frontend/src/pages/Chapters/Reason/ChapterFA20/solution.religo +++ b/src/frontend/src/pages/Chapters/Reason/ChapterFA20/solution.religo @@ -235,6 +235,12 @@ let updateOperators = ((updateOperatorsParameter, storage): (updateOperatorsPara (([]: list(operation)), storage) } +let tokenMetadataRegistry = ((tokenMetadataRegistryParameter, storage): (tokenMetadataRegistryParameter, storage)): entrypointReturn => { + let callbackTarget = tokenMetadataRegistryParameter; + let callbackOperation: operation = Tezos.transaction(Tezos.self_address, 0tez, callbackTarget); + ([callbackOperation], storage); +} + let main = ((parameter, storage): entrypointParameter): entrypointReturn => { switch (parameter) { | Fa2 fa2 => { @@ -243,12 +249,13 @@ let main = ((parameter, storage): entrypointParameter): entrypointReturn => { | Balance_of(balanceOfParameterMichelson) => balanceOf((balanceOfParameterMichelson, storage)) | Permissions_descriptor(permissionsDescriptorParameter) => permissionsDescriptor((permissionsDescriptorParameter, storage)) | Update_operators(updateOperatorsParameter) => updateOperators((updateOperatorsParameter, storage)) + | Token_metadata_registry(tokenMetadataRegistryParameter) => tokenMetadataRegistry((tokenMetadataRegistryParameter, storage)) } } | Asset ast => { switch (ast) { - | Mint(mintParameter) => (([]: list(operation)), storage) //mint(mintParameter) - | Burn(burnParameter) => (([]: list(operation)), storage) //burn(burnParameter) + | Mint(mintParameter) => (([]: list(operation)), storage) + | Burn(burnParameter) => (([]: list(operation)), storage) } } } diff --git a/src/frontend/src/pages/Chapters/Reason/ChapterFA20/tzip-12/fa2_interface.religo b/src/frontend/src/pages/Chapters/Reason/ChapterFA20/tzip-12/fa2_interface.religo index 7de019d..5f48583 100644 --- a/src/frontend/src/pages/Chapters/Reason/ChapterFA20/tzip-12/fa2_interface.religo +++ b/src/frontend/src/pages/Chapters/Reason/ChapterFA20/tzip-12/fa2_interface.religo @@ -138,7 +138,9 @@ type permissionsDescriptorMichelson = michelson_pair_right_comb(permissionsDescr type permissionsDescriptorParameter = contract(permissionsDescriptorMichelson); - +/////////////////////////////// METADATA /////////////////// +type tokenMetadataRegistryTarget = address; +type tokenMetadataRegistryParameter = contract(tokenMetadataRegistryTarget); /////////////////////////////// ENTRYPOINTS /////////////////// @@ -146,4 +148,5 @@ type parameter = | Transfer(transferParameter) | Balance_of(balanceOfParameterMichelson) | Permissions_descriptor(permissionsDescriptorParameter) -| Update_operators(updateOperatorsParameter) \ No newline at end of file +| Update_operators(updateOperatorsParameter) +| Token_metadata_registry(tokenMetadataRegistryParameter) \ No newline at end of file