-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,23 @@ | ||
School assignment in solidity | ||
# School assignment in solidity --> Carl Klöfverskjöld | ||
## EventCreator contract | ||
The `EventCreator` contract is a Solidity contract that allows users to create, manage, and participate in events. It's designed to handle events with a maximum of 65,000 tickets. | ||
|
||
Smart contract for register an event than that. | ||
## Key Features | ||
|
||
The register should close after a deadline has been met. | ||
The contract should include these functionallity: | ||
register a new event, | ||
open and close the event | ||
register attendences | ||
handle payment | ||
getter function over the registered antendee per event | ||
1. **Event Creation**: Users can create an event by providing details such as the event name, description, location, ticket price, total tickets, deadline, and minimum tickets required for the event to take place. | ||
|
||
Requirment for VG: | ||
atleast: 1 custom error, one require, one assert and one revert | ||
Need to have a falback and receive functions | ||
Distrubute and verify the contract on etherscan. And provide a link | ||
Atleast test coverage of 90% | ||
Identify and implement atleast three gasoptimzing solution with an explaination. | ||
2. **Ticket Purchase**: Users can buy tickets for an event. The contract ensures that the event is open, has not ended, and has enough tickets available. It also checks that the user has sufficient funds and has sent enough Ether to cover the cost of the tickets. | ||
|
||
3. **Event Management**: The owner of an event can pause, resume, or cancel the event. If an event is cancelled, all attendees are refunded. | ||
|
||
4. **Withdraw Funds**: The owner of an event can withdraw the funds collected from ticket sales. This can be done either at the end of the event or at the halfway point if the minimum number of tickets has been sold. | ||
|
||
5. **Fallback Function**: The contract includes a fallback function that reverts any transactions that don't match the available functions, preventing Ether from being sent to the contract without a function call. | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
## Foundry | ||
|
||
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** | ||
|
||
Foundry consists of: | ||
|
||
- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). | ||
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. | ||
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. | ||
- **Chisel**: Fast, utilitarian, and verbose solidity REPL. | ||
|
||
## Documentation | ||
|
||
https://book.getfoundry.sh/ | ||
|
||
## Usage | ||
|
||
### Build | ||
|
||
```shell | ||
$ forge build | ||
``` | ||
|
||
### Test | ||
|
||
```shell | ||
$ forge test | ||
``` | ||
|
||
### Format | ||
|
||
```shell | ||
$ forge fmt | ||
``` | ||
|
||
### Gas Snapshots | ||
|
||
```shell | ||
$ forge snapshot | ||
``` | ||
|
||
### Anvil | ||
|
||
```shell | ||
$ anvil | ||
``` | ||
|
||
### Deploy | ||
|
||
```shell | ||
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key> | ||
``` | ||
|
||
### Cast | ||
|
||
```shell | ||
$ cast <subcommand> | ||
``` | ||
|
||
### Help | ||
|
||
```shell | ||
$ forge --help | ||
$ anvil --help | ||
$ cast --help | ||
``` | ||
### Requirment for VG: | ||
[x] A constructor | ||
[x] Atleast: 1 custom error, one require, one assert, one revert, event, and modifier | ||
[x] Have a falback function | ||
[x] Identify and implement atleast three gasoptimzing solution with an explaination. | ||
[ ] Distrubute and verify the contract on etherscan. And provide a link | ||
[ ] Atleast test coverage of 90% |