Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xdevguild/esdt-faucet-sc
MultiversX ESDT Faucet Smart Contract
https://github.com/xdevguild/esdt-faucet-sc
dapp elrond faucet multiversx rust
Last synced: 4 months ago
JSON representation
MultiversX ESDT Faucet Smart Contract
- Host: GitHub
- URL: https://github.com/xdevguild/esdt-faucet-sc
- Owner: xdevguild
- Created: 2022-09-04T01:17:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-10T11:53:06.000Z (11 months ago)
- Last Synced: 2024-07-31T20:30:54.285Z (7 months ago)
- Topics: dapp, elrond, faucet, multiversx, rust
- Language: Rust
- Homepage: https://devnet-multiversx-esdt-faucet.netlify.app/
- Size: 95.7 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-multiversx-dev-resources - ESDT Faucet SC - ESDT Faucet - claim, deposit ESDT tokens (MultiversX community / Smart contracts)
README
### MultiversX devnet/testnet faucet (distribution) smart contract
The primary purpose of the smart contract is to have a simple solution for ESDT tokens faucet on the devnet and testnet. It is helpful for demo purposes and testing.
**Example use case**: You want to showcase some dApp where users can log in using auth providers, and then they need a specific ESDT token to play around with. You can send some tokens to the smart contract, and then users will be able to claim some of them.
### Assumptions
- Users can claim the maximum tokens. The max is set when depositing
- Users can call the claim endpoint once per 24 hours
- Everyone can send ESDT tokens to the smart contract### How to deploy and interact with mxpy
For now, the best would be to use the mxpy (example for the devnet) (there will also be an option with the Buildo Begins tool, it should be much simpler then):
Deploy (max tokens per day, a percentage from the whole supply, as an argument, here 1)
```bash
mxpy --verbose contract deploy --chain="D" --bytecode="./output/esdt-faucet-sc.wasm" --pem="./walletKey.pem" --gas-limit=80000000 --proxy="https://devnet-gateway.multiversx.com" --recall-nonce --send
```Deposit and call the setLimit function on sc (arguments for setLimit (here 100), we are depositing 10_000_000 of the token)
```bash
mxpy --verbose contract call --chain="D" --pem="walletKey.pem" --gas-limit=3000000 --function="ESDTTransfer" --arguments str:BUILDO-22c0a5 10000000000000000000000000 str:setLimit 100000000000000000000 --proxy="https://devnet-gateway.multiversx.com" --recall-nonce --send
```
The `BUILDO-22c0a5` token has 18 decimal places.Claim ESDTs (token id (here BUILDO-22c0a5) and amount to claim (here 3))
```bash
mxpy --verbose contract call --chain="D" --pem="walletKey.pem" --gas-limit=3000000 --function="claim" --arguments str:BUILDO-22c0a5 3000000000000000000 --proxy="https://devnet-gateway.multiversx.com" --recall-nonce --send
```
The `BUILDO-22c0a5` token has 18 decimal places.### How to interact with it using the frontend dApp
It is quite straightforward. The Nextjs dApp is based on [nextjs-dapp-template](https://github.com/xdevguild/nextjs-dapp-template). By default it will use the smart contract listed below. But you can deploy yours and change it in the .env variables.
With the dApp you can login using one of four auth providers and then deposit the ESDTs if you are the manager or claim ESDTs if you need some of them.
The Dapp repository: https://github.com/xdevguild/esdt-faucet-dapp.
Live app on the devnet: https://devnet-multiversx-esdt-faucet.netlify.app
### Currently deployed example smart contract
Just an example, you can use this one or deploy yours.
- [erd1qqqqqqqqqqqqqpgq7a0cq90r2kqymtaqysxp7umrcyp04jgmgtkscelhmp](https://devnet-explorer.multiversx.com/accounts/erd1qqqqqqqqqqqqqpgq7a0cq90r2kqymtaqysxp7umrcyp04jgmgtkscelhmp)
### TODO
- other tokens types (SFT/NFT)
- buildo begins interactions (as general smart contract-related functionality)
- more configuration options?### Issues, ideas
Please report all bugs and ideas for improvements.
### You may also like
- [Elven Tools](https://github.com/ElvenTools)
- [Elven.js](https://github.com/juliancwirko/elven.js)
- [Buildo Begins](https://github.com/xdevguild/buildo-begins)