PepeBand Smart Contract Code
Contract 0xBfc5F0222B33FD8FcEb3509F2459Cbd554Aa67C1
Certainly, a detailed explanation of the code for the "PepeBandToken" smart contract:
Token Metadata and Constants
name
,symbol
, anddecimals
variables specify the name, symbol, and number of decimal places for the token.totalSupply
is the total supply of tokens, set to 900 billion with 9 decimal places.owner
is the address of the contract owner.marketingWallet
is the address where marketing fees will be sent.deadWallet
is a constant address where tokens will be sent for burning.
Data Structures
balanceOf
is a mapping that stores the token balances of all addresses.allowance
is a mapping that tracks approved allowances for token transfers.isExcludedFromFees
is a mapping that determines which addresses are excluded from fees.isExcludedFromTransferLimit
is a mapping that excludes specific addresses from transfer limits.isExcludedFromBalanceLimit
is a mapping that excludes specific addresses from balance limits.
Fee and Limit Parameters
marketingFee
is the percentage fee for marketing.burnFee
is the percentage fee for burning tokens.maxTransactionAmount
sets the maximum amount of tokens that can be transferred in a single transaction (2% of total supply).maxBalancePerAddress
sets the maximum token balance allowed for an address (2% of total supply).
Events
Several events are defined to log important contract actions, such as transfers, approvals, ownership transfers, and fee updates.
Constructor
The constructor initializes the contract, setting the owner, distributing the total supply to the owner, and excluding certain addresses from fees.
Modifier
onlyOwner
is a modifier that restricts certain functions to be callable only by the owner.
Owner Management
transferOwnership
: Allows the current owner to transfer ownership to a new address.
Fee Management
setMarketingFee
: Allows the owner to set the marketing fee percentage.setBurnFee
: Allows the owner to set the burn fee percentage.setMaxTransactionAmount
: Allows the owner to set the maximum transaction amount.setMaxBalancePerAddress
: Allows the owner to set the maximum balance per address.excludeFromFees
: Allows the owner to exclude or include specific addresses from fees.
Token Transfer Functions
transfer
: Allows users to transfer tokens to another address.approve
: Allows users to approve another address to spend tokens on their behalf.transferFrom
: Allows the approved spender to transfer tokens on behalf of the owner.
Internal Transfer Function (_transfer
)
_transfer
)_transfer
handles the core logic of transferring tokens, including fee calculations and balance checks.It checks if the sender is excluded from transfer limits, calculates fees, and checks the recipient's balance.
Fee Handling (_handleFees
)
_handleFees
)_handleFees
handles the deduction of marketing fees and burning tokens.It transfers marketing fees to the marketing wallet and burns tokens by reducing the total supply.
Ownership Renouncement
renounceOwnership
: Allows the owner to renounce ownership, making the contract ownerless.
This contract implements various features, including transfer restrictions, fee management, and ownership control, to create a customized token with specific rules for fees, limits, and exclusions.
Last updated