From 257821a7642b19bffa4af9e66814255ede91faab Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Tue, 31 Mar 2020 14:39:26 +0200 Subject: [PATCH] Use Tezos prefix in Tutorial. --- .../get-started/tezos-taco-shop-payout.ligo | 16 +++++++--- .../get-started/tezos-taco-shop-payout.md | 29 +++++++++++++++---- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-payout.ligo b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-payout.ligo index 9cf169397..6d582d7c9 100644 --- a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-payout.ligo +++ b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-payout.ligo @@ -34,13 +34,21 @@ function buy_taco (const taco_kind_index : nat; var taco_shop_storage : taco_sho // Update the storage with the refreshed taco_kind taco_shop_storage[taco_kind_index] := taco_kind; - const receiver : contract (unit) = get_contract (ownerAddress); - const donationReceiver : contract (unit) = get_contract (donationAddress); + const receiver : contract (unit) = + case (Tezos.get_contract_opt (ownerAddress): option(contract (unit))) of + Some (contract) -> contract + | None -> (failwith ("Not a contract") : contract (unit)) + end; + const donationReceiver : contract (unit) = + case (Tezos.get_contract_opt (donationAddress): option(contract (unit))) of + Some (contract) -> contract + | None -> (failwith ("Not a contract") : contract (unit)) + end; const donationAmount : tez = amount / 10n; const operations : list (operation) = list [ - transaction (unit, amount - donationAmount, receiver); - transaction (unit, donationAmount, donationReceiver); + Tezos.transaction (unit, amount - donationAmount, receiver); + Tezos.transaction (unit, donationAmount, donationReceiver); ] } with (operations, taco_shop_storage) diff --git a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-payout.md b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-payout.md index 9207f7817..20cd89556 100644 --- a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-payout.md +++ b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-payout.md @@ -105,7 +105,11 @@ contract with no parameters, or an implicit account. ```pascaligo group=ex1 const ownerAddress : address = ("tz1TGu6TN5GSez2ndXXeDX6LgUDvLzPLqgYV" : address); -const receiver : contract (unit) = get_contract (ownerAddress); +const receiver : contract (unit) = + case (Tezos.get_contract_opt (ownerAddress): option(contract(unit))) of + Some (contract) -> contract + | None -> (failwith ("Not a contract") : (contract(unit))) + end; ``` > Would you like to learn more about addresses, contracts and @@ -120,7 +124,7 @@ receiver)` within a list of operations returned at the end of our contract. ```pascaligo group=ex1 -const payoutOperation : operation = transaction (unit, amount, receiver) ; +const payoutOperation : operation = Tezos.transaction (unit, amount, receiver) ; const operations : list (operation) = list [payoutOperation]; ``` @@ -166,8 +170,13 @@ function buy_taco (const taco_kind_index : nat ; var taco_shop_storage : taco_sh // Update the storage with the refreshed taco_kind taco_shop_storage[taco_kind_index] := taco_kind; - const receiver : contract(unit) = get_contract (ownerAddress); - const payoutOperation : operation = transaction (unit, amount, receiver); + const receiver : contract (unit) = + case (Tezos.get_contract_opt (ownerAddress): option(contract(unit))) of + Some (contract) -> contract + | None -> (failwith ("Not a contract") : (contract(unit))) + end; + + const payoutOperation : operation = Tezos.transaction (unit, amount, receiver); const operations : list(operation) = list [payoutOperation] } with ((operations : list (operation)), taco_shop_storage) ``` @@ -214,8 +223,16 @@ sum from each taco purchase. const ownerAddress : address = ("tz1TGu6TN5GSez2ndXXeDX6LgUDvLzPLqgYV" : address); const donationAddress : address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address); -const receiver : contract (unit) = get_contract (ownerAddress); -const donationReceiver : contract(unit) = get_contract (donationAddress); +const receiver : contract (unit) = + case (Tezos.get_contract_opt (ownerAddress) : option(contract(unit))) of + Some (contract) -> contract + | None -> (failwith ("Not a contract") : contract (unit)) + end; +const donationReceiver : contract (unit) = + case (Tezos.get_contract_opt (donationAddress) : option(contract(unit))) of + Some (contract) -> contract + | None -> (failwith ("Not a contract") : contract (unit)) + end; const donationAmount : tez = amount / 10n;