Loading video player...
In Part 2 of this tutorial, community contributor Aditii completes the DEX build by writing the deployment script and full test suite, then deploys the exchange live to the Rootstock testnet using Foundry. ā WHAT YOU'LL BUILD IN THIS PART - Deploy.s.sol ā a Foundry deployment script that deploys the DEX and mock tokens, creates a liquidity pool, and adds initial liquidity automatically - RSKDex.t.sol ā a comprehensive test file covering pool creation, liquidity management, token swaps, slippage protection, and edge cases š§ WHAT YOU'LL LEARN - Writing a Foundry deployment script for multi-contract setups - Automating pool creation and initial liquidity provisioning on deploy - Writing unit tests with Foundry: pool creation, add/remove liquidity, token swaps, and revert scenarios - Testing slippage protection and insufficient liquidity edge cases - Securely managing private keys with a .env file - Running a live deployment to the Rootstock testnet with --broadcast ______ ā” MISSED PART 1? Watch it first ā https://youtu.be/KKLO0_0lGVI Part 1 covers the core DEX smart contracts: AMM logic, liquidity pools, token swaps, and the MockERC20 test token ______ Useful Links - Foundry ā https://getfoundry.sh - OpenZeppelin Contracts ā https://docs.openzeppelin.com/contracts - Rootstock Testnet RPC ā https://public-node.testnet.rsk.co - Rootstock Testnet Faucet (free tRBTC) ā https://faucet.rootstock.io - Chainlist (add Rootstock to MetaMask) ā https://chainlist.org - Rootstock Developer Docs ā https://dev.rootstock.io ______ This video is part of the From Devs to Devs series ā technical tutorials created by community contributors through the Rootstock Hacktivator program. š Want to create your own tutorial and earn rewards? Learn more at https://rootstock.io/hacktivator/ ______ Timestamps 00:00 Introduction to Deployment Script 02:07 Writing the Deployment Script 03:51 Creating the Liquidity Pool 06:21 Adding Initial Liquidity 08:20 Deployment Summary and Pool Reserves 10:07 Testing the DEX Functionality 11:57 Mock Token Deployment 13:45 Creating and Testing Liquidity Pools 25:38 Creating Test Liquidity and Initial Setup 28:42 Liquidity Management and Token Swapping 32:11 Testing Insufficient Liquidity Scenarios 35:27 Handling Slippage and Output Calculations 39:52 User Liquidity Tracking and Verification 44:02 Deployment of Smart Contracts on RSK Testnet #Rootstock #DEX #DeFi #Solidity #Foundry #Bitcoin #AMM #ERC20 #Web3 #SmartContracts #Testnet #LiquidityPool #BlockchainDev