mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
835 B
22 lines
835 B
2 years ago
|
# Token Sale
|
||
|
|
||
|
One way to distribute our token is to sell it. We will set a fixed price for each token. The tokens will have to be send to the Smart Contract by their owner initally.
|
||
|
|
||
|
### Instructions
|
||
|
|
||
|
- Create a Smart Contract `TokenSale`
|
||
|
|
||
|
- The contract imports MinimalToken
|
||
|
|
||
|
- Create a `constructor` function that takes as parameter the address of a deployed `MinimalToken` and the price of a token (in wei).
|
||
|
|
||
|
- Create a public payable function `buy()` that sends to the buyer token proportionally to the value send.
|
||
|
|
||
|
- Create a public function `getPrice()` that returns the price of the token.
|
||
|
|
||
|
- Create a public function `collect()` that allows the initial deployer of the contract to collect the proceedings from the sale
|
||
|
|
||
|
### Resources
|
||
|
|
||
|
- [solidity : import"](https://docs.soliditylang.org/en/v0.8.4/layout-of-source-files.html)
|