Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ShareXUSDT

Git Source

Inherits: ERC20, AccessControl

Title: ShareX USDT

This is a test token for development purposes only

ERC20 token for ShareX ecosystem testing on BSC testnet

State Variables

MINTER_ROLE

bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE")

DECIMALS

uint8 private constant DECIMALS = 6

MAX_SUPPLY

uint256 public constant MAX_SUPPLY = 1_000_000_000 * 10 ** DECIMALS

Functions

constructor

Constructor that gives DEFAULT_ADMIN_ROLE and MINTER_ROLE to the deployer

constructor() ERC20("ShareX USDT", "XUSDT");

decimals

Returns the number of decimals used to get its user representation

function decimals() public pure override returns (uint8);

mint

Mints tokens to a specified address

function mint(address to, uint256 amount) external onlyRole(MINTER_ROLE);

Parameters

NameTypeDescription
toaddressThe address to mint tokens to
amountuint256The amount of tokens to mint

burn

Burns tokens from the caller's account

function burn(uint256 amount) external;

Parameters

NameTypeDescription
amountuint256The amount of tokens to burn

burnFrom

Burns tokens from a specified account (requires allowance)

function burnFrom(address from, uint256 amount) external;

Parameters

NameTypeDescription
fromaddressThe account to burn tokens from
amountuint256The amount of tokens to burn

batchMint

Batch mint tokens to multiple addresses

function batchMint(address[] calldata recipients, uint256[] calldata amounts)
    external
    onlyRole(MINTER_ROLE);

Parameters

NameTypeDescription
recipientsaddress[]Array of addresses to mint to
amountsuint256[]Array of amounts to mint

faucet

Limited to 1000 USDT per call to prevent abuse

Faucet function for testnet - allows anyone to mint small amounts for testing

function faucet() external;

Events

TokensMinted

event TokensMinted(address indexed to, uint256 amount);

TokensBurned

event TokensBurned(address indexed from, uint256 amount);

Errors

MaxSupplyExceeded

error MaxSupplyExceeded();

InvalidAmount

error InvalidAmount();