Token 10X: Africa's First Cryptocurrency Hub
Virtus Finance Token
Virtus is a digital startup with an emphasis on Defi innovation, providing value and benefits to the $VAP token holders. Our Virtus Auto-Staking protocol integrated within the $VAP token is designed to rebase your investment every 10 minutes. An easy process of buy-hold-earn that will grow your wall...
About Virtus Finance
Virtus is a digital startup with an emphasis on Defi innovation, providing value and benefits to the $VAP token holders. Our Virtus Auto-Staking protocol integrated within the $VAP token is designed to rebase your investment every 10 minutes. An easy process of buy-hold-earn that will grow your wallet exponentially.
26 total visits
Token information and links
Circulating Supply
118755172833
Token Contract (BSC Chain)
0XE96C3CC84947280A26AA70CCCDC5C4BA717AE395
Contract license:
Launch Date
15/03/2022
KYC Information
No
Audit Information
None
Team Information
Team leader: None
Team leader contact: None
Contract source code
{{
"language": "Solidity",
"sources": {
"contracts/VirtusFinance.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\nimport \"./IUniswapV2Pair.sol\";\nimport \"./IUniswapV2Router.sol\";\nimport \"./IUniswapV2Factory.sol\";\n\ncontract VirtusFinance is ERC20, Ownable {\n event LogRebase(uint256 indexed epoch, uint256 totalSupply);\n\n uint256 public constant MAX_UINT256 = type(uint256).max;\n address private constant DEAD = 0x000000000000000000000000000000000000dEaD;\n address private constant ZERO = 0x0000000000000000000000000000000000000000;\n uint256 public constant DECIMALS = 5;\n uint8 public constant RATE_DECIMALS = 7;\n\n uint256 private constant INITIAL_FRAGMENTS_SUPPLY = 500_000 * 10**DECIMALS;\n uint256 private constant MAX_SUPPLY = 5_000_000_000 * 10**DECIMALS;\n\n string private _name = \"Virtus Finance\";\n string private _symbol = \"VAP\";\n\n IUniswapV2Pair public pair;\n mapping(address => bool) private _isFeeExempt;\n\n uint256 public liquidityFee = 30;\n uint256 public treasuryFee = 30;\n uint256 public protectionFundFee = 50;\n uint256 public sellFee = 20;\n uint256 public burnFee = 25;\n uint256 public totalFee =\n liquidityFee treasuryFee protectionFundFee burnFee;\n uint256 public feeDenominator = 1000;\n\n address public autoLiquidityReceiver;\n address public virtusTreasuryReceiver;\n address public virtusProtectionFundReceiver;\n address public virtusBurner;\n bool public swapEnabled = true;\n IUniswapV2Router public router;\n bool private inSwap = false;\n\n uint256 private constant TOTAL_GONS =\n MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY);\n\n bool public _autoRebase;\n bool public _autoAddLiquidity;\n uint256 public _initRebaseStartTime;\n uint256 public _lastRebasedTime;\n uint256 public _lastAddLiquidityTime;\n uint256 public _totalSupply;\n uint256 private _gonsPerFragment;\n\n mapping(address => uint256) private _gonBalances;\n mapping(address => mapping(address => uint256)) private _allowedFragments;\n mapping(address => bool) public blacklist;\n\n modifier swapping() {\n inSwap = true;\n _;\n inSwap = false;\n }\n\n modifier validRecipient(address to) {\n require(to != address(0), \"Cannot transfer to address 0\");\n _;\n }\n\n constructor(address _router) ERC20(_name, _symbol) Ownable() {\n router = IUniswapV2Router(_router);\n address pairAddress = IUniswapV2Factory(router.factory()).createPair(\n router.WETH(),\n address(this)\n );\n\n autoLiquidityReceiver = 0xAB14Ce87BFc7290fc69BdA909817a18e513827cA;\n virtusTreasuryReceiver = 0xe81AB1DF23E21BcA12e5b89CA708Da6Ad78aBab6;\n virtusProtectionFundReceiver = 0x0f8D05230F3ffAa0a989585729F5c2fa587Cf13c;\n virtusBurner = 0xf39f309C352e541462cf15E744BD4C668E1111a3;\n\n _allowedFragments[address(this)][address(router)] = MAX_UINT256;\n pair = IUniswapV2Pair(pairAddress);\n\n _totalSupply = INITIAL_FRAGMENTS_SUPPLY;\n _gonBalances[virtusTreasuryReceiver] = TOTAL_GONS;\n _gonsPerFragment = TOTAL_GONS / _totalSupply;\n _initRebaseStartTime = block.timestamp;\n _lastRebasedTime = block.timestamp;\n _autoRebase = true;\n _autoAddLiquidity = true;\n _isFeeExempt[virtusTreasuryReceiver] = true;\n _isFeeExempt[address(this)] = true;\n\n _transferOwnership(virtusTreasuryReceiver);\n emit Transfer(ZERO, virtusTreasuryReceiver, _totalSupply);\n }\n\n function decimals() public view virtual override returns (uint8) {\n return uint8(DECIMALS);\n }\n\n function rebase() internal {\n if (inSwap) return;\n uint256 rebaseRate;\n uint256 deltaTimeFromInit = block.timestamp - _initRebaseStartTime;\n uint256 deltaTime = block.timestamp - _lastRebasedTime;\n uint256 times = deltaTime / 10 minutes;\n\n if (deltaTimeFromInit < (365 days)) {\n rebaseRate = 1583;\n } else if (deltaTimeFromInit >= (365 days)) {\n rebaseRate = 256;\n } else if (deltaTimeFromInit >= ((15 * 365 days) / 10)) {\n rebaseRate = 16;\n } else if (deltaTimeFromInit >= (7 * 365 days)) {\n rebaseRate = 4;\n }\n\n uint256 numerator = 10**RATE_DECIMALS rebaseRate;\n\n for (uint256 i = 0; i < times; i ) {\n _totalSupply = (_totalSupply * numerator) / (10**RATE_DECIMALS);\n }\n\n _gonsPerFragment = TOTAL_GONS / _totalSupply;\n _lastRebasedTime = _lastRebasedTime (times * 10 minutes);\n\n pair.sync();\n\n emit LogRebase(_lastRebasedTime, _totalSupply);\n }\n\n function transfer(address to, uint256 value)\n public\n override\n validRecipient(to)\n returns (bool)\n {\n _transferFrom(msg.sender, to, value);\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) public override validRecipient(to) returns (bool) {\n uint256 currentAllowance = _allowedFragments[from][msg.sender];\n if (currentAllowance != MAX_UINT256) {\n require(currentAllowance >= value, \"Insufficient allowance\");\n _allowedFragments[from][msg.sender] = currentAllowance - value;\n }\n _transferFrom(from, to, value);\n return true;\n }\n\n function _basicTransfer(\n address from,\n address to,\n uint256 amount\n ) internal returns (bool) {\n uint256 gonAmount = amount * _gonsPerFragment;\n _gonBalances[from] = _gonBalances[from] - gonAmount;\n _gonBalances[to] = _gonBalances[to] gonAmount;\n return true;\n }\n\n function _transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) internal returns (bool) {\n require(!blacklist[sender] && !blacklist[recipient], \"Blacklisted\");\n\n if (inSwap) {\n return _basicTransfer(sender, recipient, amount);\n }\n if (shouldRebase()) {\n rebase();\n }\n\n if (shouldAddLiquidity()) {\n addLiquidity();\n }\n\n if (shouldSwapBack()) {\n swapBack();\n }\n\n uint256 gonAmount = amount * _gonsPerFragment;\n _gonBalances[sender] = _gonBalances[sender] - gonAmount;\n uint256 gonAmountReceived = shouldTakeFee(sender, recipient)\n ? takeFee(sender, recipient, gonAmount)\n : gonAmount;\n _gonBalances[recipient] = _gonBalances[recipient] gonAmountReceived;\n\n emit Transfer(sender, recipient, gonAmountReceived / _gonsPerFragment);\n return true;\n }\n\n function takeFee(\n address sender,\n address recipient,\n uint256 gonAmount\n ) internal returns (uint256) {\n uint256 _totalFee = totalFee;\n uint256 _treasuryFee = treasuryFee;\n\n if (recipient == address(pair)) {\n _totalFee = totalFee sellFee;\n _treasuryFee = treasuryFee sellFee;\n }\n\n uint256 feeAmount = (gonAmount / feeDenominator) * _totalFee;\n\n _gonBalances[virtusBurner] =\n _gonBalances[virtusBurner] \n ((gonAmount / feeDenominator) * burnFee);\n\n _gonBalances[address(this)] =\n _gonBalances[address(this)] \n ((gonAmount / feeDenominator) * (_treasuryFee protectionFundFee));\n\n _gonBalances[autoLiquidityReceiver] =\n _gonBalances[autoLiquidityReceiver] \n ((gonAmount / feeDenominator) * liquidityFee);\n\n emit Transfer(sender, address(this), feeAmount / _gonsPerFragment);\n return gonAmount - feeAmount;\n }\n\n function addLiquidity() internal swapping {\n uint256 autoLiquidityAmount = _gonBalances[autoLiquidityReceiver] /\n _gonsPerFragment;\n _gonBalances[address(this)] =\n _gonBalances[address(this)] \n _gonBalances[autoLiquidityReceiver];\n _gonBalances[autoLiquidityReceiver] = 0;\n uint256 amountToLiquify = autoLiquidityAmount / 2;\n uint256 amountToSwap = autoLiquidityAmount - amountToLiquify;\n\n if (amountToSwap == 0) {\n return;\n }\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = router.WETH();\n\n uint256 balanceBefore = address(this).balance;\n\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amountToSwap,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n uint256 amountETHLiquidity = address(this).balance - balanceBefore;\n\n if (amountToLiquify > 0 && amountETHLiquidity > 0) {\n router.addLiquidityETH{value: amountETHLiquidity}(\n address(this),\n amountToLiquify,\n 0,\n 0,\n autoLiquidityReceiver,\n block.timestamp\n );\n }\n _lastAddLiquidityTime = block.timestamp;\n }\n\n function swapBack() internal swapping {\n uint256 amountToSwap = _gonBalances[address(this)] / _gonsPerFragment;\n\n if (amountToSwap == 0) {\n return;\n }\n\n uint256 balanceBefore = address(this).balance;\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = router.WETH();\n\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amountToSwap,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n uint256 amountETHToTreasuryAndSIF = address(this).balance -\n balanceBefore;\n\n (bool success, ) = payable(virtusTreasuryReceiver).call{\n value: (amountETHToTreasuryAndSIF * treasuryFee) /\n (treasuryFee protectionFundFee),\n gas: 30000\n }(\"\");\n (success, ) = payable(virtusProtectionFundReceiver).call{\n value: (amountETHToTreasuryAndSIF * protectionFundFee) /\n (treasuryFee protectionFundFee),\n gas: 30000\n }(\"\");\n }\n\n function withdrawAllToTreasury() external swapping onlyOwner {\n uint256 amountToSwap = _gonBalances[address(this)] / _gonsPerFragment;\n require(\n amountToSwap > 0,\n \"There is no Virtus token deposited in token contract\"\n );\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = router.WETH();\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amountToSwap,\n 0,\n path,\n virtusTreasuryReceiver,\n block.timestamp\n );\n }\n\n function shouldTakeFee(address from, address to)\n internal\n view\n returns (bool)\n {\n address pairAddress = address(pair);\n return\n (pairAddress == from || pairAddress == to) && !_isFeeExempt[from];\n }\n\n function shouldRebase() internal view returns (bool) {\n return\n _autoRebase &&\n (_totalSupply < MAX_SUPPLY) &&\n msg.sender != address(pair) &&\n !inSwap &&\n block.timestamp >= (_lastRebasedTime 10 minutes);\n }\n\n function shouldAddLiquidity() internal view returns (bool) {\n return\n _autoAddLiquidity &&\n !inSwap &&\n msg.sender != address(pair) &&\n block.timestamp >= (_lastAddLiquidityTime 2 days);\n }\n\n function shouldSwapBack() internal view returns (bool) {\n return !inSwap && msg.sender != address(pair);\n }\n\n function setAutoRebase(bool _flag) external onlyOwner {\n if (_flag) {\n _autoRebase = _flag;\n _lastRebasedTime = block.timestamp;\n } else {\n _autoRebase = _flag;\n }\n }\n\n function setAutoAddLiquidity(bool _flag) external onlyOwner {\n if (_flag) {\n _autoAddLiquidity = _flag;\n _lastAddLiquidityTime = block.timestamp;\n } else {\n _autoAddLiquidity = _flag;\n }\n }\n\n function allowance(address owner_, address spender)\n public\n view\n override\n returns (uint256)\n {\n return _allowedFragments[owner_][spender];\n }\n\n function decreaseAllowance(address spender, uint256 subtractedValue)\n public\n override\n returns (bool)\n {\n uint256 oldValue = _allowedFragments[msg.sender][spender];\n if (subtractedValue >= oldValue) {\n _allowedFragments[msg.sender][spender] = 0;\n } else {\n _allowedFragments[msg.sender][spender] = oldValue - subtractedValue;\n }\n emit Approval(\n msg.sender,\n spender,\n _allowedFragments[msg.sender][spender]\n );\n return true;\n }\n\n function increaseAllowance(address spender, uint256 addedValue)\n public\n override\n returns (bool)\n {\n _allowedFragments[msg.sender][spender] =\n _allowedFragments[msg.sender][spender] \n addedValue;\n emit Approval(\n msg.sender,\n spender,\n _allowedFragments[msg.sender][spender]\n );\n return true;\n }\n\n function approve(address spender, uint256 value)\n public\n override\n returns (bool)\n {\n _allowedFragments[msg.sender][spender] = value;\n emit Approval(msg.sender, spender, value);\n return true;\n }\n\n function checkFeeExempt(address _addr) external view returns (bool) {\n return _isFeeExempt[_addr];\n }\n\n function getCirculatingSupply() public view returns (uint256) {\n return\n (TOTAL_GONS - _gonBalances[DEAD] - _gonBalances[ZERO]) /\n _gonsPerFragment;\n }\n\n function isNotInSwap() external view returns (bool) {\n return !inSwap;\n }\n\n function manualSync() external {\n pair.sync();\n }\n\n function setFeeReceivers(\n address _autoLiquidityReceiver,\n address _treasuryReceiver,\n address _virtusProtectionFundReceiver,\n address _virtusBurner\n ) external onlyOwner {\n autoLiquidityReceiver = _autoLiquidityReceiver;\n virtusTreasuryReceiver = _treasuryReceiver;\n virtusProtectionFundReceiver = _virtusProtectionFundReceiver;\n virtusBurner = _virtusBurner;\n }\n\n function getLiquidityBacking(uint256 accuracy)\n public\n view\n returns (uint256)\n {\n uint256 liquidityBalance = _gonBalances[address(pair)] /\n _gonsPerFragment;\n return (accuracy * (liquidityBalance * 2)) / getCirculatingSupply();\n }\n\n function setWhitelist(address _addr) external onlyOwner {\n _isFeeExempt[_addr] = true;\n }\n\n function setBotBlacklist(address _botAddress, bool _flag)\n external\n onlyOwner\n {\n require(\n isContract(_botAddress),\n \"only contract address, not allowed externally owned account\"\n );\n blacklist[_botAddress] = _flag;\n }\n\n function setLP(address _address) external onlyOwner {\n pair = IUniswapV2Pair(_address);\n }\n\n function totalSupply() public view override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address who) public view override returns (uint256) {\n return _gonBalances[who] / _gonsPerFragment;\n }\n\n function isContract(address addr) internal view returns (bool) {\n uint256 size;\n assembly {\n size := extcodesize(addr)\n }\n return size > 0;\n }\n\n receive() external payable {}\n}\n"
},
"@openzeppelin/contracts/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
},
"@openzeppelin/contracts/token/ERC20/ERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, _allowances[owner][spender] addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = _allowances[owner][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] = amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply = amount;\n _balances[account] = amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Spend `amount` form the allowance of `owner` toward `spender`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n"
},
"contracts/IUniswapV2Pair.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Pair {\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function name() external pure returns (string memory);\n\n function symbol() external pure returns (string memory);\n\n function decimals() external pure returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function allowance(address owner, address spender)\n external\n view\n returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n function nonces(address owner) external view returns (uint256);\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n event Mint(address indexed sender, uint256 amount0, uint256 amount1);\n event Burn(\n address indexed sender,\n uint256 amount0,\n uint256 amount1,\n address indexed to\n );\n event Swap(\n address indexed sender,\n uint256 amount0In,\n uint256 amount1In,\n uint256 amount0Out,\n uint256 amount1Out,\n address indexed to\n );\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint256);\n\n function factory() external view returns (address);\n\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function getReserves()\n external\n view\n returns (\n uint112 reserve0,\n uint112 reserve1,\n uint32 blockTimestampLast\n );\n\n function price0CumulativeLast() external view returns (uint256);\n\n function price1CumulativeLast() external view returns (uint256);\n\n function kLast() external view returns (uint256);\n\n function mint(address to) external returns (uint256 liquidity);\n\n function burn(address to)\n external\n returns (uint256 amount0, uint256 amount1);\n\n function swap(\n uint256 amount0Out,\n uint256 amount1Out,\n address to,\n bytes calldata data\n ) external;\n\n function skim(address to) external;\n\n function sync() external;\n\n function initialize(address, address) external;\n}\n"
},
"contracts/IUniswapV2Router.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n )\n external\n returns (\n uint256 amountA,\n uint256 amountB,\n uint256 liquidity\n );\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (\n uint256 amountToken,\n uint256 amountETH,\n uint256 liquidity\n );\n\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n\n function removeLiquidityETH(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountA, uint256 amountB);\n\n function removeLiquidityETHWithPermit(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapTokensForExactTokens(\n uint256 amountOut,\n uint256 amountInMax,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapExactETHForTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n function swapTokensForExactETH(\n uint256 amountOut,\n uint256 amountInMax,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapExactTokensForETH(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapETHForExactTokens(\n uint256 amountOut,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n function quote(\n uint256 amountA,\n uint256 reserveA,\n uint256 reserveB\n ) external pure returns (uint256 amountB);\n\n function getAmountOut(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut\n ) external pure returns (uint256 amountOut);\n\n function getAmountIn(\n uint256 amountOut,\n uint256 reserveIn,\n uint256 reserveOut\n ) external pure returns (uint256 amountIn);\n\n function getAmountsOut(uint256 amountIn, address[] calldata path)\n external\n view\n returns (uint256[] memory amounts);\n\n function getAmountsIn(uint256 amountOut, address[] calldata path)\n external\n view\n returns (uint256[] memory amounts);\n}\n\ninterface IUniswapV2Router is IUniswapV2Router01 {\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountETH);\n\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountETH);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable;\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n"
},
"contracts/IUniswapV2Factory.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Factory {\n event PairCreated(\n address indexed token0,\n address indexed token1,\n address pair,\n uint256\n );\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(address tokenA, address tokenB)\n external\n view\n returns (address pair);\n\n function allPairs(uint256) external view returns (address pair);\n\n function allPairsLength() external view returns (uint256);\n\n function createPair(address tokenA, address tokenB)\n external\n returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n"
},
"@openzeppelin/contracts/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n"
},
"@openzeppelin/contracts/token/ERC20/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n"
},
"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}}
"language": "Solidity",
"sources": {
"contracts/VirtusFinance.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\nimport \"./IUniswapV2Pair.sol\";\nimport \"./IUniswapV2Router.sol\";\nimport \"./IUniswapV2Factory.sol\";\n\ncontract VirtusFinance is ERC20, Ownable {\n event LogRebase(uint256 indexed epoch, uint256 totalSupply);\n\n uint256 public constant MAX_UINT256 = type(uint256).max;\n address private constant DEAD = 0x000000000000000000000000000000000000dEaD;\n address private constant ZERO = 0x0000000000000000000000000000000000000000;\n uint256 public constant DECIMALS = 5;\n uint8 public constant RATE_DECIMALS = 7;\n\n uint256 private constant INITIAL_FRAGMENTS_SUPPLY = 500_000 * 10**DECIMALS;\n uint256 private constant MAX_SUPPLY = 5_000_000_000 * 10**DECIMALS;\n\n string private _name = \"Virtus Finance\";\n string private _symbol = \"VAP\";\n\n IUniswapV2Pair public pair;\n mapping(address => bool) private _isFeeExempt;\n\n uint256 public liquidityFee = 30;\n uint256 public treasuryFee = 30;\n uint256 public protectionFundFee = 50;\n uint256 public sellFee = 20;\n uint256 public burnFee = 25;\n uint256 public totalFee =\n liquidityFee treasuryFee protectionFundFee burnFee;\n uint256 public feeDenominator = 1000;\n\n address public autoLiquidityReceiver;\n address public virtusTreasuryReceiver;\n address public virtusProtectionFundReceiver;\n address public virtusBurner;\n bool public swapEnabled = true;\n IUniswapV2Router public router;\n bool private inSwap = false;\n\n uint256 private constant TOTAL_GONS =\n MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY);\n\n bool public _autoRebase;\n bool public _autoAddLiquidity;\n uint256 public _initRebaseStartTime;\n uint256 public _lastRebasedTime;\n uint256 public _lastAddLiquidityTime;\n uint256 public _totalSupply;\n uint256 private _gonsPerFragment;\n\n mapping(address => uint256) private _gonBalances;\n mapping(address => mapping(address => uint256)) private _allowedFragments;\n mapping(address => bool) public blacklist;\n\n modifier swapping() {\n inSwap = true;\n _;\n inSwap = false;\n }\n\n modifier validRecipient(address to) {\n require(to != address(0), \"Cannot transfer to address 0\");\n _;\n }\n\n constructor(address _router) ERC20(_name, _symbol) Ownable() {\n router = IUniswapV2Router(_router);\n address pairAddress = IUniswapV2Factory(router.factory()).createPair(\n router.WETH(),\n address(this)\n );\n\n autoLiquidityReceiver = 0xAB14Ce87BFc7290fc69BdA909817a18e513827cA;\n virtusTreasuryReceiver = 0xe81AB1DF23E21BcA12e5b89CA708Da6Ad78aBab6;\n virtusProtectionFundReceiver = 0x0f8D05230F3ffAa0a989585729F5c2fa587Cf13c;\n virtusBurner = 0xf39f309C352e541462cf15E744BD4C668E1111a3;\n\n _allowedFragments[address(this)][address(router)] = MAX_UINT256;\n pair = IUniswapV2Pair(pairAddress);\n\n _totalSupply = INITIAL_FRAGMENTS_SUPPLY;\n _gonBalances[virtusTreasuryReceiver] = TOTAL_GONS;\n _gonsPerFragment = TOTAL_GONS / _totalSupply;\n _initRebaseStartTime = block.timestamp;\n _lastRebasedTime = block.timestamp;\n _autoRebase = true;\n _autoAddLiquidity = true;\n _isFeeExempt[virtusTreasuryReceiver] = true;\n _isFeeExempt[address(this)] = true;\n\n _transferOwnership(virtusTreasuryReceiver);\n emit Transfer(ZERO, virtusTreasuryReceiver, _totalSupply);\n }\n\n function decimals() public view virtual override returns (uint8) {\n return uint8(DECIMALS);\n }\n\n function rebase() internal {\n if (inSwap) return;\n uint256 rebaseRate;\n uint256 deltaTimeFromInit = block.timestamp - _initRebaseStartTime;\n uint256 deltaTime = block.timestamp - _lastRebasedTime;\n uint256 times = deltaTime / 10 minutes;\n\n if (deltaTimeFromInit < (365 days)) {\n rebaseRate = 1583;\n } else if (deltaTimeFromInit >= (365 days)) {\n rebaseRate = 256;\n } else if (deltaTimeFromInit >= ((15 * 365 days) / 10)) {\n rebaseRate = 16;\n } else if (deltaTimeFromInit >= (7 * 365 days)) {\n rebaseRate = 4;\n }\n\n uint256 numerator = 10**RATE_DECIMALS rebaseRate;\n\n for (uint256 i = 0; i < times; i ) {\n _totalSupply = (_totalSupply * numerator) / (10**RATE_DECIMALS);\n }\n\n _gonsPerFragment = TOTAL_GONS / _totalSupply;\n _lastRebasedTime = _lastRebasedTime (times * 10 minutes);\n\n pair.sync();\n\n emit LogRebase(_lastRebasedTime, _totalSupply);\n }\n\n function transfer(address to, uint256 value)\n public\n override\n validRecipient(to)\n returns (bool)\n {\n _transferFrom(msg.sender, to, value);\n return true;\n }\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) public override validRecipient(to) returns (bool) {\n uint256 currentAllowance = _allowedFragments[from][msg.sender];\n if (currentAllowance != MAX_UINT256) {\n require(currentAllowance >= value, \"Insufficient allowance\");\n _allowedFragments[from][msg.sender] = currentAllowance - value;\n }\n _transferFrom(from, to, value);\n return true;\n }\n\n function _basicTransfer(\n address from,\n address to,\n uint256 amount\n ) internal returns (bool) {\n uint256 gonAmount = amount * _gonsPerFragment;\n _gonBalances[from] = _gonBalances[from] - gonAmount;\n _gonBalances[to] = _gonBalances[to] gonAmount;\n return true;\n }\n\n function _transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) internal returns (bool) {\n require(!blacklist[sender] && !blacklist[recipient], \"Blacklisted\");\n\n if (inSwap) {\n return _basicTransfer(sender, recipient, amount);\n }\n if (shouldRebase()) {\n rebase();\n }\n\n if (shouldAddLiquidity()) {\n addLiquidity();\n }\n\n if (shouldSwapBack()) {\n swapBack();\n }\n\n uint256 gonAmount = amount * _gonsPerFragment;\n _gonBalances[sender] = _gonBalances[sender] - gonAmount;\n uint256 gonAmountReceived = shouldTakeFee(sender, recipient)\n ? takeFee(sender, recipient, gonAmount)\n : gonAmount;\n _gonBalances[recipient] = _gonBalances[recipient] gonAmountReceived;\n\n emit Transfer(sender, recipient, gonAmountReceived / _gonsPerFragment);\n return true;\n }\n\n function takeFee(\n address sender,\n address recipient,\n uint256 gonAmount\n ) internal returns (uint256) {\n uint256 _totalFee = totalFee;\n uint256 _treasuryFee = treasuryFee;\n\n if (recipient == address(pair)) {\n _totalFee = totalFee sellFee;\n _treasuryFee = treasuryFee sellFee;\n }\n\n uint256 feeAmount = (gonAmount / feeDenominator) * _totalFee;\n\n _gonBalances[virtusBurner] =\n _gonBalances[virtusBurner] \n ((gonAmount / feeDenominator) * burnFee);\n\n _gonBalances[address(this)] =\n _gonBalances[address(this)] \n ((gonAmount / feeDenominator) * (_treasuryFee protectionFundFee));\n\n _gonBalances[autoLiquidityReceiver] =\n _gonBalances[autoLiquidityReceiver] \n ((gonAmount / feeDenominator) * liquidityFee);\n\n emit Transfer(sender, address(this), feeAmount / _gonsPerFragment);\n return gonAmount - feeAmount;\n }\n\n function addLiquidity() internal swapping {\n uint256 autoLiquidityAmount = _gonBalances[autoLiquidityReceiver] /\n _gonsPerFragment;\n _gonBalances[address(this)] =\n _gonBalances[address(this)] \n _gonBalances[autoLiquidityReceiver];\n _gonBalances[autoLiquidityReceiver] = 0;\n uint256 amountToLiquify = autoLiquidityAmount / 2;\n uint256 amountToSwap = autoLiquidityAmount - amountToLiquify;\n\n if (amountToSwap == 0) {\n return;\n }\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = router.WETH();\n\n uint256 balanceBefore = address(this).balance;\n\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amountToSwap,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n uint256 amountETHLiquidity = address(this).balance - balanceBefore;\n\n if (amountToLiquify > 0 && amountETHLiquidity > 0) {\n router.addLiquidityETH{value: amountETHLiquidity}(\n address(this),\n amountToLiquify,\n 0,\n 0,\n autoLiquidityReceiver,\n block.timestamp\n );\n }\n _lastAddLiquidityTime = block.timestamp;\n }\n\n function swapBack() internal swapping {\n uint256 amountToSwap = _gonBalances[address(this)] / _gonsPerFragment;\n\n if (amountToSwap == 0) {\n return;\n }\n\n uint256 balanceBefore = address(this).balance;\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = router.WETH();\n\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amountToSwap,\n 0,\n path,\n address(this),\n block.timestamp\n );\n\n uint256 amountETHToTreasuryAndSIF = address(this).balance -\n balanceBefore;\n\n (bool success, ) = payable(virtusTreasuryReceiver).call{\n value: (amountETHToTreasuryAndSIF * treasuryFee) /\n (treasuryFee protectionFundFee),\n gas: 30000\n }(\"\");\n (success, ) = payable(virtusProtectionFundReceiver).call{\n value: (amountETHToTreasuryAndSIF * protectionFundFee) /\n (treasuryFee protectionFundFee),\n gas: 30000\n }(\"\");\n }\n\n function withdrawAllToTreasury() external swapping onlyOwner {\n uint256 amountToSwap = _gonBalances[address(this)] / _gonsPerFragment;\n require(\n amountToSwap > 0,\n \"There is no Virtus token deposited in token contract\"\n );\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = router.WETH();\n router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n amountToSwap,\n 0,\n path,\n virtusTreasuryReceiver,\n block.timestamp\n );\n }\n\n function shouldTakeFee(address from, address to)\n internal\n view\n returns (bool)\n {\n address pairAddress = address(pair);\n return\n (pairAddress == from || pairAddress == to) && !_isFeeExempt[from];\n }\n\n function shouldRebase() internal view returns (bool) {\n return\n _autoRebase &&\n (_totalSupply < MAX_SUPPLY) &&\n msg.sender != address(pair) &&\n !inSwap &&\n block.timestamp >= (_lastRebasedTime 10 minutes);\n }\n\n function shouldAddLiquidity() internal view returns (bool) {\n return\n _autoAddLiquidity &&\n !inSwap &&\n msg.sender != address(pair) &&\n block.timestamp >= (_lastAddLiquidityTime 2 days);\n }\n\n function shouldSwapBack() internal view returns (bool) {\n return !inSwap && msg.sender != address(pair);\n }\n\n function setAutoRebase(bool _flag) external onlyOwner {\n if (_flag) {\n _autoRebase = _flag;\n _lastRebasedTime = block.timestamp;\n } else {\n _autoRebase = _flag;\n }\n }\n\n function setAutoAddLiquidity(bool _flag) external onlyOwner {\n if (_flag) {\n _autoAddLiquidity = _flag;\n _lastAddLiquidityTime = block.timestamp;\n } else {\n _autoAddLiquidity = _flag;\n }\n }\n\n function allowance(address owner_, address spender)\n public\n view\n override\n returns (uint256)\n {\n return _allowedFragments[owner_][spender];\n }\n\n function decreaseAllowance(address spender, uint256 subtractedValue)\n public\n override\n returns (bool)\n {\n uint256 oldValue = _allowedFragments[msg.sender][spender];\n if (subtractedValue >= oldValue) {\n _allowedFragments[msg.sender][spender] = 0;\n } else {\n _allowedFragments[msg.sender][spender] = oldValue - subtractedValue;\n }\n emit Approval(\n msg.sender,\n spender,\n _allowedFragments[msg.sender][spender]\n );\n return true;\n }\n\n function increaseAllowance(address spender, uint256 addedValue)\n public\n override\n returns (bool)\n {\n _allowedFragments[msg.sender][spender] =\n _allowedFragments[msg.sender][spender] \n addedValue;\n emit Approval(\n msg.sender,\n spender,\n _allowedFragments[msg.sender][spender]\n );\n return true;\n }\n\n function approve(address spender, uint256 value)\n public\n override\n returns (bool)\n {\n _allowedFragments[msg.sender][spender] = value;\n emit Approval(msg.sender, spender, value);\n return true;\n }\n\n function checkFeeExempt(address _addr) external view returns (bool) {\n return _isFeeExempt[_addr];\n }\n\n function getCirculatingSupply() public view returns (uint256) {\n return\n (TOTAL_GONS - _gonBalances[DEAD] - _gonBalances[ZERO]) /\n _gonsPerFragment;\n }\n\n function isNotInSwap() external view returns (bool) {\n return !inSwap;\n }\n\n function manualSync() external {\n pair.sync();\n }\n\n function setFeeReceivers(\n address _autoLiquidityReceiver,\n address _treasuryReceiver,\n address _virtusProtectionFundReceiver,\n address _virtusBurner\n ) external onlyOwner {\n autoLiquidityReceiver = _autoLiquidityReceiver;\n virtusTreasuryReceiver = _treasuryReceiver;\n virtusProtectionFundReceiver = _virtusProtectionFundReceiver;\n virtusBurner = _virtusBurner;\n }\n\n function getLiquidityBacking(uint256 accuracy)\n public\n view\n returns (uint256)\n {\n uint256 liquidityBalance = _gonBalances[address(pair)] /\n _gonsPerFragment;\n return (accuracy * (liquidityBalance * 2)) / getCirculatingSupply();\n }\n\n function setWhitelist(address _addr) external onlyOwner {\n _isFeeExempt[_addr] = true;\n }\n\n function setBotBlacklist(address _botAddress, bool _flag)\n external\n onlyOwner\n {\n require(\n isContract(_botAddress),\n \"only contract address, not allowed externally owned account\"\n );\n blacklist[_botAddress] = _flag;\n }\n\n function setLP(address _address) external onlyOwner {\n pair = IUniswapV2Pair(_address);\n }\n\n function totalSupply() public view override returns (uint256) {\n return _totalSupply;\n }\n\n function balanceOf(address who) public view override returns (uint256) {\n return _gonBalances[who] / _gonsPerFragment;\n }\n\n function isContract(address addr) internal view returns (bool) {\n uint256 size;\n assembly {\n size := extcodesize(addr)\n }\n return size > 0;\n }\n\n receive() external payable {}\n}\n"
},
"@openzeppelin/contracts/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
},
"@openzeppelin/contracts/token/ERC20/ERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, _allowances[owner][spender] addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = _allowances[owner][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] = amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply = amount;\n _balances[account] = amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Spend `amount` form the allowance of `owner` toward `spender`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n"
},
"contracts/IUniswapV2Pair.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Pair {\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function name() external pure returns (string memory);\n\n function symbol() external pure returns (string memory);\n\n function decimals() external pure returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function allowance(address owner, address spender)\n external\n view\n returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transfer(address to, uint256 value) external returns (bool);\n\n function transferFrom(\n address from,\n address to,\n uint256 value\n ) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n function nonces(address owner) external view returns (uint256);\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n event Mint(address indexed sender, uint256 amount0, uint256 amount1);\n event Burn(\n address indexed sender,\n uint256 amount0,\n uint256 amount1,\n address indexed to\n );\n event Swap(\n address indexed sender,\n uint256 amount0In,\n uint256 amount1In,\n uint256 amount0Out,\n uint256 amount1Out,\n address indexed to\n );\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint256);\n\n function factory() external view returns (address);\n\n function token0() external view returns (address);\n\n function token1() external view returns (address);\n\n function getReserves()\n external\n view\n returns (\n uint112 reserve0,\n uint112 reserve1,\n uint32 blockTimestampLast\n );\n\n function price0CumulativeLast() external view returns (uint256);\n\n function price1CumulativeLast() external view returns (uint256);\n\n function kLast() external view returns (uint256);\n\n function mint(address to) external returns (uint256 liquidity);\n\n function burn(address to)\n external\n returns (uint256 amount0, uint256 amount1);\n\n function swap(\n uint256 amount0Out,\n uint256 amount1Out,\n address to,\n bytes calldata data\n ) external;\n\n function skim(address to) external;\n\n function sync() external;\n\n function initialize(address, address) external;\n}\n"
},
"contracts/IUniswapV2Router.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint256 amountADesired,\n uint256 amountBDesired,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n )\n external\n returns (\n uint256 amountA,\n uint256 amountB,\n uint256 liquidity\n );\n\n function addLiquidityETH(\n address token,\n uint256 amountTokenDesired,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n )\n external\n payable\n returns (\n uint256 amountToken,\n uint256 amountETH,\n uint256 liquidity\n );\n\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountA, uint256 amountB);\n\n function removeLiquidityETH(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint256 liquidity,\n uint256 amountAMin,\n uint256 amountBMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountA, uint256 amountB);\n\n function removeLiquidityETHWithPermit(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountToken, uint256 amountETH);\n\n function swapExactTokensForTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapTokensForExactTokens(\n uint256 amountOut,\n uint256 amountInMax,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapExactETHForTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n function swapTokensForExactETH(\n uint256 amountOut,\n uint256 amountInMax,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapExactTokensForETH(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external returns (uint256[] memory amounts);\n\n function swapETHForExactTokens(\n uint256 amountOut,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable returns (uint256[] memory amounts);\n\n function quote(\n uint256 amountA,\n uint256 reserveA,\n uint256 reserveB\n ) external pure returns (uint256 amountB);\n\n function getAmountOut(\n uint256 amountIn,\n uint256 reserveIn,\n uint256 reserveOut\n ) external pure returns (uint256 amountOut);\n\n function getAmountIn(\n uint256 amountOut,\n uint256 reserveIn,\n uint256 reserveOut\n ) external pure returns (uint256 amountIn);\n\n function getAmountsOut(uint256 amountIn, address[] calldata path)\n external\n view\n returns (uint256[] memory amounts);\n\n function getAmountsIn(uint256 amountOut, address[] calldata path)\n external\n view\n returns (uint256[] memory amounts);\n}\n\ninterface IUniswapV2Router is IUniswapV2Router01 {\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline\n ) external returns (uint256 amountETH);\n\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint256 liquidity,\n uint256 amountTokenMin,\n uint256 amountETHMin,\n address to,\n uint256 deadline,\n bool approveMax,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external returns (uint256 amountETH);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external payable;\n\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint256 amountIn,\n uint256 amountOutMin,\n address[] calldata path,\n address to,\n uint256 deadline\n ) external;\n}\n"
},
"contracts/IUniswapV2Factory.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IUniswapV2Factory {\n event PairCreated(\n address indexed token0,\n address indexed token1,\n address pair,\n uint256\n );\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(address tokenA, address tokenB)\n external\n view\n returns (address pair);\n\n function allPairs(uint256) external view returns (address pair);\n\n function allPairsLength() external view returns (uint256);\n\n function createPair(address tokenA, address tokenB)\n external\n returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n"
},
"@openzeppelin/contracts/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n"
},
"@openzeppelin/contracts/token/ERC20/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n"
},
"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}}