## Gear 合约开发案例解析 - DEX <p align="center"> <a href="https://gitpod.io/#https://github.com/gear-foundation/dapps-dex"> <img src="https://gitpod.io/button/open-in-gitpod.svg" width="240" alt="GEAR"> </a> </p> 代码仓库: https://github.com/gear-foundation/dapps-dex 本 PPT 链接: https://hackmd.io/@btwiuse/dex --- Exchange <a href="#"> <img src="https://hackmd.io/_uploads/Skp_h3sY3.png" width="480" alt="multisig"> </a> --- <a href="#"> <img src="https://hackmd.io/_uploads/SJ7j46itn.png" width="480" alt="multisig"> </a> Centralized exchange (CEX): 依靠做市商撮合买卖双方 --- <a href="#"> <img src="https://hackmd.io/_uploads/ry3grpst3.png" width="480" alt="multisig"> </a> Decentralized exchange (DEX): 流动性池+自动做市商 --- ![](https://hackmd.io/_uploads/H1aXYTitn.png) Liquidity Pool: 提供交易所需流动性 --- <a href="#"> <img src="https://hackmd.io/_uploads/SJ2HOasF2.png" width="360" alt="multisig"> </a> Automated Market Maker: 根据代币供应确定价格 --- <a href="#"> <img src="https://hackmd.io/_uploads/B16SKToth.png" width="360" alt="multisig"> </a> > X * Y = K Constant Product Market Maker (固定乘积做市算法) --- 参考 Wiki: https://wiki.gear-tech.io/docs/examples/dex/ <p align="center"> <a href="https://gitpod.io/#https://github.com/gear-foundation/dapps-dex"> <img src="https://gitpod.io/button/open-in-gitpod.svg" width="240" alt="GEAR"> </a> </p> 代码仓库: https://github.com/gear-foundation/dapps-dex - factory 合约: 负责创建 LP - pair 合约: - 添加/提取流动性 - 执行代币交易 --- ## build ``` $ make init $ make build ``` ## download ``` ./target/wasm32-unknown-unknown/release/dex_factory.opt.wasm ./target/wasm32-unknown-unknown/release/dex_pair.opt.wasm ./factory/dex_factory.meta.txt ./pair/dex_pair.meta.txt ``` ## deploy https://idea.gear-tech.io/ --- ## 课后作业 本期作业: 无 课后答疑频道: https://t.me/Gear_CN --- # 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">
{"slideOptions":"{\"theme\":\"solarized\",\"spotlight\":{\"enabled\":false}}","description":"代码仓库: https://github.com/gear-dapps/dao-light","title":"Gear 合约开发案例解析 - DEX","contributors":"[{\"id\":\"94262fbf-81ae-4ed7-933c-561a41bd977a\",\"add\":5382,\"del\":3294}]"}
    264 views