zellic-audit
Initial commit
f998fcd
raw
history blame
45.8 kB
{
"language": "Solidity",
"sources": {
"contracts/FullFeatureToken.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity 0.8.7;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol\";\nimport { Helpers } from \"./lib/Helpers.sol\";\n\ncontract FullFeatureToken is ERC20, ERC20Burnable, ERC20Pausable, Ownable {\n /// @notice mapping of blacklisted addresses to a boolean\n mapping(address => bool) private _isBlacklisted;\n /// @notice mapping of whitelisted addresses to a boolean\n mapping(address => bool) public whitelist;\n /// @notice array holding all whitelisted addresses\n address[] public whitelistedAddresses;\n /// @notice support for attaching of documentation for security tokens\n string public initialDocumentUri;\n /// @notice the security token documentation\n string public documentUri;\n /// @notice initial number of tokens which will be minted during initialization\n uint256 public immutable initialSupply;\n /// @notice initial max amount of tokens allowed per wallet\n uint256 public immutable initialMaxTokenAmountPerAddress;\n /// @notice max amount of tokens allowed per wallet\n uint256 public maxTokenAmountPerAddress;\n /// @notice set of features supported by the token\n struct ERC20ConfigProps {\n bool _isMintable;\n bool _isBurnable;\n bool _isPausable;\n bool _isBlacklistEnabled;\n bool _isDocumentAllowed;\n bool _isWhitelistEnabled;\n bool _isMaxAmountOfTokensSet;\n bool _isForceTransferAllowed;\n }\n /// @notice features of the token\n ERC20ConfigProps private configProps;\n /// @notice owner of the contract\n address public immutable initialTokenOwner;\n /// @notice number of decimals of the token\n uint8 private immutable _decimals;\n\n /// @notice emitted when an address is blacklisted\n event UserBlacklisted(address indexed addr);\n /// @notice emitted when an address is unblacklisted\n event UserUnBlacklisted(address indexed addr);\n /// @notice emitted when a new document is set for the security token\n event DocumentUriSet(string newDocUri);\n /// @notice emitted when a new max amount of tokens per wallet is set\n event MaxTokenAmountPerSet(uint256 newMaxTokenAmount);\n /// @notice emitted when a new whitelist is set\n event UsersWhitelisted(address[] updatedAddresses);\n\n /// @notice raised when the amount sent is zero\n error InvalidMaxTokenAmount(uint256 maxTokenAmount);\n /// @notice raised when the decimals are not in the range 0 - 18\n error InvalidDecimals(uint8 decimals);\n /// @notice raised when setting maxTokenAmount less than current\n error MaxTokenAmountPerAddrLtPrevious();\n /// @notice raised when blacklisting is not enabled\n error BlacklistNotEnabled();\n /// @notice raised when the address is already blacklisted\n error AddrAlreadyBlacklisted(address addr);\n /// @notice raised when the address is already unblacklisted\n error AddrAlreadyUnblacklisted(address addr);\n /// @notice raised when attempting to blacklist a whitelisted address\n error CannotBlacklistWhitelistedAddr(address addr);\n /// @notice raised when a recipient address is blacklisted\n error RecipientBlacklisted(address addr);\n /// @notice raised when a sender address is blacklisted\n error SenderBlacklisted(address addr);\n /// @notice raised when a recipient address is not whitelisted\n error RecipientNotWhitelisted(address addr);\n /// @notice raised when a sender address is not whitelisted\n error SenderNotWhitelisted(address addr);\n /// @notice raised when recipient balance exceeds maxTokenAmountPerAddress\n error DestBalanceExceedsMaxAllowed(address addr);\n /// @notice raised minting is not enabled\n error MintingNotEnabled();\n /// @notice raised when burning is not enabled\n error BurningNotEnabled();\n /// @notice raised when pause is not enabled\n error PausingNotEnabled();\n /// @notice raised when whitelist is not enabled\n error WhitelistNotEnabled();\n /// @notice raised when attempting to whitelist a blacklisted address\n error CannotWhitelistBlacklistedAddr(address addr);\n /// @notice raised when trying to set a document URI when not allowed\n error DocumentUriNotAllowed();\n\n /**\n * @notice modifier for validating if transfer is possible and valid\n * @param sender the sender of the transaction\n * @param recipient the recipient of the transaction\n */\n modifier validateTransfer(address sender, address recipient) {\n if (isWhitelistEnabled()) {\n if (!whitelist[sender]) {\n revert SenderNotWhitelisted(sender);\n }\n if (!whitelist[recipient]) {\n revert RecipientNotWhitelisted(recipient);\n }\n }\n if (isBlacklistEnabled()) {\n if (_isBlacklisted[sender]) {\n revert SenderBlacklisted(sender);\n }\n if (_isBlacklisted[recipient]) {\n revert RecipientBlacklisted(recipient);\n }\n }\n _;\n }\n\n constructor(\n string memory name_,\n string memory symbol_,\n uint256 initialSupplyToSet,\n uint8 decimalsToSet,\n address tokenOwner,\n ERC20ConfigProps memory customConfigProps,\n uint256 maxTokenAmount,\n string memory newDocumentUri\n ) ERC20(name_, symbol_) {\n if (customConfigProps._isMaxAmountOfTokensSet) {\n if (maxTokenAmount == 0) {\n revert InvalidMaxTokenAmount(maxTokenAmount);\n }\n }\n if (decimalsToSet > 18) {\n revert InvalidDecimals(decimalsToSet);\n }\n Helpers.validateAddress(tokenOwner);\n\n initialSupply = initialSupplyToSet;\n initialMaxTokenAmountPerAddress = maxTokenAmount;\n initialDocumentUri = newDocumentUri;\n initialTokenOwner = tokenOwner;\n _decimals = decimalsToSet;\n configProps = customConfigProps;\n documentUri = newDocumentUri;\n maxTokenAmountPerAddress = maxTokenAmount;\n\n if (initialSupplyToSet != 0) {\n _mint(tokenOwner, initialSupplyToSet * 10**decimalsToSet);\n }\n\n if (tokenOwner != msg.sender) {\n transferOwnership(tokenOwner);\n }\n }\n\n /**\n * @notice hook called before any transfer of tokens. This includes minting and burning\n * imposed by the ERC20 standard\n * @param from - address of the sender\n * @param to - address of the recipient\n * @param amount - amount of tokens to transfer\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override(ERC20, ERC20Pausable) {\n super._beforeTokenTransfer(from, to, amount);\n }\n\n /// @notice method which checks if the token is pausable\n function isPausable() public view returns (bool) {\n return configProps._isPausable;\n }\n\n /// @notice method which checks if the token is mintable\n function isMintable() public view returns (bool) {\n return configProps._isMintable;\n }\n\n /// @notice method which checks if the token is burnable\n function isBurnable() public view returns (bool) {\n return configProps._isBurnable;\n }\n\n /// @notice method which checks if the token supports blacklisting\n function isBlacklistEnabled() public view returns (bool) {\n return configProps._isBlacklistEnabled;\n }\n\n /// @notice method which checks if the token supports whitelisting\n function isWhitelistEnabled() public view returns (bool) {\n return configProps._isWhitelistEnabled;\n }\n\n /// @notice method which checks if the token supports max amount of tokens per wallet\n function isMaxAmountOfTokensSet() public view returns (bool) {\n return configProps._isMaxAmountOfTokensSet;\n }\n\n /// @notice method which checks if the token supports documentUris\n function isDocumentUriAllowed() public view returns (bool) {\n return configProps._isDocumentAllowed;\n }\n\n /// @notice method which checks if the token supports force transfers\n function isForceTransferAllowed() public view returns (bool) {\n return configProps._isForceTransferAllowed;\n }\n\n /// @notice method which returns the number of decimals for the token\n function decimals() public view virtual override returns (uint8) {\n return _decimals;\n }\n\n /**\n * @notice which returns an array of all the whitelisted addresses\n * @return whitelistedAddresses array of all the whitelisted addresses\n */\n function getWhitelistedAddresses() external view returns (address[] memory) {\n return whitelistedAddresses;\n }\n\n /**\n * @notice method which allows the owner to set a documentUri\n * @param newDocumentUri - the new documentUri\n * @dev only callable by the owner\n */\n function setDocumentUri(string memory newDocumentUri) external onlyOwner {\n if (!isDocumentUriAllowed()) {\n revert DocumentUriNotAllowed();\n }\n documentUri = newDocumentUri;\n emit DocumentUriSet(newDocumentUri);\n }\n\n /**\n * @notice method which allows the owner to set a max amount of tokens per wallet\n * @param newMaxTokenAmount - the new max amount of tokens per wallet\n * @dev only callable by the owner\n */\n function setMaxTokenAmountPerAddress(uint256 newMaxTokenAmount)\n external\n onlyOwner\n {\n if (newMaxTokenAmount <= maxTokenAmountPerAddress) {\n revert MaxTokenAmountPerAddrLtPrevious();\n }\n\n maxTokenAmountPerAddress = newMaxTokenAmount;\n emit MaxTokenAmountPerSet(newMaxTokenAmount);\n }\n\n /**\n * @notice method which allows the owner to blacklist an address\n * @param addr - the address to blacklist\n * @dev only callable by the owner\n * @dev only callable if the token is not paused\n * @dev only callable if the token supports blacklisting\n * @dev only callable if the address is not already blacklisted\n * @dev only callable if the address is not whitelisted\n */\n function blackList(address addr) external onlyOwner whenNotPaused {\n Helpers.validateAddress(addr);\n if (!isBlacklistEnabled()) {\n revert BlacklistNotEnabled();\n }\n if (_isBlacklisted[addr]) {\n revert AddrAlreadyBlacklisted(addr);\n }\n if (isWhitelistEnabled() && whitelist[addr]) {\n revert CannotBlacklistWhitelistedAddr(addr);\n }\n\n _isBlacklisted[addr] = true;\n emit UserBlacklisted(addr);\n }\n\n /**\n * @notice method which allows the owner to unblacklist an address\n * @param addr - the address to unblacklist\n * @dev only callable by the owner\n * @dev only callable if the token is not paused\n * @dev only callable if the token supports blacklisting\n * @dev only callable if the address is blacklisted\n */\n function removeFromBlacklist(address addr) external onlyOwner whenNotPaused {\n Helpers.validateAddress(addr);\n if (!isBlacklistEnabled()) {\n revert BlacklistNotEnabled();\n }\n if (!_isBlacklisted[addr]) {\n revert AddrAlreadyUnblacklisted(addr);\n }\n\n _isBlacklisted[addr] = false;\n emit UserUnBlacklisted(addr);\n }\n\n /**\n * @notice method which allows to transfer a predefined amount of tokens to a predefined address\n * @param to - the address to transfer the tokens to\n * @param amount - the amount of tokens to transfer\n * @return true if the transfer was successful\n * @dev only callable if the token is not paused\n * @dev only callable if the balance of the receiver is lower than the max amount of tokens per wallet\n * @dev checks if blacklisting is enabled and if the sender and receiver are not blacklisted\n * @dev checks if whitelisting is enabled and if the sender and receiver are whitelisted\n */\n function transfer(address to, uint256 amount)\n public\n virtual\n override\n whenNotPaused\n validateTransfer(msg.sender, to)\n returns (bool)\n {\n if (isMaxAmountOfTokensSet()) {\n if (balanceOf(to) + amount > maxTokenAmountPerAddress) {\n revert DestBalanceExceedsMaxAllowed(to);\n }\n }\n return super.transfer(to, amount);\n }\n\n /**\n * @notice method which allows to transfer a predefined amount of tokens from a predefined address to a predefined address\n * @param from - the address to transfer the tokens from\n * @param to - the address to transfer the tokens to\n * @param amount - the amount of tokens to transfer\n * @return true if the transfer was successful\n * @dev only callable if the token is not paused\n * @dev only callable if the balance of the receiver is lower than the max amount of tokens per wallet\n * @dev checks if blacklisting is enabled and if the sender and receiver are not blacklisted\n * @dev checks if whitelisting is enabled and if the sender and receiver are whitelisted\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n )\n public\n virtual\n override\n whenNotPaused\n validateTransfer(from, to)\n returns (bool)\n {\n if (isMaxAmountOfTokensSet()) {\n if (balanceOf(to) + amount > maxTokenAmountPerAddress) {\n revert DestBalanceExceedsMaxAllowed(to);\n }\n }\n\n if (isForceTransferAllowed() && owner() == msg.sender) {\n _transfer(from, to, amount);\n return true;\n } else {\n return super.transferFrom(from, to, amount);\n }\n }\n\n /**\n * @notice method which allows to mint a predefined amount of tokens to a predefined address\n * @param to - the address to mint the tokens to\n * @param amount - the amount of tokens to mint\n * @dev only callable by the owner\n * @dev only callable if the token is not paused\n * @dev only callable if the token supports additional minting\n * @dev only callable if the balance of the receiver is lower than the max amount of tokens per wallet\n * @dev checks if blacklisting is enabled and if the receiver is not blacklisted\n * @dev checks if whitelisting is enabled and if the receiver is whitelisted\n */\n function mint(address to, uint256 amount) external onlyOwner whenNotPaused {\n if (!isMintable()) {\n revert MintingNotEnabled();\n }\n if (isMaxAmountOfTokensSet()) {\n if (balanceOf(to) + amount > maxTokenAmountPerAddress) {\n revert DestBalanceExceedsMaxAllowed(to);\n }\n }\n if (isBlacklistEnabled()) {\n if (_isBlacklisted[to]) {\n revert RecipientBlacklisted(to);\n }\n }\n if (isWhitelistEnabled()) {\n if (!whitelist[to]) {\n revert RecipientNotWhitelisted(to);\n }\n }\n\n super._mint(to, amount);\n }\n\n /**\n * @notice method which allows to burn a predefined amount of tokens\n * @param amount - the amount of tokens to burn\n * @dev only callable by the owner\n * @dev only callable if the token is not paused\n * @dev only callable if the token supports burning\n */\n function burn(uint256 amount) public override onlyOwner whenNotPaused {\n if (!isBurnable()) {\n revert BurningNotEnabled();\n }\n super.burn(amount);\n }\n\n /**\n * @notice method which allows to burn a predefined amount of tokens from a predefined address\n * @param from - the address to burn the tokens from\n * @param amount - the amount of tokens to burn\n * @dev only callable by the owner\n * @dev only callable if the token is not paused\n * @dev only callable if the token supports burning\n */\n function burnFrom(address from, uint256 amount)\n public\n override\n onlyOwner\n whenNotPaused\n {\n if (!isBurnable()) {\n revert BurningNotEnabled();\n }\n super.burnFrom(from, amount);\n }\n\n /**\n * @notice method which allows to pause the token\n * @dev only callable by the owner\n */\n function pause() external onlyOwner {\n if (!isPausable()) {\n revert PausingNotEnabled();\n }\n _pause();\n }\n\n /**\n * @notice method which allows to unpause the token\n * @dev only callable by the owner\n */\n function unpause() external onlyOwner {\n if (!isPausable()) {\n revert PausingNotEnabled();\n }\n _unpause();\n }\n\n /**\n * @notice method which allows to removing the owner of the token\n * @dev methods which are only callable by the owner will not be callable anymore\n * @dev only callable by the owner\n * @dev only callable if the token is not paused\n */\n function renounceOwnership() public override onlyOwner whenNotPaused {\n super.renounceOwnership();\n }\n\n /**\n * @notice method which allows to transfer the ownership of the token\n * @param newOwner - the address of the new owner\n * @dev only callable by the owner\n * @dev only callable if the token is not paused\n */\n function transferOwnership(address newOwner)\n public\n override\n onlyOwner\n whenNotPaused\n {\n super.transferOwnership(newOwner);\n }\n\n /**\n * @notice method which allows to update the whitelist of the token\n * @param updatedAddresses - the new set of addresses\n * @dev only callable by the owner\n * @dev only callable if the token supports whitelisting\n */\n function updateWhitelist(address[] calldata updatedAddresses)\n external\n onlyOwner\n {\n if (!isWhitelistEnabled()) {\n revert WhitelistNotEnabled();\n }\n _clearWhitelist();\n _addManyToWhitelist(updatedAddresses);\n whitelistedAddresses = updatedAddresses;\n emit UsersWhitelisted(updatedAddresses);\n }\n\n /**\n * @notice method which allows for adding a new set of addresses to the whitelist\n * @param addresses - the addresses to add to the whitelist\n * @dev called internally by the contract\n * @dev only callable if any of the addresses are not already whitelisted\n */\n function _addManyToWhitelist(address[] calldata addresses) private {\n for (uint256 i; i < addresses.length; ) {\n Helpers.validateAddress(addresses[i]);\n if (configProps._isBlacklistEnabled && _isBlacklisted[addresses[i]]) {\n revert CannotWhitelistBlacklistedAddr(addresses[i]);\n }\n whitelist[addresses[i]] = true;\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * @notice method which allows for removing a set of addresses from the whitelist\n */\n function _clearWhitelist() private {\n unchecked {\n address[] memory addresses = whitelistedAddresses;\n for (uint256 i; i < addresses.length; i++) {\n whitelist[addresses[i]] = false;\n }\n }\n }\n}\n"
},
"contracts/lib/Helpers.sol": {
"content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity 0.8.7;\n\nlibrary Helpers {\n /// @notice raised when an address is zero\n error NonZeroAddress(address addr);\n /// @notice raised when payment fails\n error PaymentFailed(address to, uint256 amount);\n\n /**\n * @notice Helper function to check if an address is a zero address\n * @param addr - address to check\n */\n function validateAddress(address addr) internal pure {\n if (addr == address(0x0)) {\n revert NonZeroAddress(addr);\n }\n }\n\n /**\n * @notice method to pay a specific address with a specific amount\n * @dev inspired from https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol\n * @param to - the address to pay\n * @param amount - the amount to pay\n */\n function safeTransferETH(address to, uint256 amount) internal {\n bool success;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n if (!success) {\n revert PaymentFailed(to, amount);\n }\n }\n}\n"
},
"@openzeppelin/contracts/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
},
"@openzeppelin/contracts/token/ERC20/ERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n"
},
"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @dev Extension of {ERC20} that allows token holders to destroy both their own\n * tokens and those that they have an allowance for, in a way that can be\n * recognized off-chain (via event analysis).\n */\nabstract contract ERC20Burnable is Context, ERC20 {\n /**\n * @dev Destroys `amount` tokens from the caller.\n *\n * See {ERC20-_burn}.\n */\n function burn(uint256 amount) public virtual {\n _burn(_msgSender(), amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, deducting from the caller's\n * allowance.\n *\n * See {ERC20-_burn} and {ERC20-allowance}.\n *\n * Requirements:\n *\n * - the caller must have allowance for ``accounts``'s tokens of at least\n * `amount`.\n */\n function burnFrom(address account, uint256 amount) public virtual {\n _spendAllowance(account, _msgSender(), amount);\n _burn(account, amount);\n }\n}\n"
},
"@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../../../security/Pausable.sol\";\n\n/**\n * @dev ERC20 token with pausable token transfers, minting and burning.\n *\n * Useful for scenarios such as preventing trades until the end of an evaluation\n * period, or having an emergency switch for freezing all token transfers in the\n * event of a large bug.\n */\nabstract contract ERC20Pausable is ERC20, Pausable {\n /**\n * @dev See {ERC20-_beforeTokenTransfer}.\n *\n * Requirements:\n *\n * - the contract must not be paused.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, amount);\n\n require(!paused(), \"ERC20Pausable: token transfer while paused\");\n }\n}\n"
},
"@openzeppelin/contracts/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n"
},
"@openzeppelin/contracts/token/ERC20/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n"
},
"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n"
},
"@openzeppelin/contracts/security/Pausable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n constructor() {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 1337
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}