Lecture 4 - Homework & Resources

1 Videos


01 - Architecture of dapps (05:26)
02 - Conflux Studio (09:22)
03 - Writing and deploying smart contracts (10:11)
04 - Tickets example (19:17)
05 - Resources (03:20)

total duration: 47:36

2 Resources

Tickets Conflux Studio Project (unzip, then import into Conflux Studio)
https://github.com/Thegaram/cfx-uma-resources/raw/master/cfx-lecture-4-tickets.zip

Submit bugs and feature requests to Conflux Studio

Introduction to dapps

Built on Ethereum – dapp examples
docs.ethhub.io/built-on-ethereum/built-on-ethereum

Official Solidity 7.1 documentation
solidity.readthedocs.io/en/v0.7.1

Learn X in Y minutes (where X=Solidity)
learnxinyminutes.com/docs/solidity

Solidity by example
solidity-by-example.org/0.6

CryptoZombies

Conflux Studio overview

Dapp tutorial

Conflux frontend example project

Solidity Security: Comprehensive list of known attack vectors and common anti-patterns


the Ethernaut (by OpenZeppelin)
ethernaut.openzeppelin.com

3 Homeworks

3.1 Basic usage of Conflux Studio

Download and install Conflux Studio and all the components required.

Download the Tickets project from the lecture (https://github.com/Thegaram/cfx-uma-resources/raw/master/cfx-lecture-4-tickets.zip) and import it into Conflux Studio.

Deploy an instance of the contract on Conflux Oceanus (hint: you can send CFX from your Conflux Portal account to your Conflux Studio account).

Buy a ticket from another account. Validate the ticket with the owner. Withdraw the profits.

Send us the address of the contract, the 4 transaction hashes (deploy, buy(), validate(), withdraw()), and screenshots of how you sent them from Conflux Studio.

3.2 Customizing Tickets.sol

Update Ticket.sol so that it becomes possible to set the number of tickets and the price per ticket when you deploy a contract.

For instance, for event A, I want to sell 10 tickets of 100 CFX each. For event B, I want to sell 1000 tickets for 2 CFX each.

Test your solution on a local development network.

Send us the source code and a screenshot of deploying a contract with 33 tickets for 44 CFX each.

+1. Buying multiple tickets from one address [OPTIONAL]

Update Tickets.sol so that one user can buy multiple tickets. For instance, Bob might want to buy 2 tickets, one for himself and one for his girlfriend.

Test your solution on a local development network.

Send us the source code and some screenshots of buying 2 or more tickets from an address and then validating them.

+1. Time of the event [OPTIONAL]

Update Tickets.sol so that the organizer can set the time of the event.

Allow users to buy tickets up to 2 hours before the event. E.g. if the event is on 2020.12.01 19:00, you cannot buy tickets after 2020.12.01 17:00.

Allow the organizer to withdraw the profits 1 day after the event. E.g. if the event is on 2020.12.01 19:00, the organizer cannot withdraw the profits before 2020.12.02 19:00.

Hints:

233