Differences

This shows you the differences between two versions of the page.

Link to this comparison view

fob:laboratoare:03 [2022/10/27 01:09]
costin.carabas [Never Sea Festival Smart Contract]
fob:laboratoare:03 [2023/03/01 18:33] (current)
costin.carabas
Line 1: Line 1:
-===== Practical Session 03. =====+===== Smart Contract ​=====
  
 ==== Never Sea Festival Smart Contract ====  ==== Never Sea Festival Smart Contract ==== 
Line 5: Line 5:
 You are the Never Sea Festival 2023 organizers and you decide to create the registration via blockchain. You are the Never Sea Festival 2023 organizers and you decide to create the registration via blockchain.
 Starting from Smart Contract template you have to add more features to coordinate the event. Starting from Smart Contract template you have to add more features to coordinate the event.
 +
 +<​hidden>​
 +<note important>​
 +Install docker using [[https://​docs.docker.com/​engine/​install/​ubuntu/​|this link]].
 +
 +You can find Elrond docker images at [[https://​hub.docker.com/​r/​elrondnetwork/​build-contract-rust/​tags|this link]].
 +</​note>​
 +</​hidden>​
  
 Clone [[https://​github.com/​systems-cs-pub-ro/​Foundation-Of-Blockchains.git|Foundation of Blockchain repo]] and go to **lab03** folder. Clone [[https://​github.com/​systems-cs-pub-ro/​Foundation-Of-Blockchains.git|Foundation of Blockchain repo]] and go to **lab03** folder.
Line 10: Line 18:
 === Compile and deploy the Smart Contract template === === Compile and deploy the Smart Contract template ===
  
-Use [[https://​docs.elrond.com/​sdk-and-tools/erdpy/erdpy/#docsNav|erdpy]] to build the Smart Contract.+Use [[https://​docs.elrond.com/​developers/tutorials/counter/#build-the-contract]] to build the Smart Contract
 + 
 +<note tip>Use the parameter''​--arguments''​ to provide the arguments of **init** function.</​note>​ 
 + 
 +<note warning>​Check the deployment on the explorer. Do not assume that the contract was successfully deployed if there are no command line errors.</​note>​ 
 + 
 +<note tip> 
 +''​erdpy contract deploy --help''​ 
 +</​note>​ 
 + 
 +To check that the contract was successfully **built**, verify that there was a **wasm** file generate: ''​output/​neversea.wasm''​. 
 +This is the compiled code of your contract.
    
 +To check that the contract was successfully **deployed**,​ check the devnet/​testnet.
  
-=== Modify the registration fee to enable Early Bird and Full price access ​===+<note warning>​Any modification of the contract must be succeeded by a compilation and deployment!</​note>​ 
 + 
 +<note warning>​There are no float/​double types. 1 EGLD is actually 1 followed by 18 zeros. This way there are no decimal issues.</​note>​ 
 + 
 +== Make a contract call to register a user. =
 +== Make a contract call to view the registered users. ​==
  
 === Modify the registration endpoint to enable VIP access === === Modify the registration endpoint to enable VIP access ===
  
-=== Create a feature to enable 50% discount vouchers for friends and partners ===+== Create a new storage mapper registration_fee_vip. == 
 +== Create a new UnorderedSetMapper storage mapper (vip_participants) to save the VIPs == 
 +In the registration endpoint, make a verification of the tokens received. If the tokens received is **registration_fee_vip**,​ add the user to **vip_participants**,​ if the amount is **registration_fee**,​ add them to **participants**,​ else, deny registration. 
 + 
 +=== Modify the registration fee to enable Early Bird and Full price access === 
 + 
 +== Create a new endpoint that modifies the *registration_fee* and *registration_fee_vip* storage mapper. == 
 +This endpoint should be call only by the owner. 
 +<note tip>Use #​[only_owner] endpoint annotation.</​note>​ 
 + 
 +After the Early Bird expires, the admin will call this endpoint. 
 + 
 +=== BONUS: ​Create a feature to enable 50% discount vouchers for friends and partners === 
 + 
 +Create a list of hardcoded discount codes. 
 +== Create a new endpoint that receives a discount code as a parameter and registers a user with 50% discount ​==
fob/laboratoare/03.1666822174.txt.gz · Last modified: 2022/10/27 01:09 by costin.carabas
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0