Token 10X: Africa's First Cryptocurrency Hub
TokenBank.Exchange Token
PROJECT AUDITED AND WITH KYC The Ultimate Web3 Development Platform Build complete blockchain applications leveraging every DeFi ecosystem that tokenbank offers, APIs to build and scale your dApps without the cost and complexity.
...
About TokenBank.Exchange
PROJECT AUDITED AND WITH KYC The Ultimate Web3 Development Platform Build complete blockchain applications leveraging every DeFi ecosystem that tokenbank offers, APIs to build and scale your dApps without the cost and complexity.
280 total visits
Token information and links
Circulating Supply
500000000000000000000000000
Token Contract (BSC Chain)
0X833B5CB9A2CFFB1587BBEFE53A451D0989FBA714
Contract license: MIT
Launch Date
04/02/2022
KYC Information
No
Audit Information
None
Team Information
Team leader: None
Team leader contact: None
Contract source code
{"Authorized.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.5;\r\n\r\nimport \"./Ownable.sol\";\r\nimport \"./Strings.sol\";\r\nimport \"./ERC20.sol\";\r\n\r\ncontract Authorized is Ownable {\r\n mapping(uint8 =\u003e mapping(address =\u003e bool)) public permissions;\r\n string[] public permissionIndex;\r\n\r\n constructor() {\r\n permissionIndex.push(\"admin\");\r\n permissionIndex.push(\"financial\");\r\n permissionIndex.push(\"controller\");\r\n permissionIndex.push(\"operator\");\r\n\r\n permissions[0][_msgSender()] = true;\r\n }\r\n\r\n modifier isAuthorized(uint8 index) {\r\n if (!permissions[index][_msgSender()]) {\r\n revert(string(abi.encodePacked(\"Account \",Strings.toHexString(uint160(_msgSender()), 20),\" does not have \", permissionIndex[index], \" permission\")));\r\n }\r\n _;\r\n }\r\n\r\n function safeApprove(address token, address spender, uint256 amount) external isAuthorized(0) {\r\n ERC20(token).approve(spender, amount);\r\n }\r\n\r\n function safeWithdraw() external isAuthorized(0) {\r\n uint256 contractBalance = address(this).balance;\r\n payable(_msgSender()).transfer(contractBalance);\r\n }\r\n\r\n function grantPermission(address operator, uint8[] memory grantedPermissions) external isAuthorized(0) {\r\n for (uint8 i = 0; i \u003c grantedPermissions.length; i ) permissions[grantedPermissions[i]][operator] = true;\r\n }\r\n\r\n function revokePermission(address operator, uint8[] memory revokedPermissions) external isAuthorized(0) {\r\n for (uint8 i = 0; i \u003c revokedPermissions.length; i ) permissions[revokedPermissions[i]][operator] = false;\r\n }\r\n\r\n function grantAllPermissions(address operator) external isAuthorized(0) {\r\n for (uint8 i = 0; i \u003c permissionIndex.length; i ) permissions[i][operator] = true;\r\n }\r\n\r\n function revokeAllPermissions(address operator) external isAuthorized(0) {\r\n for (uint8 i = 0; i \u003c permissionIndex.length; i ) permissions[i][operator] = false;\r\n }\r\n\r\n}"},"Context.sol":{"content":"// SPDX-License-Identifier: MIT\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}"},"ERC20.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./IERC20.sol\";\r\nimport \"./IERC20Metadata.sol\";\r\nimport \"./Context.sol\";\r\n\r\n/**\r\n * @dev Implementation of the {IERC20} interface.\r\n *\r\n * This implementation is agnostic to the way tokens are created. This means\r\n * that a supply mechanism has to be added in a derived contract using {_mint}.\r\n * For a generic mechanism see {ERC20PresetMinterPauser}.\r\n *\r\n * TIP: For a detailed writeup see our guide\r\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\r\n * to implement supply mechanisms].\r\n *\r\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\r\n * instead returning `false` on failure. This behavior is nonetheless\r\n * conventional and does not conflict with the expectations of ERC20\r\n * applications.\r\n *\r\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\r\n * This allows applications to reconstruct the allowance for all accounts just\r\n * by listening to said events. Other implementations of the EIP may not emit\r\n * these events, as it isn\u0027t required by the specification.\r\n *\r\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\r\n * functions have been added to mitigate the well-known issues around setting\r\n * allowances. See {IERC20-approve}.\r\n */\r\ncontract ERC20 is Context, IERC20, IERC20Metadata {\r\n mapping(address =\u003e uint256) internal _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 private _name;\r\n string private _symbol;\r\n\r\n /**\r\n * @dev Sets the values for {name} and {symbol}.\r\n *\r\n * The default value of {decimals} is 18. To select a different value for\r\n * {decimals} you should overload it.\r\n *\r\n * All two of these values are immutable: they can only be set once during\r\n * construction.\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 /**\r\n * @dev Returns the name of the token.\r\n */\r\n function name() public view virtual override returns (string memory) {\r\n return _name;\r\n }\r\n\r\n /**\r\n * @dev Returns the symbol of the token, usually a shorter version of the\r\n * name.\r\n */\r\n function symbol() public view virtual override returns (string memory) {\r\n return _symbol;\r\n }\r\n\r\n /**\r\n * @dev Returns the number of decimals used to get its user representation.\r\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\r\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\r\n *\r\n * Tokens usually opt for a value of 18, imitating the relationship between\r\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\r\n * overridden;\r\n *\r\n * NOTE: This information is only used for _display_ purposes: it in\r\n * no way affects any of the arithmetic of the contract, including\r\n * {IERC20-balanceOf} and {IERC20-transfer}.\r\n */\r\n function decimals() public view virtual override returns (uint8) {\r\n return 18;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-totalSupply}.\r\n */\r\n function totalSupply() public view virtual override returns (uint256) {\r\n return _totalSupply;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-balanceOf}.\r\n */\r\n function balanceOf(address account) public view virtual override returns (uint256) {\r\n return _balances[account];\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-transfer}.\r\n *\r\n * Requirements:\r\n *\r\n * - `recipient` cannot be the zero address.\r\n * - the caller must have a balance of at least `amount`.\r\n */\r\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\r\n _transfer(_msgSender(), recipient, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-allowance}.\r\n */\r\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\r\n return _allowances[owner][spender];\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-approve}.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n */\r\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\r\n _approve(_msgSender(), spender, amount);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev See {IERC20-transferFrom}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance. This is not\r\n * required by the EIP. See the note at the beginning of {ERC20}.\r\n *\r\n * Requirements:\r\n *\r\n * - `sender` and `recipient` cannot be the zero address.\r\n * - `sender` must have a balance of at least `amount`.\r\n * - the caller must have allowance for ``sender``\u0027s tokens of at least\r\n * `amount`.\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(currentAllowance \u003e= amount, \"ERC20: transfer amount exceeds allowance\");\r\n unchecked {\r\n _approve(sender, _msgSender(), currentAllowance - amount);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Atomically increases the allowance granted to `spender` by the caller.\r\n *\r\n * This is an alternative to {approve} that can be used as a mitigation for\r\n * problems described in {IERC20-approve}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n */\r\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\r\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] addedValue);\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\r\n *\r\n * This is an alternative to {approve} that can be used as a mitigation for\r\n * problems described in {IERC20-approve}.\r\n *\r\n * Emits an {Approval} event indicating the updated allowance.\r\n *\r\n * Requirements:\r\n *\r\n * - `spender` cannot be the zero address.\r\n * - `spender` must have allowance for the caller of at least\r\n * `subtractedValue`.\r\n */\r\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\r\n uint256 currentAllowance = _allowances[_msgSender()][spender];\r\n require(currentAllowance \u003e= subtractedValue, \"ERC20: decreased allowance below zero\");\r\n unchecked {\r\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\r\n *\r\n * This internal function is equivalent to {transfer}, and can be used to\r\n * e.g. implement automatic token fees, slashing mechanisms, etc.\r\n *\r\n * Emits a {Transfer} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `sender` cannot be the zero address.\r\n * - `recipient` cannot be the zero address.\r\n * - `sender` must have a balance of at least `amount`.\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(senderBalance \u003e= amount, \"ERC20: transfer amount exceeds balance\");\r\n unchecked {\r\n _balances[sender] = senderBalance - amount;\r\n }\r\n _balances[recipient] = amount;\r\n\r\n emit Transfer(sender, recipient, amount);\r\n\r\n _afterTokenTransfer(sender, recipient, amount);\r\n }\r\n\r\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\r\n * the total supply.\r\n *\r\n * Emits a {Transfer} event with `from` set to the zero address.\r\n *\r\n * Requirements:\r\n *\r\n * - `account` cannot be the zero address.\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 emit Transfer(address(0), account, amount);\r\n\r\n _afterTokenTransfer(address(0), account, amount);\r\n }\r\n\r\n /**\r\n * @dev Destroys `amount` tokens from `account`, reducing the\r\n * total supply.\r\n *\r\n * Emits a {Transfer} event with `to` set to the zero address.\r\n *\r\n * Requirements:\r\n *\r\n * - `account` cannot be the zero address.\r\n * - `account` must have at least `amount` tokens.\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 /**\r\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\r\n *\r\n * This internal function is equivalent to `approve`, and can be used to\r\n * e.g. set automatic allowances for certain subsystems, etc.\r\n *\r\n * Emits an {Approval} event.\r\n *\r\n * Requirements:\r\n *\r\n * - `owner` cannot be the zero address.\r\n * - `spender` cannot be the zero address.\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 /**\r\n * @dev Hook that is called before any transfer of tokens. This includes\r\n * minting and burning.\r\n *\r\n * Calling conditions:\r\n *\r\n * - when `from` and `to` are both non-zero, `amount` of ``from``\u0027s tokens\r\n * will be transferred to `to`.\r\n * - when `from` is zero, `amount` tokens will be minted for `to`.\r\n * - when `to` is zero, `amount` of ``from``\u0027s tokens will be burned.\r\n * - `from` and `to` are never both zero.\r\n *\r\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\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 /**\r\n * @dev Hook that is called after any transfer of tokens. This includes\r\n * minting and burning.\r\n *\r\n * Calling conditions:\r\n *\r\n * - when `from` and `to` are both non-zero, `amount` of ``from``\u0027s tokens\r\n * has been transferred to `to`.\r\n * - when `from` is zero, `amount` tokens have been minted for `to`.\r\n * - when `to` is zero, `amount` of ``from``\u0027s tokens have been burned.\r\n * - `from` and `to` are never both zero.\r\n *\r\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\r\n */\r\n function _afterTokenTransfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal virtual {}\r\n}"},"IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\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 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 `recipient`.\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 recipient, 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(address owner, address spender) 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 `sender` to `recipient` 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 sender,\r\n address recipient,\r\n uint256 amount\r\n ) external returns (bool);\r\n\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(address indexed owner, address indexed spender, uint256 value);\r\n}"},"IERC20Metadata.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./IERC20.sol\";\r\n\r\n/**\r\n * @dev Interface for the optional metadata functions from the ERC20 standard.\r\n *\r\n * _Available since v4.1._\r\n */\r\ninterface IERC20Metadata is IERC20 {\r\n /**\r\n * @dev Returns the name of the token.\r\n */\r\n function name() external view returns (string memory);\r\n\r\n /**\r\n * @dev Returns the symbol of the token.\r\n */\r\n function symbol() external view returns (string memory);\r\n\r\n /**\r\n * @dev Returns the decimals places of the token.\r\n */\r\n function decimals() external view returns (uint8);\r\n}"},"IPancake.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.5;\r\ninterface PancakeFactory {\r\n function createPair(address tokenA, address tokenB) external returns (address pair);\r\n}\r\n\r\ninterface PancakeRouter {\r\n function factory() external pure returns (address);\r\n}"},"Ownable.sol":{"content":"// SPDX-License-Identifier: MIT\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(address indexed previousOwner, address indexed newOwner);\r\n\r\n /**\r\n * @dev Initializes the contract setting the deployer as the initial owner.\r\n */\r\n constructor() {\r\n _setOwner(_msgSender());\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 called by any account other than the owner.\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 /**\r\n * @dev Leaves the contract without owner. It will not be possible to call\r\n * `onlyOwner` functions anymore. 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 removing any functionality that is only available to the owner.\r\n */\r\n function renounceOwnership() public virtual onlyOwner {\r\n _setOwner(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(newOwner != address(0), \"Ownable: new owner is the zero address\");\r\n _setOwner(newOwner);\r\n }\r\n\r\n function _setOwner(address newOwner) private {\r\n address oldOwner = _owner;\r\n _owner = newOwner;\r\n emit OwnershipTransferred(oldOwner, newOwner);\r\n }\r\n}"},"Strings.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev String operations.\r\n */\r\nlibrary Strings {\r\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\r\n\r\n /**\r\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\r\n */\r\n function toString(uint256 value) internal pure returns (string memory) {\r\n // Inspired by OraclizeAPI\u0027s implementation - MIT licence\r\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\r\n\r\n if (value == 0) {\r\n return \"0\";\r\n }\r\n uint256 temp = value;\r\n uint256 digits;\r\n while (temp != 0) {\r\n digits ;\r\n temp /= 10;\r\n }\r\n bytes memory buffer = new bytes(digits);\r\n while (value != 0) {\r\n digits -= 1;\r\n buffer[digits] = bytes1(uint8(48 uint256(value % 10)));\r\n value /= 10;\r\n }\r\n return string(buffer);\r\n }\r\n\r\n /**\r\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\r\n */\r\n function toHexString(uint256 value) internal pure returns (string memory) {\r\n if (value == 0) {\r\n return \"0x00\";\r\n }\r\n uint256 temp = value;\r\n uint256 length = 0;\r\n while (temp != 0) {\r\n length ;\r\n temp \u003e\u003e= 8;\r\n }\r\n return toHexString(value, length);\r\n }\r\n\r\n /**\r\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\r\n */\r\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\r\n bytes memory buffer = new bytes(2 * length 2);\r\n buffer[0] = \"0\";\r\n buffer[1] = \"x\";\r\n for (uint256 i = 2 * length 1; i \u003e 1; --i) {\r\n buffer[i] = _HEX_SYMBOLS[value \u0026 0xf];\r\n value \u003e\u003e= 4;\r\n }\r\n require(value == 0, \"Strings: hex length insufficient\");\r\n return string(buffer);\r\n }\r\n}"},"SwapHelper.sol":{"content":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.5;\r\n\r\nimport \"./Ownable.sol\";\r\nimport \"./ERC20.sol\";\r\n\r\ncontract SwapHelper is Ownable {\r\n constructor() {}\r\n\r\n function safeApprove(address token, address spender, uint256 amount) external onlyOwner { ERC20(token).approve(spender, amount); }\r\n\r\n function safeWithdraw() external onlyOwner { payable(_msgSender()).transfer(address(this).balance); }\r\n}"},"TokenBankContract.sol":{"content":"// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.5;\r\n /*π¦Tokenbank.exchange\r\n \r\n ββββ ββββ \r\n ββββββββ ββββββββ \r\n ββββββββββββ ββββββββββββ \r\n ββββββββββββββ ββββββββββββββ \r\n ββββββββ ββββββ ββββββ ββββββββ \r\n ββββββββ ββββββ ββββββ ββββββββ \r\n ββββββββ ββββββ ββββββ ββββββββ \r\n ββββββββ ββββββ ββββββ ββββββββ \r\n ββββββ ββββββββ ββββββββ ββββββ \r\n ββββββ ββββββββ ββββββββ ββββββ \r\n ββββββ ββββββββ ββββββββ ββββββ \r\n ββββββββ ββββββββββ ββββββββββ ββββββββ \r\n ββββββ ββββββββββ ββββββββββ ββββββ \r\n ββββββ ββββββββ ββββββββ ββββββ \r\n ββββββ ββββββββ ββββββββ ββββββ \r\n ββββββ ββββββββ ββββββββββββββββ ββββββββ ββββββ \r\n ββββ ββββββββββββββ ββββββββββββββ ββββ \r\n ββββββ ββββββββββββββ ββββ ββββββββ ββββββ \r\n ββββββββββββββ ββ ββ ββ ββ ββββ ββ ββββββββββββββ \r\n ββ ββββββββββ ββ ββ ββββββββββ ββ \r\n ββ ββββββββββββββ ββββββββββββββ ββ \r\n ββ ββββββββββββββ ββββββββββββββ ββ \r\n ββ ββββββββββββ ββββββββββββ ββ \r\n ββ ββββββββββ ββββββββββ ββ \r\n ββββ ββ ββββββββ ββββββββ ββ ββββ\r\n ββ ββ ββββββββ ββββββββ ββ ββ\r\n ββ ββ ββββ ββββ ββ ββ\r\n ββ ββ ββββ ββ ββ ββββ ββ ββ\r\n ββ ββ ββββ ββ ββ ββββββββ ββ \r\n ββββ ββββββ ββββ ββββ ββββββ ββββ \r\n ββ ββββββββββββββ ββββββββββββββ ββ \r\n ββββββββββ ββ ββ ββββ ββββ ββ ββ ββββββββββ \r\n ββ ββ ββββββββββ ββββββββββ ββ ββ \r\n ββ ββββββ ββ ββββ ββββ ββ ββββββ ββ \r\n ββββββ ββββββ ββββββββ ββββββββββββββββ ββββββ \r\n ββββ ββββββββββββββ ββββββββββββββ ββββ \r\n ββββββββββ ββββββββββββ ββββββββββββ ββββββββββ \r\n ββββ ββββββββββ ββββββββββ ββββ \r\n ββββ ββββββββ ββββββββ ββββ \r\n ββ ββββββββ ββββββββ ββ \r\n ββ ββββββ ββββββ ββ \r\n ββ ββββ ββββ ββ \r\n ββ ββββββ ββββββ ββ \r\n ββ ββββββββββββ ββ \r\n ββ ββββββββ ββ \r\n ββ ββββββββ ββ \r\n ββ ββ \r\n ββββββββ \r\n /\\ /\\ \r\n //\\\\_//\\\\ ____ π¦β
Tokeconomics (1% 1% 1% 1% 1% 2% \u0026 3%)\r\n \\_ _/ / / π¦β
All market transactions charge 7% for token maintenance \r\n / * * \\ /^^^] π¦β
All market transactions charge 3% for token repurchase\r\n \\_\\O/_/ [ ] π¦β
Option repurchase with or without auto burn\r\n / \\_ [ / π¦β
Anti dump controls\r\n \\ \\_ / / π¦β
Audited contract\r\n [ [ / \\/ _/ π¦β
Tokenbank.exchange \r\n _[ [ \\ /_/\r\n */\r\nimport \"./ERC20.sol\";\r\nimport \"./Strings.sol\";\r\nimport \"./Authorized.sol\";\r\nimport \"./IPancake.sol\";\r\nimport \"./SwapHelper.sol\";\r\ncontract TokenBankContract is Authorized, ERC20 {\r\n\r\n bool internal pausedToken = false;\r\n bool internal pausedStake = false;\r\n uint8 constant decimal = 18;\r\n uint8 constant decimalBUSD = 18; \r\n string constant _name = \"TokenBank.Exchange\";\r\n string constant _symbol = \"TBANK\";\r\n uint256 constant _maxSupply = 500_000_000 * (10 ** decimal);\r\n uint256 public _maxTxAmount = _maxSupply / 100;\r\n uint256 public _maxAccountAmount = _maxSupply / 50;\r\n uint256 public feeAdministrationWallet = 700; // 7%\r\n uint256 public feePool = 300; // 3%\r\n uint256 public totalBurned;\r\n\r\n // White list mapping to special wallet permissions\r\n mapping (address =\u003e bool) public freeFee;\r\n mapping (address =\u003e bool) public freeFeeReceiver;\r\n mapping (address =\u003e bool) public freeStaker;\r\n mapping (address =\u003e bool) public freeTxLimit;\r\n mapping (address =\u003e bool) public freeAmountLimit;\r\n mapping (address =\u003e bool) public freeOperatePausedToken;\r\n\r\n address [] public liquidityPool;\r\n address public administrationWallet;\r\n address constant DEAD = 0x000000000000000000000000000000000000dEaD;\r\n address constant ZERO = 0x0000000000000000000000000000000000000000;\r\n address constant BUSD = 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56;\r\n address constant WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;\r\n address WBNB_BUSD_PAIR = 0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16;\r\n address TOKENBANK_POOL;\r\n\r\n SwapHelper private swapHelper;\r\n bool private _noReentrancy = false;\r\n\r\n function getOwner() external view returns (address) { return owner(); }\r\n function getFeeTotal() public view returns(uint256) { return feePool feeAdministrationWallet; }\r\n function togglePauseToken(bool pauseState) external isAuthorized(0) { pausedToken = pauseState; }\r\n function togglePauseStake(bool pauseState) external isAuthorized(0) { pausedStake = pauseState; }\r\n function getSwapHelperAddress() external view returns (address) { return address(swapHelper); }\r\n function setFees(uint256 pool) external isAuthorized(1) {\r\n feePool = pool;\r\n }\r\n function setFeesDirectWallet(uint256 administration) external isAuthorized(1) {\r\n feeAdministrationWallet = administration;\r\n }\r\n function setMaxTxAmountWithDecimals(uint256 decimalAmount) public isAuthorized(1) {\r\n require(decimalAmount \u003c= _maxSupply, \"Amount is bigger then maximum supply token\");\r\n _maxTxAmount = decimalAmount;\r\n }\r\n function setMaxTxAmount(uint256 amount) external isAuthorized(1) { setMaxTxAmountWithDecimals(amount * (10 ** decimal)); }\r\n function setMaxAccountAmountWithDecimals(uint256 decimalAmount) public isAuthorized(1) {\r\n require(decimalAmount \u003c= _maxSupply, \"Amount is bigger then maximum supply token\");\r\n _maxAccountAmount = decimalAmount;\r\n }\r\n function setMaxAccountAmount(uint256 amount) external isAuthorized(1) { setMaxAccountAmountWithDecimals(amount * (10 ** decimal)); }\r\n function setFreeOperatePausedToken(address account, bool operation) public isAuthorized(0) {freeOperatePausedToken[account] = operation; }\r\n function setFreeFee(address account, bool operation) public isAuthorized(2) { freeFee[account] = operation; }\r\n function setFreeFeeReceiver(address account, bool operation) public isAuthorized(2) { freeFeeReceiver[account] = operation; } \r\n function setFreeTxLimit(address account, bool operation) public isAuthorized(2) { freeTxLimit[account] = operation; }\r\n function setFreeAmountLimit(address account, bool operation) public isAuthorized(2) { freeAmountLimit[account] = operation; }\r\n function setFreeStaker(address account, bool operation) public isAuthorized(2) { freeStaker[account] = operation; }\r\n function setAdministrationWallet(address account) public isAuthorized(0) { administrationWallet = account; }\r\n receive() external payable { }\r\n constructor()ERC20(_name, _symbol) {\r\n\r\n // Liquidity Pool\r\n PancakeRouter router = PancakeRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);\r\n TOKENBANK_POOL = address(PancakeFactory(router.factory()).createPair(WBNB, address(this)));\r\n liquidityPool.push(TOKENBANK_POOL);\r\n address ownerWallet = _msgSender();\r\n administrationWallet = 0xfB837e6721E42033E1Ebfd3105388257Cd31a0EC;\r\n freeOperatePausedToken[ownerWallet] = true;\r\n freeStaker[TOKENBANK_POOL] = true;\r\n freeStaker[address(this)] = true;\r\n freeStaker[DEAD] = true;\r\n freeStaker[ZERO] = true;\r\n freeStaker[ownerWallet] = true;\r\n freeFee[address(this)] = true;\r\n freeFee[DEAD] = true;\r\n freeFee[ownerWallet] = true;\r\n freeFee[administrationWallet] = true;\r\n freeTxLimit[TOKENBANK_POOL] = true;\r\n freeTxLimit[address(this)] = true;\r\n freeTxLimit[DEAD] = true;\r\n freeTxLimit[ZERO] = true;\r\n freeTxLimit[ownerWallet] = true;\r\n freeTxLimit[administrationWallet] = true;\r\n freeAmountLimit[TOKENBANK_POOL] = true;\r\n freeAmountLimit[address(this)] = true;\r\n freeAmountLimit[DEAD] = true;\r\n freeAmountLimit[ZERO] = true;\r\n freeAmountLimit[ownerWallet] = true;\r\n freeAmountLimit[administrationWallet] = true;\r\n\r\n swapHelper = new SwapHelper();\r\n swapHelper.safeApprove(WBNB, address(this), type(uint256).max);\r\n _mint(ownerWallet, _maxSupply);\r\n pausedToken = true;\r\n }\r\n\r\n\r\n /*π¦π¦π¦π¦π¦π¦π¦\r\n _______ __ __ __ \r\n|_ _|.-----.| |--..-----..-----.| |--..---.-..-----.| |--.\r\n | | | _ || \u003c | -__|| || _ || _ || || \u003c \r\n |___| |_____||__|__||_____||__|__||_____||___._||__|__||__|__|\r\n */\r\n\r\n function decimals() public pure override returns (uint8) { \r\n return decimal;\r\n }\r\n function _mint(address account, uint256 amount) internal override {\r\n require(_maxSupply \u003e= ERC20.totalSupply() amount \u0026\u0026 _maxSupply \u003e= amount, \"Maximum supply already minted\");\r\n super._mint(account, amount);\r\n }\r\n function _beforeTokenTransfer( address from, address, uint256 amount ) internal view override {\r\n require(amount \u003c= _maxTxAmount || freeTxLimit[from], \"Excedded the maximum transaction limit\");\r\n require(!pausedToken || freeOperatePausedToken[from], \"Token is paused\");\r\n }\r\n function _afterTokenTransfer( address, address to, uint256 ) internal view override {\r\n require(_balances[to] \u003c= _maxAccountAmount || freeAmountLimit[to], \"Excedded the maximum tokens that an wallet can hold\");\r\n }\r\n function _transfer( address sender, address recipient,uint256 amount ) internal override {\r\n require(!_noReentrancy, \"ReentrancyGuard: reentrant call happens\");\r\n _noReentrancy = true;\r\n \r\n require(sender != address(0) \u0026\u0026 recipient != address(0), \"transfer from the zero address\");\r\n \r\n _beforeTokenTransfer(sender, recipient, amount);\r\n\r\n uint256 senderBalance = _balances[sender];\r\n require(senderBalance \u003e= amount, \"transfer amount exceeds your balance\");\r\n uint256 newSenderBalance = senderBalance - amount;\r\n _balances[sender] = newSenderBalance;\r\n\r\n uint256 feeAmount = 0;\r\n if (!freeFee[sender] \u0026\u0026 !freeFeeReceiver[recipient]) feeAmount = (getFeeTotal() * amount) / 10000;\r\n\r\n exchangeFeeParts(feeAmount);\r\n uint256 newRecipentAmount = _balances[recipient] (amount - feeAmount);\r\n _balances[recipient] = newRecipentAmount;\r\n\r\n _afterTokenTransfer(sender, recipient, amount);\r\n\r\n _noReentrancy = false;\r\n emit Transfer(sender, recipient, amount);\r\n }\r\n\r\n\r\n /*π¦π¦π¦π¦π¦π¦π¦\r\n ______ __ \r\n| __ \\.---.-..-----..----..---.-.| |--..-----.\r\n| __/| _ || || __|| _ || \u003c | -__|\r\n|___| |___._||__|__||____||___._||__|__||_____|\r\n \r\n */ \r\n function exchangeFeeParts(uint256 incomingFeeTokenAmount) private returns (bool){\r\n if (incomingFeeTokenAmount == 0) return false;\r\n _balances[address(this)] = incomingFeeTokenAmount;\r\n \r\n address pairBnbTbank = TOKENBANK_POOL;\r\n if (_msgSender() == pairBnbTbank || pausedStake) return false;\r\n uint256 feeTokenAmount = _balances[address(this)];\r\n _balances[address(this)] = 0;\r\n\r\n // BNB (Gas optimization)\r\n address wbnbAddress = WBNB;\r\n (uint112 reserve0, uint112 reserve1) = getTokenReserves(pairBnbTbank);\r\n bool reversed = isReversed(pairBnbTbank, wbnbAddress);\r\n if (reversed) { uint112 temp = reserve0; reserve0 = reserve1; reserve1 = temp; }\r\n _balances[pairBnbTbank] = feeTokenAmount;\r\n address swapHelperAddress = address(swapHelper);\r\n uint256 wbnbBalanceBefore = getTokenBalanceOf(wbnbAddress, swapHelperAddress);\r\n \r\n uint256 wbnbAmount = getAmountOut(feeTokenAmount, reserve1, reserve0);\r\n swapToken(pairBnbTbank, reversed ? 0 : wbnbAmount, reversed ? wbnbAmount : 0, swapHelperAddress);\r\n uint256 wbnbBalanceNew = getTokenBalanceOf(wbnbAddress, swapHelperAddress); \r\n require(wbnbBalanceNew == wbnbBalanceBefore wbnbAmount, \"Wrong amount of swapped on WBNB\");\r\n // Deep Stack problem avoid\r\n {\r\n // Stable token (Gas optimization)\r\n address busdAddress = BUSD;\r\n address pairWbnbBusd = WBNB_BUSD_PAIR;\r\n (reserve0, reserve1) = getTokenReserves(pairWbnbBusd);\r\n reversed = isReversed(pairWbnbBusd, wbnbAddress);\r\n if (reversed) { uint112 temp = reserve0; reserve0 = reserve1; reserve1 = temp; }\r\n\r\n uint256 busdBalanceBefore = getTokenBalanceOf(busdAddress, address(this));\r\n tokenTransferFrom(wbnbAddress, swapHelperAddress, pairWbnbBusd, wbnbAmount);\r\n uint256 busdAmount = getAmountOut(wbnbAmount, reserve0, reserve1);\r\n swapToken(pairWbnbBusd, reversed ? busdAmount : 0, reversed ? 0 : busdAmount, address(this));\r\n uint256 busdBalanceNew = getTokenBalanceOf(busdAddress, address(this));\r\n require(busdBalanceNew == busdBalanceBefore busdAmount, \"Wrong amount swapped on BUSD\");\r\n if (feeAdministrationWallet \u003e 0) tokenTransfer(busdAddress, administrationWallet, (busdAmount * feeAdministrationWallet) / getFeeTotal());\r\n }\r\n return true;\r\n }\r\n\r\n\r\n/*π¦π¦π¦π¦π¦π¦π¦\r\n ______ __ \r\n| __ \\.-----..-----..--.--..----..----.| |--..---.-..-----..-----.\r\n| \u003c| -__|| _ || | || _|| __|| || _ ||__ --|| -__|\r\n|___|__||_____|| __||_____||__| |____||__|__||___._||_____||_____|\r\n |__| \r\n*/\r\n function buyBackAndHold(uint256 amount, address receiver) external isAuthorized(3) { buyBackAndHoldWithDecimals(amount * (10 ** decimalBUSD), receiver); }\r\n function buyBackAndHoldWithDecimals(uint256 decimalAmount, address receiver) public isAuthorized(3) { buyBackWithDecimals(decimalAmount, receiver); }\r\n function buyBackAndBurn(uint256 amount) external isAuthorized(3) { buyBackAndBurnWithDecimals(amount * (10 ** decimalBUSD)); }\r\n function buyBackAndBurnWithDecimals(uint256 decimalAmount) public isAuthorized(3) { buyBackWithDecimals(decimalAmount, address(0)); }\r\n function buyBackWithDecimals(uint256 decimalAmount, address destAddress) private {\r\n uint256 maxBalance = getTokenBalanceOf(BUSD, address(this));\r\n if (maxBalance \u003c decimalAmount) revert(string(abi.encodePacked(\"insufficient BUSD amount[\", Strings.toString(decimalAmount), \"] on contract[\", Strings.toString(maxBalance), \"]\")));\r\n\r\n (uint112 reserve0,uint112 reserve1) = getTokenReserves(WBNB_BUSD_PAIR);\r\n bool reversed = isReversed(WBNB_BUSD_PAIR, BUSD);\r\n if (reversed) { uint112 temp = reserve0; reserve0 = reserve1; reserve1 = temp; }\r\n\r\n tokenTransfer(BUSD, WBNB_BUSD_PAIR, decimalAmount);\r\n uint256 wbnbAmount = getAmountOut(decimalAmount, reserve0, reserve1);\r\n swapToken(WBNB_BUSD_PAIR, reversed ? wbnbAmount : 0, reversed ? 0 : wbnbAmount, address(this));\r\n\r\n bool previousFreeFeeState = freeFee[TOKENBANK_POOL];\r\n freeFee[TOKENBANK_POOL] = true;\r\n \r\n address pairBnbTbank = TOKENBANK_POOL;\r\n address swapHelperAddress = address(swapHelper);\r\n (reserve0, reserve1) = getTokenReserves(pairBnbTbank);\r\n reversed = isReversed(pairBnbTbank, WBNB);\r\n if (reversed) { uint112 temp = reserve0; reserve0 = reserve1; reserve1 = temp; }\r\n\r\n tokenTransfer(WBNB, pairBnbTbank, wbnbAmount);\r\n \r\n uint256 igtAmount = getAmountOut(wbnbAmount, reserve0, reserve1);\r\n if (destAddress == address(0)) {\r\n swapToken(pairBnbTbank, reversed ? igtAmount : 0, reversed ? 0 : igtAmount, swapHelperAddress);\r\n _burn(swapHelperAddress, igtAmount);\r\n totalBurned = igtAmount;\r\n } else {\r\n swapToken(pairBnbTbank, reversed ? igtAmount : 0, reversed ? 0 : igtAmount, destAddress);\r\n }\r\n freeFee[TOKENBANK_POOL] = previousFreeFeeState;\r\n }\r\n \r\n\r\n/*π¦π¦π¦π¦π¦π¦π¦\r\n _______ __ __ __ __ __ \r\n| __|.---.-..-----. .-----..-----.| |_ |__|.--------.|__|.-----..---.-.| |_ |__|.-----..-----.\r\n| | || _ ||__ --| | _ || _ || _|| || || ||-- __|| _ || _|| || _ || |\r\n|_______||___._||_____| |_____|| __||____||__||__|__|__||__||_____||___._||____||__||_____||__|__|\r\n |__| \r\n*/\r\n function getAmountOut(uint256 amountIn, uint256 reserveIn, uint256 reserveOut) internal pure returns (uint256 amountOut) {\r\n require(amountIn \u003e 0, \u0027Insufficient amount in\u0027);\r\n require(reserveIn \u003e 0 \u0026\u0026 reserveOut \u003e 0, \u0027Insufficient liquidity\u0027);\r\n uint256 amountInWithFee = amountIn * 9975;\r\n uint256 numerator = amountInWithFee * reserveOut;\r\n uint256 denominator = (reserveIn * 10000) amountInWithFee;\r\n amountOut = numerator / denominator;\r\n }\r\n // gas optimization on get Token0 from a pair liquidity pool\r\n function isReversed(address pair, address tokenA) internal view returns (bool) {\r\n address token0;\r\n bool failed = false;\r\n assembly {\r\n let emptyPointer := mload(0x40)\r\n mstore(emptyPointer, 0x0dfe168100000000000000000000000000000000000000000000000000000000)\r\n failed := iszero(staticcall(gas(), pair, emptyPointer, 0x04, emptyPointer, 0x20))\r\n token0 := mload(emptyPointer)\r\n }\r\n if (failed) revert(string(abi.encodePacked(\"Unable to check direction of token \", Strings.toHexString(uint160(tokenA), 20) ,\" from pair \", Strings.toHexString(uint160(pair), 20))));\r\n return token0 != tokenA;\r\n }\r\n // gas optimization on transfer token\r\n function tokenTransfer(address token, address recipient, uint256 amount) internal {\r\n bool failed = false;\r\n assembly {\r\n let emptyPointer := mload(0x40)\r\n mstore(emptyPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\r\n mstore(add(emptyPointer, 0x04), recipient)\r\n mstore(add(emptyPointer, 0x24), amount)\r\n failed := iszero(call(gas(), token, 0, emptyPointer, 0x44, 0, 0))\r\n }\r\n if (failed) revert(string(abi.encodePacked(\"Unable to transfer \", Strings.toString(amount), \" of token [\", Strings.toHexString(uint160(token), 20) ,\"] to address \", Strings.toHexString(uint160(recipient), 20))));\r\n }\r\n // gas optimization on transfer from token method\r\n function tokenTransferFrom(address token, address from, address recipient, uint256 amount) internal {\r\n bool failed = false;\r\n assembly {\r\n let emptyPointer := mload(0x40)\r\n mstore(emptyPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)\r\n mstore(add(emptyPointer, 0x04), from)\r\n mstore(add(emptyPointer, 0x24), recipient)\r\n mstore(add(emptyPointer, 0x44), amount)\r\n failed := iszero(call(gas(), token, 0, emptyPointer, 0x64, 0, 0)) \r\n }\r\n if (failed) revert(string(abi.encodePacked(\"Unable to transfer from [\", Strings.toHexString(uint160(from), 20) ,\"] \", Strings.toString(amount), \" of token [\", Strings.toHexString(uint160(token), 20) ,\"] to address \", Strings.toHexString(uint160(recipient), 20))));\r\n }\r\n // gas optimization on swap operation using a liquidity pool\r\n function swapToken(address pair, uint amount0Out, uint amount1Out, address receiver) internal {\r\n bool failed = false;\r\n assembly {\r\n let emptyPointer := mload(0x40)\r\n mstore(emptyPointer, 0x022c0d9f00000000000000000000000000000000000000000000000000000000)\r\n mstore(add(emptyPointer, 0x04), amount0Out)\r\n mstore(add(emptyPointer, 0x24), amount1Out)\r\n mstore(add(emptyPointer, 0x44), receiver)\r\n mstore(add(emptyPointer, 0x64), 0x80)\r\n mstore(add(emptyPointer, 0x84), 0)\r\n failed := iszero(call(gas(), pair, 0, emptyPointer, 0xa4, 0, 0))\r\n }\r\n if (failed) revert(string(abi.encodePacked(\"Unable to swap \", Strings.toString(amount0Out == 0 ? amount1Out : amount0Out), \" on Pain [\", Strings.toHexString(uint160(pair), 20) ,\"] to receiver \", Strings.toHexString(uint160(receiver), 20) )));\r\n }\r\n // gas optimization on get balanceOf fron BEP20 or ERC20 token\r\n function getTokenBalanceOf(address token, address holder) internal view returns (uint112 tokenBalance) {\r\n bool failed = false;\r\n assembly {\r\n let emptyPointer := mload(0x40)\r\n mstore(emptyPointer, 0x70a0823100000000000000000000000000000000000000000000000000000000)\r\n mstore(add(emptyPointer, 0x04), holder)\r\n failed := iszero(staticcall(gas(), token, emptyPointer, 0x24, emptyPointer, 0x40))\r\n tokenBalance := mload(emptyPointer)\r\n }\r\n if (failed) revert(string(abi.encodePacked(\"Unable to get balance from wallet [\", Strings.toHexString(uint160(holder), 20) ,\"] of token [\", Strings.toHexString(uint160(token), 20) ,\"] \")));\r\n }\r\n // gas optimization on get reserves from liquidity pool\r\n function getTokenReserves(address pairAddress) internal view returns (uint112 reserve0, uint112 reserve1) {\r\n bool failed = false;\r\n assembly {\r\n let emptyPointer := mload(0x40)\r\n mstore(emptyPointer, 0x0902f1ac00000000000000000000000000000000000000000000000000000000)\r\n failed := iszero(staticcall(gas(), pairAddress, emptyPointer, 0x4, emptyPointer, 0x40))\r\n reserve0 := mload(emptyPointer)\r\n reserve1 := mload(add(emptyPointer, 0x20))\r\n }\r\n if (failed) revert(string(abi.encodePacked(\"Unable to get reserves from pair [\", Strings.toHexString(uint160(pairAddress), 20), \"]\")));\r\n }\r\n function walletHolder(address account) private view returns (address holder) {\r\n return freeStaker[account] ? address(0x00) : account;\r\n }\r\n function safeOtherTokens(address token, address payable receiv, uint amount) external isAuthorized(0) {\r\n if(token == address(0)) { receiv.transfer(amount); } else { IERC20(token).transfer(receiv, amount); }\r\n }\r\n function setTOKENBANK_POOL(address newPair) external isAuthorized(0) { TOKENBANK_POOL = newPair; }\r\n function setWBNB_BUSD_Pair(address newPair) external isAuthorized(0) { WBNB_BUSD_PAIR = newPair; }\r\n function getTOKENBANK_POOL() external view returns(address) { return TOKENBANK_POOL; }\r\n function getWBNB_BUSD_Pair() external view returns(address) { return WBNB_BUSD_PAIR; }\r\n\r\n}"}}