# Use Remix and Metamask to test smart contract ## Install Metamask - https://metamask.io/download/ - Faucet ETH testnet (Rinkeby testnet): https://faucet.metamask.io/ - Switch to Rinkeby testnet ![](https://i.imgur.com/pvYVOHc.png) - Switch account in Metamask ![](https://i.imgur.com/450wvcC.png) ![](https://i.imgur.com/G0ngKBP.png) ## Use Remix Access to URL of Remix: https://remix.ethereum.org/ ### Step 1: Create contract file - Create new file in folder **contracts** ![](https://i.imgur.com/rrSFf6K.png) - Create file **MetareumXP.sol** ![](https://i.imgur.com/hDdSMKS.png) - Copy code to **MetareumXP.sol** ![](https://i.imgur.com/puRi9YN.png) ### Step 2: Compile smart contract - Switch to **Solidity Compiler** tab ![](https://i.imgur.com/8Z8OvkY.png) - Choose version Solidty fit with `pragma solidity` (In here is 0.8.7) - Press button Compile MetareumXP.sol - Compile success ![](https://i.imgur.com/cxrpGQK.png) ### Step 3: Deploy smart contract to Rinkeby testnet - Switch to "Deploy & run transactions" tab ![](https://i.imgur.com/M8qvIE2.png) - Switch *ENVIRONMENT* from **Remix VM(London)** to **Injected Provider - Metamask** ![](https://i.imgur.com/Nxe1FoU.png) - Press button **Deploy** and Confirm transaction with Metamask (Balance ETH > 0) ![](https://i.imgur.com/tMeVMoj.png) - Deploy Successfully, Instance of contract will visible **Deployed Contracts*8 tab. ![](https://i.imgur.com/1PE2p0K.png) ### Step 4: Test function in smart contract ### Check balance token - Paste address to input parameter, press **balanceOf** ![](https://i.imgur.com/8r7ne47.png) ### Check name token - Call **name** function ![](https://i.imgur.com/xCzoTeT.png) ### Check symbol token - Call **symbol** function ![](https://i.imgur.com/L5wtR81.png) ### Check total supply - Call **totalSupply** function ![](https://i.imgur.com/Anz1BTG.png) ### Transfer token (balanceOf > 0) - Call function **transfer** or **transferFrom** ![](https://i.imgur.com/LXrypEo.png) - Confim with Metamask ![](https://i.imgur.com/FGai2zu.png) - New balance of sender ![](https://i.imgur.com/ofHijiN.png) - New balance of receiver ![](https://i.imgur.com/sZRTNYG.png) ### Mint token (only admin - address deploy contract) ![](https://i.imgur.com/7y6TxIe.png) - If address is not admin, transaction will fail ![](https://i.imgur.com/EVA43Z1.png) ### Burn token ![](https://i.imgur.com/Sh0CwfR.png) - New balance after burn ![](https://i.imgur.com/eoNjkIf.png)