TokenFactory

0x00000000f954986e83f82e3a719b124af0e6dd60

Verification
Verified
v0.8.26+commit.8a97fa7a
Type
Contract
20,686 bytes
ABI entries
27
5 read · 13 write
License
none

Contract information

Address
0x00000000f954986e83f82e3a719b124af0e6dd60
Chain
Robinhood Chain (4663)
Compiler
v0.8.26+commit.8a97fa7a
Optimization
Disabled
Creation tx
0x5f74643632…d0e0e91d06

Token

Not a token

This contract does not expose ERC-20 metadata.

Read contract (5)

essentialFee()uint256
feeController()address
owner()address
ownershipHandoverExpiresAt(address)uint256
standardFee()uint256

Events (4)

OwnershipHandoverCanceledOwnershipHandoverRequestedOwnershipTransferredTokenCreated

ABI

[
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "_initialOwner",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "_feeController",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "_standardFee",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "_essentialFee",
        "type": "uint256"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "constructor"
  },
  {
    "inputs": [],
    "name": "AlreadyInitialized",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "NewOwnerIsZeroAddress",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "NoHandoverRequest",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "Unauthorized",
    "type": "error"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "pendingOwner",
        "type": "address"
      }
    ],
    "name": "OwnershipHandoverCanceled",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "pendingOwner",
        "type": "address"
      }
    ],
    "name": "OwnershipHandoverRequested",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "oldOwner",
        "type": "address"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "newOwner",
        "type": "address"
      }
    ],
    "name": "OwnershipTransferred",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "tokenAddress",
        "type": "address"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "creator",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "tokenType",
        "type": "uint256"
      }
    ],
    "name": "TokenCreated",
    "type": "event"
  },
  {
    "inputs": [],
    "name": "cancelOwnershipHandover",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "pendingOwner",
        "type": "address"
      }
    ],
    "name": "completeOwnershipHandover",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "string",
        "name": "name",
        "type": "string"
      },
      {
        "internalType": "string",
        "name": "symbol",
        "type": "string"
      },
      {
        "internalType": "uint256",
        "name": "initialSupply",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "maxSupply",
        "type": "uint256"
      },
      {
        "internalType": "address",
        "name": "receiver",
        "type": "address"
      }
    ],
    "name": "deployEssentialToken",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "string",
        "name": "name",
        "type": "string"
      },
      {
        "internalType": "string",
        "name": "symbol",
        "type": "string"
      },
      {
        "internalType": "uint256",
        "name": "initialSupply",
        "type": "uint256"
      },
      {
        "internalType": "address",
        "name": "receiver",
        "type": "address"
      }
    ],
    "name": "deployStandardToken",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "token",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "recipient",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "amount",
        "type": "uint256"
      }
    ],
    "name": "emergencyWithdrawToken",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "essentialFee",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "feeController",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "owner",
    "outputs": [
      {
        "internalType": "address",
        "name": "result",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "pendingOwner",
        "type": "address"
      }
    ],
    "name": "ownershipHandoverExpiresAt",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "result",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "renounceOwnership",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "requestOwnershipHandover",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "_fee",
        "type": "uint256"
      }
    ],
    "name": "setEssentialFee",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "_feeController",
        "type": "address"
      }
    ],
    "name": "setFeeController",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "_fee",
        "type": "uint256"
      }
    ],
    "name": "setStandardFee",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "standardFee",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "newOwner",
        "type": "address"
      }
    ],
    "name": "transferOwnership",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address payable",
        "name": "recipient",
        "type": "address"
      }
    ],
    "name": "withdraw",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "withdrawToFeeController",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  }
]

Source code

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "./StandardERC20.sol";
import "./EssentialERC20.sol";
import "../FeeManager.sol";

