Onchain.Aave.Faucet (onchain_aave v0.2.0)

Copy Markdown View Source

Aave testnet faucet operations.

Mints test ERC-20 tokens on Aave testnets (Sepolia). The faucet contract is testnet-only — calling mint/4 with a mainnet network will return {:error, {:unknown_contract, :faucet}} from the address registry.

Error Format

Errors pass through from underlying modules:

SourceError Shape
Onchain.Address.validate/1{:error, {:invalid_address, input}}
Onchain.Aave.Contracts.address/2{:error, {:unknown_contract, :faucet}}
Onchain.ABI.encode_call/2{:error, {:encode_error, ...}}
Onchain.Signer.send_transaction/3{:error, {:missing_option, ...}}, {:error, {:sign_error, ...}}, etc.

Functions

FunctionPurpose
mint/4Mint test tokens from the faucet (returns tx hash)
mint!/4Same, raises on error

API Functions

FunctionArityDescriptionParam Kinds
mint!4Mint test ERC-20 tokens from the Aave testnet faucet. Raises on error.token: value, to: value, amount: value, opts: value
mint4Mint test ERC-20 tokens from the Aave testnet faucet.token: value, to: value, amount: value, opts: value

Summary

Functions

Mint test ERC-20 tokens from the Aave testnet faucet.

Mint test ERC-20 tokens from the Aave testnet faucet. Raises on error.

Functions

mint(token, to, amount, opts)

@spec mint(String.t() | binary(), String.t() | binary(), non_neg_integer(), keyword()) ::
  {:ok, String.t()} | {:error, term()}

Mint test ERC-20 tokens from the Aave testnet faucet.

Parameters

  • token - ERC-20 token contract address to mint (value)
  • to - Recipient address (value)
  • amount - Amount to mint (raw integer, not decimal-adjusted) (value)
  • opts - Required: :private_key, :nonce, :chain_id, :rpc_url, :network. Optional: :gas_limit (default 200k), :max_fee_per_gas, :max_priority_fee_per_gas (value)

Returns

Transaction hash hex string ({:ok, String.t()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      description: "Required: :private_key, :nonce, :chain_id, :rpc_url, :network. Optional: :gas_limit (default 200k), :max_fee_per_gas, :max_priority_fee_per_gas",
      kind: :value
    },
    token: %{description: "ERC-20 token contract address to mint", kind: :value},
    to: %{description: "Recipient address", kind: :value},
    amount: %{
      description: "Amount to mint (raw integer, not decimal-adjusted)",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, String.t()} | {:error, term()}",
    description: "Transaction hash hex string"
  }
}

mint!(token, to, amount, opts)

@spec mint!(
  String.t() | binary(),
  String.t() | binary(),
  non_neg_integer(),
  keyword()
) :: String.t()

Mint test ERC-20 tokens from the Aave testnet faucet. Raises on error.

Parameters

  • token - ERC-20 token contract address to mint (value)
  • to - Recipient address (value)
  • amount - Amount to mint (raw integer, not decimal-adjusted) (value)
  • opts - Required: :private_key, :nonce, :chain_id, :rpc_url, :network. Optional: :gas_limit (default 200k), :max_fee_per_gas, :max_priority_fee_per_gas (value)

Returns

Transaction hash hex string (string)

# descripex:contract
%{
  params: %{
    opts: %{
      description: "Required: :private_key, :nonce, :chain_id, :rpc_url, :network. Optional: :gas_limit (default 200k), :max_fee_per_gas, :max_priority_fee_per_gas",
      kind: :value
    },
    token: %{description: "ERC-20 token contract address to mint", kind: :value},
    to: %{description: "Recipient address", kind: :value},
    amount: %{
      description: "Amount to mint (raw integer, not decimal-adjusted)",
      kind: :value
    }
  },
  returns: %{type: :string, description: "Transaction hash hex string"}
}