Address Contract Partially Verified
Address
0x5116F19f6E10CB1B30b173775F29CedC2ea260f7
Balance
0 ETH
Nonce
1
Code Size
6506 bytes
Creator
0xa4aFAC36...61bd at tx 0xb2b983c9...77230f
Indexed Transactions
0
Contract Bytecode
6506 bytes
0x608060405234801561000f575f80fd5b50600436106101dc575f3560e01c8063715018a611610109578063a2240e191161009e578063d34628cc1161006e578063d34628cc1461042a578063dd62ed3e1461043d578063f25f4b5614610475578063f2fde38b14610488575f80fd5b8063a2240e19146103dd578063a3e66ddc146103f0578063a9059cbb14610404578063b550533514610417575f80fd5b80638ef33871116100d95780638ef33871146103b05780638f3fa860146103c357806395d89b41146103cc578063a071dcf4146103d4575f80fd5b8063715018a614610367578063867a1dc21461036f5780638c0b5e22146103825780638da5cb5b1461038b575f80fd5b8063313ce5671161017f578063667185241161014f57806366718524146103115780636c3bbfd7146103245780636c6259c01461033757806370a082311461033f575f80fd5b8063313ce567146102815780633bbac579146102905780635342acb4146102bb5780635cce86cd146102e6575f80fd5b806319d5be3f116101ba57806319d5be3f146102335780631a616ee514610248578063232898b41461025b57806323b872dd1461026e575f80fd5b806306fdde03146101e0578063095ea7b3146101fe57806318160ddd14610221575b5f80fd5b6101e861049b565b6040516101f591906115ee565b60405180910390f35b61021161020c366004611654565b61052b565b60405190151581526020016101f5565b6002545b6040519081526020016101f5565b61024661024136600461167c565b610544565b005b6102466102563660046116a2565b6105a4565b6102466102693660046116a2565b6106aa565b61021161027c366004611711565b6107a8565b604051601281526020016101f5565b61021161029e36600461174a565b6001600160a01b03165f908152600a602052604090205460ff1690565b6102116102c936600461174a565b6001600160a01b03165f908152600b602052604090205460ff1690565b6102116102f436600461174a565b6001600160a01b03165f908152600c602052604090205460ff1690565b61024661031f36600461174a565b6107cb565b6102466103323660046116a2565b610917565b610225601e81565b61022561034d36600461174a565b6001600160a01b03165f9081526020819052604090205490565b610246610a4f565b61024661037d3660046116a2565b610a62565b61022560075481565b6005546001600160a01b03165b6040516001600160a01b0390911681526020016101f5565b6102466103be3660046116a2565b610b59565b61022560085481565b6101e8610c57565b61022560065481565b6102466103eb366004611763565b610c66565b60095461021190600160a01b900460ff1681565b610211610412366004611654565b610d01565b610246610425366004611783565b610d0e565b6102466104383660046116a2565b610d90565b61022561044b36600461179a565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b600954610398906001600160a01b031681565b61024661049636600461174a565b610ec3565b6060600380546104aa906117cb565b80601f01602080910402602001604051908101604052809291908181526020018280546104d6906117cb565b80156105215780601f106104f857610100808354040283529160200191610521565b820191905f5260205f20905b81548152906001019060200180831161050457829003601f168201915b5050505050905090565b5f33610538818585610f00565b60019150505b92915050565b61054c610f12565b60098054821515600160a01b0260ff60a01b199091161790556040517fb7bd433966d1a12a6c3688047b5bbcb8e2435fc229afe12f7b111e7c994c92439061059990831515815260200190565b60405180910390a150565b6105ac610f12565b80806105d35760405162461bcd60e51b81526004016105ca90611803565b60405180910390fd5b601e8111156105f45760405162461bcd60e51b81526004016105ca9061182e565b5f5b818110156106a4575f8484838181106106115761061161185a565b9050602002016020810190610626919061174a565b6001600160a01b0381165f908152600b602052604090205490915060ff161561069b576001600160a01b0381165f818152600b60209081526040808320805460ff19169055519182527f318c131114339c004fff0a22fcdbbc0566bb2a7cd3aa1660e636ec5a66784ff2910160405180910390a25b506001016105f6565b50505050565b6106b2610f12565b80806106d05760405162461bcd60e51b81526004016105ca90611803565b601e8111156106f15760405162461bcd60e51b81526004016105ca9061182e565b5f5b818110156106a4575f84848381811061070e5761070e61185a565b9050602002016020810190610723919061174a565b6001600160a01b0381165f908152600c602052604090205490915060ff1661079f576001600160a01b0381165f818152600c6020908152604091829020805460ff1916600190811790915591519182527fca5110fa8124e5b4dfaf023291185d46c42971706526a6d3d3c7be7a3322772f910160405180910390a25b506001016106f3565b5f336107b5858285610f3f565b6107c0858585610fb5565b506001949350505050565b6107d3610f12565b6001600160a01b0381166108205760405162461bcd60e51b81526020600482015260146024820152731414d38e881e995c9bc8199959481dd85b1b195d60621b60448201526064016105ca565b600980546001600160a01b0319166001600160a01b0383169081179091555f818152600c60209081526040808320805460ff199081166001908117909255600b84529382902080549094168117909355519182527fca5110fa8124e5b4dfaf023291185d46c42971706526a6d3d3c7be7a3322772f910160405180910390a2604051600181526001600160a01b038216907f318c131114339c004fff0a22fcdbbc0566bb2a7cd3aa1660e636ec5a66784ff29060200160405180910390a26040516001600160a01b03821681527f29acee77dafcfa0143d74a7ea236018f3a6e1fa71e27fc59bbfbc6b8ca8edccd90602001610599565b61091f610f12565b808061093d5760405162461bcd60e51b81526004016105ca90611803565b601e81111561095e5760405162461bcd60e51b81526004016105ca9061182e565b5f5b81811015610a0e575f84848381811061097b5761097b61185a565b9050602002016020810190610990919061174a565b6001600160a01b0381165f908152600a602052604090205490915060ff1615610a05576001600160a01b0381165f818152600a60209081526040808320805460ff19169055519182527f1c6168ae13717a8cda4e1c9276a36c39333240268ba173a5a844201a8f4baa99910160405180910390a25b50600101610960565b507f3976e895d2525bdd65c472e0815120a29a7f8b106b09a0d17628f44b13e6702083835f604051610a429392919061186e565b60405180910390a1505050565b610a57610f12565b610a605f611012565b565b610a6a610f12565b8080610a885760405162461bcd60e51b81526004016105ca90611803565b601e811115610aa95760405162461bcd60e51b81526004016105ca9061182e565b5f5b818110156106a4575f848483818110610ac657610ac661185a565b9050602002016020810190610adb919061174a565b6001600160a01b0381165f908152600c602052604090205490915060ff1615610b50576001600160a01b0381165f818152600c60209081526040808320805460ff19169055519182527fca5110fa8124e5b4dfaf023291185d46c42971706526a6d3d3c7be7a3322772f910160405180910390a25b50600101610aab565b610b61610f12565b8080610b7f5760405162461bcd60e51b81526004016105ca90611803565b601e811115610ba05760405162461bcd60e51b81526004016105ca9061182e565b5f5b818110156106a4575f848483818110610bbd57610bbd61185a565b9050602002016020810190610bd2919061174a565b6001600160a01b0381165f908152600b602052604090205490915060ff16610c4e576001600160a01b0381165f818152600b6020908152604091829020805460ff1916600190811790915591519182527f318c131114339c004fff0a22fcdbbc0566bb2a7cd3aa1660e636ec5a66784ff2910160405180910390a25b50600101610ba2565b6060600480546104aa906117cb565b610c6e610f12565b5f82118015610c7c57505f81115b610cba5760405162461bcd60e51b815260206004820152600f60248201526e1414d38e881e995c9bc81b1a5b5a5d608a1b60448201526064016105ca565b6007829055600881905560408051838152602081018390527f4d4981437d0211f9e6843eb024d9ada1fa3a99514d4343d4aece106dd11524bb910160405180910390a15050565b5f33610538818585610fb5565b610d16610f12565b6050811115610d5b5760405162461bcd60e51b81526020600482015260116024820152700a0a69c7440e8c2f040e8dede40d0d2ced607b1b60448201526064016105ca565b60068190556040518181527faa4b71ac29531fdea0ef1650c76ef91e3771dac25f4a4dd2a561ff3e0b9a5de290602001610599565b610d98610f12565b8080610db65760405162461bcd60e51b81526004016105ca90611803565b601e811115610dd75760405162461bcd60e51b81526004016105ca9061182e565b5f5b81811015610e8e575f848483818110610df457610df461185a565b9050602002016020810190610e09919061174a565b6001600160a01b0381165f908152600a602052604090205490915060ff16610e85576001600160a01b0381165f818152600a6020908152604091829020805460ff1916600190811790915591519182527f1c6168ae13717a8cda4e1c9276a36c39333240268ba173a5a844201a8f4baa99910160405180910390a25b50600101610dd9565b507f3976e895d2525bdd65c472e0815120a29a7f8b106b09a0d17628f44b13e6702083836001604051610a429392919061186e565b610ecb610f12565b6001600160a01b038116610ef457604051631e4fbdf760e01b81525f60048201526024016105ca565b610efd81611012565b50565b610f0d8383836001611063565b505050565b6005546001600160a01b03163314610a605760405163118cdaa760e01b81523360048201526024016105ca565b6001600160a01b038381165f908152600160209081526040808320938616835292905220545f198110156106a45781811015610fa757604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064016105ca565b6106a484848484035f611063565b6001600160a01b038316610fde57604051634b637e8f60e11b81525f60048201526024016105ca565b6001600160a01b0382166110075760405163ec442f0560e01b81525f60048201526024016105ca565b610f0d838383611135565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6001600160a01b03841661108c5760405163e602df0560e01b81525f60048201526024016105ca565b6001600160a01b0383166110b557604051634a1406b160e11b81525f60048201526024016105ca565b6001600160a01b038085165f90815260016020908152604080832093871683529290522082905580156106a457826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161112791815260200190565b60405180910390a350505050565b6001600160a01b03831661114e57610f0d8383836114c8565b6001600160a01b0383165f908152600a602052604090205460ff1615801561118e57506001600160a01b0382165f908152600a602052604090205460ff16155b6111c55760405162461bcd60e51b81526020600482015260086024820152671414d38e88189bdd60c21b60448201526064016105ca565b6001600160a01b038084165f908152600c602052604080822054928516825290205460095460ff9283169291821691600160a01b90910416156112f4576001600160a01b0385165f908152600d602052604090205443116112605760405162461bcd60e51b815260206004820152601560248201527450534e3a206f6e652074782070657220626c6f636b60581b60448201526064016105ca565b6001600160a01b0384165f908152600e602052604090205443116112c65760405162461bcd60e51b815260206004820152601a60248201527f50534e3a206f6e6520726563656976652070657220626c6f636b00000000000060448201526064016105ca565b6001600160a01b038086165f908152600d6020908152604080832043908190559388168352600e9091529020555b836001600160a01b0316856001600160a01b03160361131f576113188585856114c8565b5050505050565b6001600160a01b0385165f908152600b6020526040812054849060ff1615801561136157506001600160a01b0386165f908152600b602052604090205460ff16155b801561136e57505f600654115b1561139c5760646006548661138391906118d8565b61138d91906118ef565b9150611399828661190e565b90505b6005546001600160a01b038881169116148015906113c857506005546001600160a01b03878116911614155b15611496578361141c5760075485111561141c5760405162461bcd60e51b81526020600482015260156024820152741414d38e881d1e08195e18d959591cc81b1a5b5a5d605a1b60448201526064016105ca565b82611496576001600160a01b0386165f908152602081905260409020546008546114468383611921565b11156114945760405162461bcd60e51b815260206004820152601960248201527f50534e3a2077616c6c65742065786365656473206c696d69740000000000000060448201526064016105ca565b505b81156114b4576009546114b49088906001600160a01b0316846114c8565b6114bf8787836114c8565b50505050505050565b6001600160a01b0383166114f2578060025f8282546114e79190611921565b909155506115629050565b6001600160a01b0383165f90815260208190526040902054818110156115445760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016105ca565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b03821661157e5760028054829003905561159c565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516115e191815260200190565b60405180910390a3505050565b5f6020808352835180828501525f5b81811015611619578581018301518582016040015282016115fd565b505f604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461164f575f80fd5b919050565b5f8060408385031215611665575f80fd5b61166e83611639565b946020939093013593505050565b5f6020828403121561168c575f80fd5b8135801515811461169b575f80fd5b9392505050565b5f80602083850312156116b3575f80fd5b823567ffffffffffffffff808211156116ca575f80fd5b818501915085601f8301126116dd575f80fd5b8135818111156116eb575f80fd5b8660208260051b85010111156116ff575f80fd5b60209290920196919550909350505050565b5f805f60608486031215611723575f80fd5b61172c84611639565b925061173a60208501611639565b9150604084013590509250925092565b5f6020828403121561175a575f80fd5b61169b82611639565b5f8060408385031215611774575f80fd5b50508035926020909101359150565b5f60208284031215611793575f80fd5b5035919050565b5f80604083850312156117ab575f80fd5b6117b483611639565b91506117c260208401611639565b90509250929050565b600181811c908216806117df57607f821691505b6020821081036117fd57634e487b7160e01b5f52602260045260245ffd5b50919050565b60208082526011908201527050534e3a206e6f2061646472657373657360781b604082015260600190565b60208082526012908201527150534e3a20626174636820746f6f2062696760701b604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b604080825281018390525f8460608301825b868110156118ae576001600160a01b0361189984611639565b16825260209283019290910190600101611880565b5080925050508215156020830152949350505050565b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761053e5761053e6118c4565b5f8261190957634e487b7160e01b5f52601260045260245ffd5b500490565b8181038181111561053e5761053e6118c4565b8082018082111561053e5761053e6118c456fea2646970667358221220bccefa2383c07247eeecea8c803549857afb98d8314a4eed79c43ab3c6aecc8164736f6c63430008140033
Verified Source Code Partial Match
Compiler: v0.8.20+commit.a1b79de6
EVM: shanghai
Optimization: Yes (200 runs)
PSN.sol 1012 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)
/**
* @dev Interface for the optional metadata functions from the ERC-20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)
/**
* @dev Standard ERC-20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC-721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC-1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/ERC20.sol)
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC-20
* applications.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* Both values are immutable: they can only be set once during construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Skips emitting an {Approval} event indicating an allowance update. This is not
* required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner`'s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
*
* ```solidity
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner`'s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance < type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
/**
* @title PSN
*/
contract PSN is ERC20, Ownable {
// Constants
uint8 private constant DECIMALS = 18;
uint256 private constant INITIAL_SUPPLY = 8_205_771_000 * 10**18;
uint256 private constant MAX_TAX = 80;
uint256 public constant MAX_ARRAY_BATCH = 30;
// State variables
uint256 public taxFee;
uint256 public maxTxAmount;
uint256 public maxWalletSize;
address public feeWallet;
bool public isPerBlockDelayEnabled;
// Mappings
mapping(address => bool) private _isBot;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private _isExcludedFromLimits;
mapping(address => uint256) private _lastTransferBlock;
mapping(address => uint256) private _lastReceiveBlock;
// Public getters for private mappings
/**
* @notice Returns true if the address is blacklisted as a bot.
* @param account The address to check.
* @return True if the address is a bot, false otherwise.
*/
function isBot(address account) public view returns (bool) {
return _isBot[account];
}
/**
* @notice Returns true if the address is excluded from tax fees.
* @param account The address to check.
* @return True if the address is excluded from fees, false otherwise.
*/
function isExcludedFromFee(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
/**
* @notice Returns true if the address is excluded from transaction and wallet limits.
* @param account The address to check.
* @return True if the address is excluded from limits, false otherwise.
*/
function isExcludedFromLimits(address account) public view returns (bool) {
return _isExcludedFromLimits[account];
}
// Events
event TaxFeeUpdated(uint256 taxFee);
event LimitsUpdated(uint256 maxTxAmount, uint256 maxWalletSize);
event FeeWalletUpdated(address newFeeWallet);
event PerBlockDelayToggled(bool enabled);
event BotUpdated(address indexed bot, bool isBlacklisted);
event ExcludedFromFeeUpdated(address indexed account, bool isExcluded);
event ExcludedFromLimitsUpdated(address indexed account, bool isExcluded);
event BotsBatchUpdated(address[] bots, bool enabled);
/**
* @dev Initializes the PSN token with the given owner and fee wallet.
* @param initialOwner The address that will be assigned as the contract owner and receive the initial supply.
* @param _feeWallet The address that will receive collected tax fees and be excluded from fees and limits by default.
*/
constructor(
address initialOwner,
address _feeWallet
) ERC20("PSN", "PSN") Ownable(initialOwner) {
require(_feeWallet != address(0), "PSN: zero fee wallet");
taxFee = 3;
maxTxAmount = INITIAL_SUPPLY / 100;
maxWalletSize = INITIAL_SUPPLY / 50;
feeWallet = _feeWallet;
isPerBlockDelayEnabled = true;
_mint(initialOwner, INITIAL_SUPPLY);
// Exclude after mint for warm SSTORE
_isExcludedFromLimits[address(this)] = true;
_isExcludedFromLimits[initialOwner] = true;
_isExcludedFromLimits[_feeWallet] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[initialOwner] = true;
_isExcludedFromFee[_feeWallet] = true;
}
/**
* @dev Returns the number of decimals used to get its user representation
*/
function decimals() public view virtual override returns (uint8) {
return DECIMALS;
}
/**
* @dev Updates tax fee
* @param _taxFee New tax fee rate (0-MAX_TAX)
*/
function updateTaxFee(uint256 _taxFee) external onlyOwner {
require(_taxFee <= MAX_TAX, "PSN: tax too high");
taxFee = _taxFee;
emit TaxFeeUpdated(_taxFee);
}
/**
* @dev Updates transaction and wallet limits
* @param _maxTxAmount New maximum transaction amount
* @param _maxWalletSize New maximum wallet size
*/
function updateLimits(uint256 _maxTxAmount, uint256 _maxWalletSize) external onlyOwner {
require(_maxTxAmount > 0 && _maxWalletSize > 0, "PSN: zero limit");
maxTxAmount = _maxTxAmount;
maxWalletSize = _maxWalletSize;
emit LimitsUpdated(_maxTxAmount, _maxWalletSize);
}
/**
* @dev Updates the fee wallet address
* @param _feeWallet New fee wallet address
*/
function updateFeeWallet(address _feeWallet) external onlyOwner {
require(_feeWallet != address(0), "PSN: zero fee wallet");
feeWallet = _feeWallet;
_isExcludedFromLimits[_feeWallet] = true;
_isExcludedFromFee[_feeWallet] = true;
emit ExcludedFromLimitsUpdated(_feeWallet, true);
emit ExcludedFromFeeUpdated(_feeWallet, true);
emit FeeWalletUpdated(_feeWallet);
}
/**
* @dev Toggles the per-block transfer delay feature
* @param enabled Whether to enable or disable the feature
*/
function togglePerBlockDelay(bool enabled) external onlyOwner {
isPerBlockDelayEnabled = enabled;
emit PerBlockDelayToggled(enabled);
}
/**
* @dev Adds addresses to the bot blacklist
* @param _bots Array of addresses to blacklist
*/
function addBots(address[] calldata _bots) external onlyOwner {
uint256 length = _bots.length;
require(length > 0, "PSN: no addresses");
require(length <= MAX_ARRAY_BATCH, "PSN: batch too big");
for (uint256 i; i < length;) {
address bot = _bots[i];
if (!_isBot[bot]) {
_isBot[bot] = true;
emit BotUpdated(bot, true);
}
unchecked { ++i; }
}
emit BotsBatchUpdated(_bots, true);
}
/**
* @dev Removes addresses from the bot blacklist
* @param _bots Array of addresses to remove from blacklist
*/
function removeBots(address[] calldata _bots) external onlyOwner {
uint256 length = _bots.length;
require(length > 0, "PSN: no addresses");
require(length <= MAX_ARRAY_BATCH, "PSN: batch too big");
for (uint256 i; i < length;) {
address bot = _bots[i];
if (_isBot[bot]) {
_isBot[bot] = false;
emit BotUpdated(bot, false);
}
unchecked { ++i; }
}
emit BotsBatchUpdated(_bots, false);
}
/**
* @dev Adds addresses to the limits exclusion list
* @param accounts Array of addresses to exclude from limits
*/
function addExcludedFromLimits(address[] calldata accounts) external onlyOwner {
uint256 len = accounts.length;
require(len > 0, "PSN: no addresses");
require(len <= MAX_ARRAY_BATCH, "PSN: batch too big");
for (uint256 i; i < len;) {
address a = accounts[i];
if (!_isExcludedFromLimits[a]) {
_isExcludedFromLimits[a] = true;
emit ExcludedFromLimitsUpdated(a, true);
}
unchecked { ++i; }
}
}
/**
* @dev Removes addresses from the limits exclusion list
* @param accounts Array of addresses to remove from exclusion
*/
function removeExcludedFromLimits(address[] calldata accounts) external onlyOwner {
uint256 len = accounts.length;
require(len > 0, "PSN: no addresses");
require(len <= MAX_ARRAY_BATCH, "PSN: batch too big");
for (uint256 i; i < len;) {
address a = accounts[i];
if (_isExcludedFromLimits[a]) {
_isExcludedFromLimits[a] = false;
emit ExcludedFromLimitsUpdated(a, false);
}
unchecked { ++i; }
}
}
/**
* @dev Adds addresses to the fee exclusion list
* @param accounts Array of addresses to exclude from fee
*/
function addExcludedFromFee(address[] calldata accounts) external onlyOwner {
uint256 len = accounts.length;
require(len > 0, "PSN: no addresses");
require(len <= MAX_ARRAY_BATCH, "PSN: batch too big");
for (uint256 i; i < len;) {
address a = accounts[i];
if (!_isExcludedFromFee[a]) {
_isExcludedFromFee[a] = true;
emit ExcludedFromFeeUpdated(a, true);
}
unchecked { ++i; }
}
}
/**
* @dev Removes addresses from the fee exclusion list
* @param accounts Array of addresses to remove from exclusion
*/
function removeExcludedFromFee(address[] calldata accounts) external onlyOwner {
uint256 len = accounts.length;
require(len > 0, "PSN: no addresses");
require(len <= MAX_ARRAY_BATCH, "PSN: batch too big");
for (uint256 i; i < len;) {
address a = accounts[i];
if (_isExcludedFromFee[a]) {
_isExcludedFromFee[a] = false;
emit ExcludedFromFeeUpdated(a, false);
}
unchecked { ++i; }
}
}
/**
* @dev Override _update function to include tax and limit checks
* @param from Sender address
* @param to Recipient address
* @param amount Amount to transfer
*/
function _update(
address from,
address to,
uint256 amount
) internal virtual override {
// Skip all checks for minting
if (from == address(0)) {
super._update(from, to, amount);
return;
}
// Check for bots first to save gas on reverts
require(!_isBot[from] && !_isBot[to], "PSN: bot");
// Cache excluded status to save SLOADs
bool fromExcluded = _isExcludedFromLimits[from];
bool toExcluded = _isExcludedFromLimits[to];
// Per-block transfer delay check (only if enabled)
if (isPerBlockDelayEnabled) {
require(
_lastTransferBlock[from] < block.number,
"PSN: one tx per block"
);
require(
_lastReceiveBlock[to] < block.number,
"PSN: one receive per block"
);
_lastTransferBlock[from] = block.number;
_lastReceiveBlock[to] = block.number;
}
// Short-circuit self-transfers after per-block checks
if (from == to) {
super._update(from, to, amount);
return;
}
// Apply tax fee unless sender or receiver is excluded
uint256 taxAmount = 0;
uint256 transferAmount = amount;
if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to] && taxFee > 0) {
taxAmount = amount * taxFee / 100;
transferAmount = amount - taxAmount;
}
// Short-circuit for owner transfers
if (from != owner() && to != owner()) {
// Check maxTxAmount for non-excluded senders
if (!fromExcluded) {
require(amount <= maxTxAmount, "PSN: tx exceeds limit");
}
// Check maxWalletSize for non-excluded receivers
if (!toExcluded) {
// Cache balanceOf(to) to save an SLOAD
uint256 toBalance = balanceOf(to);
require(toBalance + transferAmount <= maxWalletSize, "PSN: wallet exceeds limit");
}
}
if (taxAmount > 0) {
super._update(from, feeWallet, taxAmount);
}
super._update(from, to, transferAmount);
}
}
Read Contract
MAX_ARRAY_BATCH 0x6c6259c0 → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
feeWallet 0xf25f4b56 → address
isBot 0x3bbac579 → bool
isExcludedFromFee 0x5342acb4 → bool
isExcludedFromLimits 0x5cce86cd → bool
isPerBlockDelayEnabled 0xa3e66ddc → bool
maxTxAmount 0x8c0b5e22 → uint256
maxWalletSize 0x8f3fa860 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
symbol 0x95d89b41 → string
taxFee 0xa071dcf4 → uint256
totalSupply 0x18160ddd → uint256
Write Contract 15 functions
These functions modify contract state and require a wallet transaction to execute.
addBots 0xd34628cc
address[] _bots
addExcludedFromFee 0x8ef33871
address[] accounts
addExcludedFromLimits 0x232898b4
address[] accounts
approve 0x095ea7b3
address spender
uint256 value
returns: bool
removeBots 0x6c3bbfd7
address[] _bots
removeExcludedFromFee 0x1a616ee5
address[] accounts
removeExcludedFromLimits 0x867a1dc2
address[] accounts
renounceOwnership 0x715018a6
No parameters
togglePerBlockDelay 0x19d5be3f
bool enabled
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
transferOwnership 0xf2fde38b
address newOwner
updateFeeWallet 0x66718524
address _feeWallet
updateLimits 0xa2240e19
uint256 _maxTxAmount
uint256 _maxWalletSize
updateTaxFee 0xb5505335
uint256 _taxFee
Recent Transactions
No transactions found for this address