# TokenFaucet Contract (ERC20)

## IERC20.sol

```solidity
//SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

interface IERC20 {

    event Transfer(address indexed from, address indexed to, uint value);
    event Approval(address indexed owner, address indexed spender, uint value);

    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint);
    function transfer(address recipient, uint amount) external returns (bool);
    function transferFrom(address sender, address recipient, uint amount) external returns (bool);
    function approve(address spender, uint amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint);

    // ======================================================
    //                        OPTIONAL                       
    // ======================================================
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);

}
```

## TokenFaucet.sol

```solidity
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "./IERC20.sol";

contract TokenFaucet {

    IERC20 immutable public Token;

    uint256 public amountAllowed = 100 ether;
    mapping(address => bool) public receivedAddress;

    event SendToken(address indexed receiver, uint256 indexed amount);

    constructor(address _tokenContract) {
        Token = IERC20(_tokenContract);
    }

    function requestTokens() external {
        require(!receivedAddress[msg.sender], "One address can only be withdrawn once");
        require(Token.balanceOf(address(this)) >= amountAllowed, "Faucet Empty!");
        
        Token.transfer(msg.sender, amountAllowed);
        receivedAddress[msg.sender] = true;

        emit SendToken(msg.sender, amountAllowed);
    }

}
```

### BNB Chain Testnet&#x20;

[**https://testnet.bscscan.com/address/0xdCdb1976274671AcD75EbB56C0A5c5c4404A8cC2**](https://testnet.bscscan.com/address/0xdCdb1976274671AcD75EbB56C0A5c5c4404A8cC2)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://whitepaper.redcatclub.com/home/redcat-smart-contract/tokenfaucet-contract-erc20.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
