TL;DR:
The Fungible Faucet Dapp sends tokens to a user's wallet when they click the "Mint Fungible Tokens" button.
Install the prerequisites. Then in a first terminal in the directory where you want to put your dapp, install the dapp:
agoric init --dapp-template dapp-fungible-faucet my-fungible-faucet
cd my-fungible-faucet
# Start the Agoric platform
agoric install && agoric start --reset
In a second terminal, deploy this contract and the API server
agoric deploy contract/deploy.js
agoric deploy api/deploy.js
In a third terminal,
# Navigate to the `ui` directory and start a local server
cd ui && yarn start
Then navigate to http://127.0.0.1:3000.
The Fungible Faucet Dapp is the simplest Agoric Dapp. It demonstrates the three important parts of a dapp and how they should be connected:
- the browser UI (the frontend)
- the API server (the backend)
- the on-chain contract
This dapp starts a local blockchain on your computer, and deploys a basic contract to that blockchain. It does not currently deploy or connect to the Agoric testnet.
This particular dapp UI is written in vanilla JS for simplicity (as opposed to using a framework).
- Navigate to http://127.0.0.1:3000.
- Enter
agoric open
in your terminal - A window for your wallet should open.
- Under "Dapps" in the wallet, enable the FungibleFaucet Dapp:
- Back on the Fungible Faucet page, click the "Mint Fungible Tokens" button.
- Go back to your wallet and approve the offer stating that you want 1000 tokens.
- Once the offer has been approved, your wallet makes an offer to Zoe
on your behalf, giving you tokens from the
mintPayments
contract. You will receive a message that the offer was successful and should see the tokens in your purses.
To learn more about how to build Agoric Dapps, please see the Dapp Guide.
See the Dapp Deployment Guide for how to deploy this Dapp on a public website, such as https://fungiblefaucet.testnet.agoric.com/