/**
 * ------------------------------------------------------------------------------------------
 * ------------------------------------------------------------------------------------------
 * ----                                                                                  ----
 * ----                                                                                  ----
 * ----                                                                                  ----
 * ----                                                                                  ----
 * ----                                                                                  ----
 * ----                                                                                  ----
 * ----                                                                                  ----
 * ----                                                                                  ----
 * ----                                                                                  ----
 * ----                                                                                  ----
 * ----                                                                                  ----
 * ----                                                                                  ----
 * ----                                                                                  ----
 * ----         #####     ####  ####                                                     ----
 * ----        ######     ####  ####                                                     ----
 * ----       ########    ####  ####                                                     ----
 * ----      ####  ####   ####  ####                                                     ----
 * ----     ############  ####  ####                                                     ----
 * ----     ############# ####  ####                                                     ----
 * ----    ####      #### ####  ####                                                     ----
 * ----                                                                                  ----
 * ----                             ####                                                 ----
 * ----    ########### ####         ####                                                 ----
 * ----    ########### ####                                                              ----
 * ----        ###     ###########  ####  ##########   ###########  ########             ----
 * ----        ###     #####  ####  ####  ##### ##### #####  ##### ####                  ----
 * ----        ###     ####    ###  ####  ####   #### ####    #### #########             ----
 * ----        ###     ####    ###  ####  ####   #### ##### ######      ####             ----
 * ----        ###     ####    ###  ####  ####   ####   ########## #########             ----
 * ----                                                       ####                       ----
 * ----                                               ###########                        ----
 * ----                                                                                  ----
 * ----    ####    ####     ####           ####        ##########                        ----
 * ----    ####    #####   ####            ####        ##########                        ----
 * ----     ####  #######  ####  ########  ###########     ####                          ----
 * ----     #### ######## ####  ####  #### #####  ####    ######                         ----
 * ----      ######## ######## ################    ####   #######                        ----
 * ----       ######   ######  #####   #   ####   #######    ##### ----                  ----
 * ----       #####    #####    ########## ############   ######   ----                  ----
 * ----        ####     ####       #####   ### #####    #######    ----                  ----
 * ----                                                                                  ----
 * ----                                                                                  ----
 * ------------------------------------------------------------------------------------------
 * ------------------------------------------------------------------------------------------
 * @title TokenFactory
 * @author All Things Web3
 * @notice Website: https://allthingsweb3.com
 * @notice Factory contract to deploy different types of ERC20 tokens.
 */
contract TokenFactory is FeeManager {
    uint256 public standardFee;
    uint256 public essentialFee;

    event TokenCreated(
        address indexed tokenAddress,
        address indexed creator,
        uint256 tokenType
    );

    constructor(
        address _initialOwner,
        address _feeController,
        uint256 _standardFee,
        uint256 _essentialFee
    ) FeeManager(_initialOwner, _feeController) {
        standardFee = _standardFee;
        essentialFee = _essentialFee;
    }

    function setStandardFee(uint256 _fee) external onlyOwner {
        standardFee = _fee;
    }

    function setEssentialFee(uint256 _fee) external onlyOwner {
        essentialFee = _fee;
    }

    /**
     * @notice Deploys a Standard ERC20 token (Fixed Supply).
     * @dev Price: standardFee.
     * @param name The name of the token.
     * @param symbol The symbol of the token.
     * @param initialSupply The initial supply (in wei) to mint.
     * @param receiver The address that will receive the initial supply.
     * @return The address of the newly deployed token.
     */
    function deployStandardToken(
        string memory name,
        string memory symbol,
        uint256 initialSupply,
        address receiver
    ) external payable returns (address) {
        _payFee(standardFee);

        StandardERC20 newToken = new StandardERC20(
            name,
            symbol,
            initialSupply,
            receiver
        );

        emit TokenCreated(address(newToken), msg.sender, 0);

        return address(newToken);
    }

    /**
     * @notice Deploys an Essential ERC20 token (Mintable, Burnable, Pausable, Blacklist, Ownable).
     * @dev Price: essentialFee.
     * @param name The name of the token.
     * @param symbol The symbol of the token.
     * @param initialSupply The initial supply (in wei) to mint.
     * @param maxSupply The maximum supply (0 for unlimited).
     * @param receiver The address that will receive the initial supply and ownership.
     * @return The address of the newly deployed token.
     */
    function deployEssentialToken(
        string memory name,
        string memory symbol,
        uint256 initialSupply,
        uint256 maxSupply,
        address receiver
    ) external payable returns (address) {
        _payFee(essentialFee);

        EssentialERC20 newToken = new EssentialERC20(
            name,
            symbol,
            initialSupply,
            maxSupply,
            receiver
        );

        emit TokenCreated(address(newToken), msg.sender, 1);

        return address(newToken);
    }
}
Chain explorer7350msChain node89ms