From 0439f48fde76c1d2c315c4d15aef528df80d82da Mon Sep 17 00:00:00 2001 From: Frank Hillard Date: Thu, 15 Oct 2020 14:10:21 +0200 Subject: [PATCH 1/3] fix wrong pascal/camel syntaxe --- .../src/pages/Chapters/Camel/ChapterPolymorphism/course.md | 6 +++--- .../Pascal/ChapterPolymorphism/central_solution.ligo | 2 +- .../src/pages/Chapters/Pascal/ChapterPolymorphism/course.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/pages/Chapters/Camel/ChapterPolymorphism/course.md b/src/frontend/src/pages/Chapters/Camel/ChapterPolymorphism/course.md index 85be6c4..9204deb 100644 --- a/src/frontend/src/pages/Chapters/Camel/ChapterPolymorphism/course.md +++ b/src/frontend/src/pages/Chapters/Camel/ChapterPolymorphism/course.md @@ -29,7 +29,7 @@ The problem is coming from the fact that _B_ must know the whole definition of _ The predefined function *Tezos.get\_entrypoint\_opt* has the following syntax : ``` -let : option(contract()) = Tezos.get_entrypoint_opt(, ); +let : contract option = Tezos.get_entrypoint_opt in ``` When the function *get\_entrypoint\_opt* does not find any contract at a given _address_ or the contract doesn't match the type, then _None_ is returned. @@ -53,9 +53,9 @@ The Squadron contract provides an entry point _ModuleResponse_ which is called b As you can see, the entry point _RetrieveShip_ calls the function _sendTx_ which is responsible to send a transaction to a the calling contract. The implementation of the Central contract has not been finished. We need you to finish the _sendTx_ function! -1- Try to retrieve the entry point %moduleResponse of the given *callbackAddress* and store the result in a variable called *contractInterfaceOpt* of type _option(contract(actionSquadron))_ +1- Try to retrieve the entry point %moduleResponse of the given *callbackAddress* and store the result in a variable called *contractInterfaceOpt* of type _actionSquadron contract option_ -2- Use a _switch_ operator to extract the entry point if it exists (use temporary variable name *ci* in the switch). Otherwise throw an exception with error message "Entrypoint not found in contract Squadron". The extracted entry point must be stored in a variable called *contractInterface*. +2- Use a _match_ operator to extract the entry point if it exists (use temporary variable name *ci* in the _Some_). Otherwise throw an exception with error message "Entrypoint not found in contract Squadron" (and don't forget to cast the exception in the right type). The extracted entry point must be stored in a variable called *contractInterface*. 3- In order to prepare the ship information that need to be sent back to the Squadron contract. Check the expected type of entry point _moduleResponse_ and prepare a variable *ee* containing the expected ship *e*. diff --git a/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/central_solution.ligo b/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/central_solution.ligo index 576536b..3640a67 100644 --- a/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/central_solution.ligo +++ b/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/central_solution.ligo @@ -27,7 +27,7 @@ begin const ee : actionModuleResponse = record e = e end; - const sendbackOperation: operation = transaction(ModuleResponse(ee), 0mutez, contractInterface); + const sendbackOperation: operation = Tezos.transaction(ModuleResponse(ee), 0mutez, contractInterface); const listoperation : list(operation) = list sendbackOperation diff --git a/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/course.md b/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/course.md index 85be6c4..06c73f1 100644 --- a/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/course.md +++ b/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/course.md @@ -29,7 +29,7 @@ The problem is coming from the fact that _B_ must know the whole definition of _ The predefined function *Tezos.get\_entrypoint\_opt* has the following syntax : ``` -let : option(contract()) = Tezos.get_entrypoint_opt(, ); +const : option(contract()) = Tezos.get_entrypoint_opt(, ); ``` When the function *get\_entrypoint\_opt* does not find any contract at a given _address_ or the contract doesn't match the type, then _None_ is returned. @@ -55,7 +55,7 @@ As you can see, the entry point _RetrieveShip_ calls the function _sendTx_ which 1- Try to retrieve the entry point %moduleResponse of the given *callbackAddress* and store the result in a variable called *contractInterfaceOpt* of type _option(contract(actionSquadron))_ -2- Use a _switch_ operator to extract the entry point if it exists (use temporary variable name *ci* in the switch). Otherwise throw an exception with error message "Entrypoint not found in contract Squadron". The extracted entry point must be stored in a variable called *contractInterface*. +2- Use a _case_ operator to extract the entry point if it exists (use temporary variable name *ci* in the case). Otherwise throw an exception with error message "Entrypoint not found in contract Squadron". The extracted entry point must be stored in a variable called *contractInterface*. 3- In order to prepare the ship information that need to be sent back to the Squadron contract. Check the expected type of entry point _moduleResponse_ and prepare a variable *ee* containing the expected ship *e*. From ad637a1fe2ce4e94d1803ac6b77da8085fddf35c Mon Sep 17 00:00:00 2001 From: Frank Hillard Date: Thu, 15 Oct 2020 14:16:39 +0200 Subject: [PATCH 2/3] add detail in mission --- .../src/pages/Chapters/Pascal/ChapterPolymorphism/course.md | 2 +- .../src/pages/Chapters/Reason/ChapterPolymorphism/course.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/course.md b/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/course.md index 06c73f1..2557d06 100644 --- a/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/course.md +++ b/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/course.md @@ -55,7 +55,7 @@ As you can see, the entry point _RetrieveShip_ calls the function _sendTx_ which 1- Try to retrieve the entry point %moduleResponse of the given *callbackAddress* and store the result in a variable called *contractInterfaceOpt* of type _option(contract(actionSquadron))_ -2- Use a _case_ operator to extract the entry point if it exists (use temporary variable name *ci* in the case). Otherwise throw an exception with error message "Entrypoint not found in contract Squadron". The extracted entry point must be stored in a variable called *contractInterface*. +2- Use a _case_ operator to extract the entry point if it exists (use temporary variable name *ci* in the case). Otherwise throw an exception with error message "Entrypoint not found in contract Squadron" (and don't forget to cast the exception in the right type). The extracted entry point must be stored in a variable called *contractInterface*. 3- In order to prepare the ship information that need to be sent back to the Squadron contract. Check the expected type of entry point _moduleResponse_ and prepare a variable *ee* containing the expected ship *e*. diff --git a/src/frontend/src/pages/Chapters/Reason/ChapterPolymorphism/course.md b/src/frontend/src/pages/Chapters/Reason/ChapterPolymorphism/course.md index 80c5c52..af98fc7 100644 --- a/src/frontend/src/pages/Chapters/Reason/ChapterPolymorphism/course.md +++ b/src/frontend/src/pages/Chapters/Reason/ChapterPolymorphism/course.md @@ -55,7 +55,7 @@ As you can see, the entry point _RetrieveShip_ calls the function _sendTx_ which 1- Try to retrieve the entry point %moduleResponse of the given *callbackAddress* and store the result in a variable called *contractInterfaceOpt* of type _option(contract(actionSquadron))_ -2- Use a _switch_ operator to extract the entry point if it exists (use temporary variable name *ci* in the switch). Otherwise throw an exception with error message "Entrypoint not found in contract Squadron". The extracted entry point must be stored in a variable called *contractInterface*. +2- Use a _switch_ operator to extract the entry point if it exists (use temporary variable name *ci* in the switch). Otherwise throw an exception with error message "Entrypoint not found in contract Squadron" (and don't forget to cast the exception in the right type). The extracted entry point must be stored in a variable called *contractInterface*. 3- In order to prepare the ship information that need to be sent back to the Squadron contract. Check the expected type of entry point _moduleResponse_ and prepare a variable *ee* containing the expected ship *e*. From 7c49da087139fa21c48ae9454cff067a20f9f2bf Mon Sep 17 00:00:00 2001 From: Frank Hillard Date: Thu, 15 Oct 2020 15:28:47 +0200 Subject: [PATCH 3/3] add detail in mission polymorphism --- .../src/pages/Chapters/Camel/ChapterPolymorphism/course.md | 2 +- .../src/pages/Chapters/Pascal/ChapterPolymorphism/course.md | 2 +- .../src/pages/Chapters/Reason/ChapterPolymorphism/course.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/pages/Chapters/Camel/ChapterPolymorphism/course.md b/src/frontend/src/pages/Chapters/Camel/ChapterPolymorphism/course.md index 9204deb..07862b4 100644 --- a/src/frontend/src/pages/Chapters/Camel/ChapterPolymorphism/course.md +++ b/src/frontend/src/pages/Chapters/Camel/ChapterPolymorphism/course.md @@ -57,6 +57,6 @@ As you can see, the entry point _RetrieveShip_ calls the function _sendTx_ which 2- Use a _match_ operator to extract the entry point if it exists (use temporary variable name *ci* in the _Some_). Otherwise throw an exception with error message "Entrypoint not found in contract Squadron" (and don't forget to cast the exception in the right type). The extracted entry point must be stored in a variable called *contractInterface*. -3- In order to prepare the ship information that need to be sent back to the Squadron contract. Check the expected type of entry point _moduleResponse_ and prepare a variable *ee* containing the expected ship *e*. +3- In order to prepare the ship information that need to be sent back to the Squadron contract. Check the expected type of entry point _ModuleResponse_ and prepare a variable *ee* of this expected type containing the expected ship *e*. 4- Send a transaction to the retrieved entry point of the Squadron contract. The transaction must point to the _moduleResponse_ entrypoint of squadron contract and passing the right argument prepared in step 3. This transaction sends no money. The transaction is an _operation_ type that you can store in a variable *sendbackOperation*. diff --git a/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/course.md b/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/course.md index 2557d06..60f578d 100644 --- a/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/course.md +++ b/src/frontend/src/pages/Chapters/Pascal/ChapterPolymorphism/course.md @@ -57,6 +57,6 @@ As you can see, the entry point _RetrieveShip_ calls the function _sendTx_ which 2- Use a _case_ operator to extract the entry point if it exists (use temporary variable name *ci* in the case). Otherwise throw an exception with error message "Entrypoint not found in contract Squadron" (and don't forget to cast the exception in the right type). The extracted entry point must be stored in a variable called *contractInterface*. -3- In order to prepare the ship information that need to be sent back to the Squadron contract. Check the expected type of entry point _moduleResponse_ and prepare a variable *ee* containing the expected ship *e*. +3- In order to prepare the ship information that need to be sent back to the Squadron contract. Check the expected type of entry point _ModuleResponse_ and prepare a variable *ee* of this expected type containing the expected ship *e*. 4- Send a transaction to the retrieved entry point of the Squadron contract. The transaction must point to the _moduleResponse_ entrypoint of squadron contract and passing the right argument prepared in step 3. This transaction sends no money. The transaction is an _operation_ type that you can store in a variable *sendbackOperation*. diff --git a/src/frontend/src/pages/Chapters/Reason/ChapterPolymorphism/course.md b/src/frontend/src/pages/Chapters/Reason/ChapterPolymorphism/course.md index af98fc7..4fb792b 100644 --- a/src/frontend/src/pages/Chapters/Reason/ChapterPolymorphism/course.md +++ b/src/frontend/src/pages/Chapters/Reason/ChapterPolymorphism/course.md @@ -57,6 +57,6 @@ As you can see, the entry point _RetrieveShip_ calls the function _sendTx_ which 2- Use a _switch_ operator to extract the entry point if it exists (use temporary variable name *ci* in the switch). Otherwise throw an exception with error message "Entrypoint not found in contract Squadron" (and don't forget to cast the exception in the right type). The extracted entry point must be stored in a variable called *contractInterface*. -3- In order to prepare the ship information that need to be sent back to the Squadron contract. Check the expected type of entry point _moduleResponse_ and prepare a variable *ee* containing the expected ship *e*. +3- In order to prepare the ship information that need to be sent back to the Squadron contract. Check the expected type of entry point _ModuleResponse_ and prepare a variable *ee* of this expected type containing the expected ship *e*. 4- Send a transaction to the retrieved entry point of the Squadron contract. The transaction must point to the _moduleResponse_ entrypoint of squadron contract and passing the right argument prepared in step 3. This transaction sends no money. The transaction is an _operation_ type that you can store in a variable *sendbackOperation*.