Skip to content

exec009/bep20-token-kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bep20-token-kit

A Solidity BEP20 token contract for Binance Smart Chain with mintable, burnable, operable transfer, and token recovery extensions all compiled into a single deployable file.

What this project covers

Feature Description
BEP20 base Standard transfer, approval, and allowance logic
Mintable Owner-controlled token minting with a finish-minting lock
Burnable Token holders can burn their own tokens or approved amounts
Operable ERC-1363-style callbacks on transfer and approval to receiver/spender contracts
ERC165 Interface detection to check compatibility at runtime
Token Recovery Owner can recover any BEP20 tokens accidentally sent to the contract address

Project structure

contracts/
  kshib.sol          - fully flattened BEP20 token with all extensions

Contract overview

The flattened file contains these components in order:

Component Purpose
Context Provides _msgSender() and _msgData()
Ownable Single-owner access control
IBEP20 Standard BEP20 interface
BEP20 Core token implementation
BEP20Mintable Adds mint and finishMinting with a canMint modifier
BEP20Burnable Adds burn and burnFrom
IERC165 Interface detection standard
IBEP20Operable Interface for operatable transfer with callbacks
IBEP20OperableReceiver Callback interface for transfer receivers
IBEP20OperableSpender Callback interface for approval receivers
Address Low-level call helpers
ERC165Checker Utility to check interface support
ERC165 Base ERC165 implementation
BEP20Operable Adds transferAndCall and approveAndCall
TokenRecover Allows owner to recover erroneously sent BEP20 tokens
TheKing The main token contract combining all extensions

Prerequisites

  • Solidity ^0.8.0
  • A Solidity compiler (e.g., solc, Remix IDE, Brownie, or Hardhat)

For testnet or mainnet deployment you also need:

  • A wallet private key for the deployer account
  • A BSC RPC endpoint (public endpoints available for testnet and mainnet)

Installation

Clone the repository and open contracts/kshib.sol in your Solidity development environment.

git clone <repository-url>
cd bep20-token-kit

No package installation is required. The contract is fully self-contained.

Deployment

Deploy TheKing with four constructor arguments:

Parameter Type Description
name_ string Token full name
symbol_ string Token ticker symbol
decimals_ uint8 Decimal places (typically 18)
initialBalance_ uint256 Tokens minted to the deployer on construction

Using Remix IDE:

  1. Open contracts/kshib.sol in Remix
  2. Compile with Solidity 0.8.x
  3. Deploy TheKing with your chosen parameters

Using Brownie:

from brownie import TheKing, accounts

deployer = accounts.load('deployer')
token = TheKing.deploy(
    "My Token",
    "MTK",
    18,
    10_000_000_000 * 10**18,
    {'from': deployer}
)

Customization

To reuse this as a template:

  • Change the token name, symbol, and initial supply in your deploy script (no source edits required)
  • To rename the contract, replace TheKing in the contract TheKing declaration and the constructor
  • To add supply caps, add a MAX_SUPPLY constant and a require check in _mint

Key behaviors

  • Only the contract owner can mint new tokens
  • Once finishMinting() is called, minting is permanently disabled
  • burnFrom requires the caller to have approval for the amount being burned
  • transferAndCall and approveAndCall trigger callbacks on receiver/spender contracts if they implement the corresponding interfaces
  • recoverBEP20 sends any accidentally deposited tokens back to the owner

License

MIT — see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors