The PYRToken
contract is an ERC20 token implementation that includes features for ownership management and a blacklist mechanism. It allows the owner to mint tokens, approve spenders, and manage allowances while ensuring that transactions are secure by checking against a blacklist. The contract also provides standard ERC20 functionalities such as transferring tokens and querying balances.
Token Management:
constructor
: Initializes the contract by setting the deployer as the owner, validating the blacklist address, minting tokens to the owner, and transferring ownership. Emits Transfer
and OwnershipTransferred
events.transfer
: Facilitates the transfer of tokens from the caller to a recipient, ensuring the recipient is not a zero address and that the caller has sufficient balance. Emits a Transfer
event.transferFrom
: Allows a spender to transfer tokens from a specified sender to a recipient, checking for sufficient allowance and balances. Emits Transfer
and Approval
events.approve
: Grants a specified amount of tokens to a spender, allowing them to transfer tokens on behalf of the owner. Emits an Approval
event.increaseAllowance
& decreaseAllowance
: Adjust the allowance granted to a spender, ensuring that the new allowance does not fall below zero. Both emit Approval
events.Ownership Management:
transferOwnership
: Transfers ownership of the contract to a new address, ensuring the caller is the current owner and the new address is not zero. Emits an OwnershipTransferred
event.renounceOwnership
: Allows the current owner to relinquish ownership, setting the owner to the zero address and emitting an OwnershipTransferred
event.