A BEP-20 token contract with staking mechanics deployed on Binance Smart Chain. Built with the Brownie framework and OpenZeppelin contracts.
contracts/Token.sol- BEP-20 token with locked balance tracking and configurable stake ratescripts/deploy.py- deploys the token contract to a target networkscripts/interact.py- reads on-chain token state for a given addressscripts/verifySmartContract.py- publishes contract source to the block explorertests/- Brownie test suite covering balance, ownership, and transfer behaviorbsc-testnet.yaml- Brownie network configuration for BSC and common EVM networks
- Python 3 with Brownie
- Node.js and npm
Install Solidity dependencies:
npm installInstall Python dependencies:
pip install eth-browniebrownie testImport the network config:
brownie networks import bsc-testnet.yaml TrueAdd BSC mainnet manually if not already present:
brownie networks add BSC bsc-mainnet chainid=56 explorer=https://api.bscscan.com/api host=https://bsc-dataseed1.binance.org name="bsc-mainnet"Set up a Brownie account:
brownie accounts new deployerDeploy to BSC testnet:
brownie run scripts/deploy.py --network bsc-testnetDeploy to BSC mainnet:
brownie run scripts/deploy.py --network bsc-mainnetexport CONTRACT_ADDRESS=<deployed_contract_address>
export USER_ADDRESS=<wallet_address>
brownie run scripts/interact.py --network bsc-mainnetPublish the contract source to BSCScan after deployment:
export CONTRACT_ADDRESS=<deployed_contract_address>
brownie run scripts/verifySmartContract.py --network bsc-mainnet- Token supply is 100,000,000,000 with 18 decimal places.
setStakeRateandchangeLastStakeare owner-only operations.- The
WEB3_INFURA_PROJECT_IDenvironment variable is required when using Infura-hosted Ethereum networks in the network config.
This code has not been audited. Do not deploy with real funds without a thorough review of the contract logic.
MIT