This project approachs the standard ERC20 Token implementation in the urban mobility scenario. Here you can deploy the smart contract on Ethereum Ropsten testnet to create your tokens and use this app to simulate paying transportations services with MobiTokens.
As soon as you deploy the smart contract with Remix IDE and your Metamask wallet on Ropsten testnet, there will be 10k of MobiTokens attached to your wallet's address. After that, everything is set so you can use your MobiToken Menu to pay for transportation services. The MobiToken Menu was developed in React.js and it communicates to Ropsten testnet using Web3 API.
- Go to Remix IDE and import MobiToken.sol file. After that go to the Compile tab and click on Compile MobiToken.sol .
- Setup Metamask extension in your Chrome or Firefox browser.
You need to get some Ether to your wallet so you can pay the gas fees for the deployment. To do so, checkout Ropsten Ethereum Faucet to receive some Ether on your Ropsten testnet wallet. Make sure to switch your network on Metamask to a test one. If you used Metamask for the first time you may need to reload the page.
Now in Remix, change to the Deploy & Run tab and select Injected Web3
under ENVIRONMENT and connect to your wallet. Select which wallet will receive the tokens and click on deploy.
- Check Remix console to see if everything went as planned. You can also check in your Metamask if the transaction was executed. Now you need to save your contracts address(in red at the image below) for the next part.
You can also check your contract deployment at Etherscan.io
-
Input the contract address at line 8 in App.js
-
Input your main wallet address at line 21 in App.js
-
Input the other wallet address that will represent the public transportation provider in line 44 in App.js
-
On terminal, first you need to run
yarn install
to install all node packages and then runyarn start
to run the app on localhost. If your app fails to launch, try to comment line 50 in App.js for now.Maybe necessary: If you commented line 50, try clicking in any transportation option so the app will connect to your Metamask wallet. After that you can uncomment line 50 in App.js and save the file.
- Now the Menu is ready to go! You can pay what transportation you want to take. Peer to peer transaction are yet to be implemented.
- After clicking what transportation you will pay, your metamask will open so you can confirm the payment and also pay the gas fees.
Feel free to open an issue for suggesting or implementing new features or maybe asking something for me, I'll be happy to answer :)
Gabriel Monteiro 2020