Skip to content

Latest commit

 

History

History
107 lines (76 loc) · 2.4 KB

README.md

File metadata and controls

107 lines (76 loc) · 2.4 KB

Faucet Bot

Discord bot to allow users to request testnet gas on supported networks.

Uses Slash Commands and Ephemeral Messages to keep users wallet addresses private.

Slash Commands

  • /faucet <address> <chain>
    • Requests X native gas on <chain>

Installation

$ mix deps.get

Configuration

Copy the example secrets file and edit the secrets accordingly

$ cp config/secrets-example.exs config/secrets.exs
Discord

Discord bot token can be grabbed from Discord Developer Portal then Your application > Bot > Click to reveal token

config :nostrum,
  token: "..."
Ethers

The bot uses elixer_ethers to handle EVM interactions. It uses a private key to sign messages locally, which can be set in config/secrets.exs

config :ethers,
  default_signer_opts: [
    private_key: "..."
  ]

You can configure how much native gas will be sent with each faucet request in config/config.exs

config :faucet_bot,
  drip: %{
    sepolia: 0.1, # 0.1 ETH
    arbitrum_sepolia: 0.1, # 0.1 ETH
    optimism_sepolia: 0.1, # 0.1 ETH
    bsc: 0.5 # 0.5 BNB
  }

Each supported network will require a JSON-RPC API to use which can be set in config/secrets.exs

config :faucet_bot,
  rpc: %{
    sepolia: "https://...",
    arbitrum_sepolia: "https://...",
    optimism_sepolia: "https://...",
    bsc: "https://..."
  }

Additionally, each supported network will require an explorer URL to use which can be configured in config/config.exs

explorer: %{
    sepolia: "https://sepolia.etherscan.io",
    arbitrum_sepolia: "https://sepolia.arbiscan.io",
    optimism_sepolia: "https://sepolia-optimism.etherscan.io",
    bsc: "https://testnet.bscscan.com"
  }
Rate Limit

It is important to rate limit the faucet to prevent testnet gas being depleted. By default it is set to 1 day and can be changed in config/config.exs

config :faucet_bot,
  rate_limit_ms: 60_000 * 60 * 24

Running

$ mix run --no-halt

License

BSL-1.0