## Gear 合约开发案例解析 - Crowdsale
<p align="center">
<a href="https://gitpod.io/#https://github.com/gear-foundation/dapps-crowdsale">
<img src="https://gitpod.io/button/open-in-gitpod.svg" width="240" alt="GEAR">
</a>
</p>
代码仓库: https://github.com/gear-foundation/dapps-crowdsale
本 PPT 链接: https://hackmd.io/@btwiuse/crowdsale
---
Cryptocurrency Crowdsale - Initial Coin Offering - Initial Public Offering
<a href="#">
<img src="https://hackmd.io/_uploads/H1sb2-bo3.png" width="480" alt="multisig">
</a>
---
众筹合约是一种在链上为某个项目募集资金的 dApp,用于
- 设定众筹目标(一般是链上的原生代币)
- 设定众筹的起止时间
- 设定兑换价格
- 根据投资人提供的资金数量发放相应的 Token 作为回报
---
假如,Elon 原本计划于 2033 年在 Doge 链上启动一个新的创业项目 SpaceTravel,需要面向公众募集 $DOGE 用于飞船研发,为此创建了一个众筹计划, 时间 4.2 ~ 6.9,为参与众筹的投资者发放总共 1T $ST 代币作为奖励,募集资金目标是 1B $DOGE,并且 $ST 价格在众筹期间线性递增 (500-1500 ST per DOGE)
---
<img src="https://hackmd.io/_uploads/Skz0UfZin.png" width="320" alt="multisig">
<img src="https://hackmd.io/_uploads/SyBtIfWon.png" width="320" alt="multisig">
Gear to the rescue!
---
参考 Wiki https://wiki.gear-tech.io/docs/examples/crowdsale
<p align="center">
<a href="https://gitpod.io/#https://github.com/gear-foundation/dapps-crowdsale">
<img src="https://gitpod.io/button/open-in-gitpod.svg" width="240" alt="GEAR">
</a>
</p>
代码仓库:
- 同质化代币合约 https://github.com/gear-foundation/dapps-sharded-fungible-token
- 众筹合约 https://github.com/gear-foundation/dapps-crowdsale
---
## build
```
$ make build
```
## download
```
./crowdsale.meta.txt
./target/wasm32-unknown-unknown/release/crowdsale.opt.wasm
./target/wasm32-unknown-unknown/release/crowdsale_state.meta.wasm
```
## deploy
https://idea.gear-tech.io/?node=wss://testnet.vara.rs
---
## 课后作业
本期作业: 在 [Vara Stable Testnet](https://idea.gear-tech.io/?node=wss://testnet.vara.rs) 上部署 https://github.com/gear-foundation/dapps-crowdsale 合约,并与合约交互,调用合约的 StartSale / Buy / EndSale 消息
其中代币合约地址使用 [debug_ft](https://idea.gear-tech.io/programs/0xd5be0fcf54cf648279a84d6b12399c976826343ad9c95722a22aec64e4ce526b?node=wss%3A%2F%2Ftestnet.vara.rs)
```
0xd5be0fcf54cf648279a84d6b12399c976826343ad9c95722a22aec64e4ce526b
```
---
# Questions
<img src="https://hackmd.io/_uploads/SyK8P72d2.jpg" width="240" alt="GEAR">
<img src="https://hackmd.io/_uploads/By_kgE3_2.png" width="240" alt="VARA">
课后答疑频道: https://t.me/Gear_CN
{"title":"Gear 合约开发案例解析 - Crowdsale","slideOptions":"{\"theme\":\"solarized\",\"spotlight\":{\"enabled\":false}}","description":"代码仓库: https://github.com/gear-foundation/dapps-dex","contributors":"[{\"id\":\"94262fbf-81ae-4ed7-933c-561a41bd977a\",\"add\":4020,\"del\":1621}]"}