This project is a faucet that allows Circles users to exchange their Circles tokens (CRC) for Sepolia ETH. It consists of three main components: a smart contract, a backend worker, and a frontend application.
To receive Sepolia ETH, you need to have a Circles account, be a registered human and with trust score > 50. You can then use the faucet to exchange your CRC for Sepolia ETH.
- Circles Account: You need a Circles account. If you don't have one, you can create one at app.metri.xyz.
- Registered Human: Your Circles account must be registered as a human.
- Trust Score: Your Circles account must have a trust score of at least 50.
- Wallet: You need a web3 wallet like MetaMask to interact with the faucet.
- Go to the Faucet Website: Open the faucet website in your browser.
- Connect Your Wallet: Connect your wallet to the website.
- Check Eligibility: The website will check if you are eligible to use the faucet.
- Enter Recipient Address: Enter the Sepolia address where you want to receive the ETH.
- Select Amount: Choose the amount of ETH you want to receive.
- Transfer CRC: You will be redirected to Metri to transfer the corresponding amount of CRC to the faucet.
- Receive ETH: Once the CRC transfer is confirmed, you will receive the Sepolia ETH in your wallet.
The project is a monorepo containing three packages: contracts, backend, and app.
contracts: A Foundry project with theFaucetOrg.solsmart contract. This contract is deployed on the Gnosis chain and is registered as an organization on the Circles Hub. It receives CRC from users and emits aFaucetRequestedevent.backend: A Node.js application that listens forFaucetRequestedevents from theFaucetOrgcontract on the Gnosis chain. When an event is received, it sends the corresponding amount of Sepolia ETH to the user's address.app: A React application that provides a user interface for the faucet. It allows users to connect their wallet, check their eligibility, and initiate the process of exchanging CRC for Sepolia ETH.
- A user visits the faucet web application (
app). - The user connects their wallet. The application checks if the user's Circles account is eligible for the faucet (registered as human, trust score > 50).
- The user specifies a recipient address on the Sepolia network and the amount of ETH they want to claim.
- The application generates a link or QR code that directs the user to Metri to transfer CRC to the
FaucetOrgsmart contract on the Gnosis chain. The recipient address and CRC amount are encoded in the transaction data. - The
FaucetOrgcontract receives the CRC, verifies the user's eligibility, and emits aFaucetRequestedevent with the recipient address and the amount of ETH to be sent. - The
backendworker, listening for events on the Gnosis chain, catches theFaucetRequestedevent. - The
backendworker sends the specified amount of Sepolia ETH to the recipient address.
To set up the development environment, you need to have Node.js and Foundry installed.
-
Clone the repository:
git clone <repository-url> cd circles-faucet
-
Install dependencies:
pnpm install
-
Set up environment variables:
- Create a
.envfile in theapp,backend, andcontractsdirectories by copying the.env.examplefiles. - Fill in the required environment variables in each
.envfile.
- Create a
-
Run the applications:
- Contracts:
cd contracts forge build - Backend:
cd backend pnpm start:faucetWorker - App:
cd app pnpm dev
- Contracts: