RedCat DAO
  • Welcome to RedCat DAO
  • ☢️RedCat DAO
    • Discord YT Video
    • Discord Adopt RedCat
      • Step 1 - MAX 交易所入金與出金
      • Step2 - MetaMask 添加 BSC 鏈
      • Step3 - 幣安出金到 MetaMask 狐狸錢包
      • Step4 - 領養 RedCat
      • Step5 - 在二級市場或狐狸錢包查看 RedCat
      • Step6 - 認證持有 RedCat
    • Discord Announcement
    • Discord Verify
    • Discord Game
    • Discord Rest Area
    • Discord BlockChain Station
    • Discord BlockChain News
    • Discord Title
    • Discord Rank & Invite
  • 🏢RedCat Offical
    • Mint
    • Tool
    • Depoly Smart Contract
    • Smart Contract Control
  • 🎮RedCat Game
    • Cryptostal
      • Intro
      • Game Play
      • RedCat Ability
      • Strange Things
      • Crystal Drop Probability
      • Battle Record Not Read
    • Feeding Area
      • Intro
  • 🪟RedCat Gallery
    • Ethereum (ETH)
    • BNB Chain(BNB)
    • Polygon (MATIC)
  • 🏛️RedCat Social
    • Marketplace
    • Other Platform
  • 📔RedCat Smart Contract
    • RedCat NFT Contract
    • RedCat Game Contract
    • FT Contract (ERC20)
    • TokenFaucet Contract (ERC20)
    • NFT Contract (ERC721)
    • NFT Contract (ERC721A)
    • NFT Metadata Standards
    • MT Contract (ERC1155)
    • ERC20-Permit Contract (ERC2612)
    • SFT Contract (ERC3525)
    • Swapping Contract(PancakeSwap)
    • Yield Farms Contract(PancakeSwap)
    • Limit Orders Contract(PancakeSwap)
    • Syrup Pools Contract(PancakeSwap)
    • IFO Contract(PancakeSwap)
    • Transparent Proxy Contract
  • 🚄RedCat Experience
    • RedCat Roadmap
    • RedCat Pictures
    • RedCat Team
    • RedCat Contact
Powered by GitBook
On this page
  • IERC20.sol
  • TokenFaucet.sol
  • BNB Chain Testnet
  1. RedCat Smart Contract

TokenFaucet Contract (ERC20)

ERC20 水龍頭

IERC20.sol

//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

// 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

PreviousFT Contract (ERC20)NextNFT Contract (ERC721)

Last updated 2 years ago

📔
https://testnet.bscscan.com/address/0xdCdb1976274671AcD75EbB56C0A5c5c4404A8cC2