This shows you the differences between two versions of the page.
fob:laboratoare:03 [2022/10/27 02:02] 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 6: | Line 6: | ||
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> | <note important> | ||
Install docker using [[https://docs.docker.com/engine/install/ubuntu/|this link]]. | Install docker using [[https://docs.docker.com/engine/install/ubuntu/|this link]]. | ||
Line 11: | Line 12: | ||
You can find Elrond docker images at [[https://hub.docker.com/r/elrondnetwork/build-contract-rust/tags|this link]]. | You can find Elrond docker images at [[https://hub.docker.com/r/elrondnetwork/build-contract-rust/tags|this link]]. | ||
</note> | </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 38: | Line 40: | ||
== Make a contract call to view the registered users. == | == Make a contract call to view the registered users. == | ||
+ | === Modify the registration endpoint to enable VIP access === | ||
+ | |||
+ | == 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 === | === Modify the registration fee to enable Early Bird and Full price access === | ||
- | == Create a new storage mapper *registration_fee_vip*. == | + | == Create a new endpoint that modifies the *registration_fee* and *registration_fee_vip* storage mapper. == |
- | ==Create a new endpoint that modifies the *registration_fee* and *registration_fee_vip* storage mapper. == | + | |
This endpoint should be call only by the owner. | This endpoint should be call only by the owner. | ||
<note tip>Use #[only_owner] endpoint annotation.</note> | <note tip>Use #[only_owner] endpoint annotation.</note> | ||
Line 48: | Line 54: | ||
After the Early Bird expires, the admin will call this endpoint. | After the Early Bird expires, the admin will call this endpoint. | ||
- | === Modify the registration endpoint to enable VIP access === | + | === BONUS: Create a feature to enable 50% discount vouchers for friends and partners === |
- | === 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 == |