Token 10X: Africa's First Cryptocurrency Hub
SafeWorld Token
The first Multi-Chain, Hyper-Deflationary, Self-Farming token.
The holy grail of passive investing
With SafeWorld, you will earn rewards just by holding the token on your wallet.
Unlike traditional farms, these rewards will came from transaction tax redistributions, and not from token e...
About SafeWorld
The first Multi-Chain, Hyper-Deflationary, Self-Farming token.
The holy grail of passive investing
With SafeWorld, you will earn rewards just by holding the token on your wallet.
Unlike traditional farms, these rewards will came from transaction tax redistributions, and not from token emissions.
SafeWorld is a purely deflationary token, no new tokens can be created.
On top of this, the ecosystem incentivises recurrent burns, which in turns constantly reduces the circulating supply.
After its launch, SafeWorld will always be the core of WorldSwap's ecosystem
The holy grail of passive investing
With SafeWorld, you will earn rewards just by holding the token on your wallet.
Unlike traditional farms, these rewards will came from transaction tax redistributions, and not from token emissions.
SafeWorld is a purely deflationary token, no new tokens can be created.
On top of this, the ecosystem incentivises recurrent burns, which in turns constantly reduces the circulating supply.
After its launch, SafeWorld will always be the core of WorldSwap's ecosystem
257 total visits
Token information and links
Circulating Supply
0
Token Contract (BSC Chain)
0X8F86A822225FE5F2616CDF96697B15E8DE005FB5
Contract license:
Launch Date
06/08/2021
KYC Information
No
Audit Information
None
Team Information
Team leader: None
Team leader contact: None
Contract source code
{{
"language": "Solidity",
"sources": {
"contracts/IgoSale.sol": {
"content": "// SPDX-License-Identifier: agpl-3.0\n\npragma solidity 0.8.2;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/utils/Address.sol';\nimport '@openzeppelin/contracts/access/Ownable.sol';\nimport './interfaces/IUniswapV2Router02.sol';\nimport './interfaces/IUniswapV2Factory.sol';\nimport './interfaces/IFeeTo.sol';\n\n/**\n * @title IgoSale\n * @notice An initial offering for a single token\n * @author @IgoFinance\n **/\ncontract IgoSale is Ownable {\n using Address for address;\n\n /// @notice Sale Token\n IERC20 public token;\n\n IFeeTo public factory;\n IUniswapV2Router02 public router;\n\n /// @notice Dates can be either timestamp or blocks (depending on useBlocks)\n uint256 public startTime;\n uint256 public endTime;\n uint256 public claimTime;\n uint256 public whitelistStartTime;\n uint256 public liquidityLockTime;\n\n bool public useBlocks;\n bool public burnUnsold;\n bool public autoAddLiquidity;\n\n uint256 public softCap;\n uint256 public hardCap;\n uint256 public hardCapEth;\n uint256 public minTokens;\n uint256 public maxTokens;\n\n /// @notice Percentage of the sale used for adding liquidity (on basis points)\n uint16 public liquidityPct;\n\n uint16 public feeBP;\n uint16 public listingType;\n\n /// @notice Wheter initialize method has been called (it can only be called once)\n bool public initialized = false;\n\n bool public tokensAdded = false;\n\n bool public liquidityAdded = false;\n\n /// @notice Balance of each address on native currency\n mapping(address => uint256) public balances;\n\n /// @notice Tokens bought by each address\n mapping(address => uint256) public tokensBought;\n\n /// @notice Whitelisted addresses and max whitelisted amount\n mapping(address => uint256) public whitelists;\n\n /// @notice Generic settings for the sale (website, social networks, etc)\n mapping(string => string) public settings;\n\n /// @notice Total number of participants\n uint256 public participants;\n\n /// @notice Number of tokens sold\n uint256 public tokensSold;\n\n /// @notice Total number of tokens already claimed\n uint256 public tokensClaimed;\n\n event TokensAdded(uint256 amount);\n event TokensRemoved();\n event AddressWhitelisted(address addr, uint256 amount);\n event TokensBought(uint256 amount);\n event TokensClaimed(uint256 amount);\n event EthClaimed(uint256 balance);\n event FundsWithdrawn();\n event LiquidityWithdrawn();\n event LiquidityAdded();\n\n constructor() {\n factory = IFeeTo(msg.sender);\n }\n\n /**\n * @dev Called by IgoFactory when a new offering is created\n **/\n function initialize(\n IERC20 _token,\n address _router,\n uint256[5] memory _dates,\n uint256[3] memory _caps,\n uint256[2] memory _tokenLimits,\n uint16[3] memory _settings,\n bool[3] memory _features\n ) external onlyOwner {\n require(!initialized, 'initialize:ALREADY_INITIALIZED');\n initialized = true;\n\n token = _token;\n router = IUniswapV2Router02(_router);\n startTime = _dates[0];\n endTime = _dates[1];\n claimTime = _dates[2];\n whitelistStartTime = _dates[3];\n liquidityLockTime = _dates[4];\n useBlocks = _features[0];\n burnUnsold = _features[1];\n autoAddLiquidity = _features[2];\n softCap = _caps[0];\n hardCap = _caps[1];\n hardCapEth = _caps[2];\n minTokens = _tokenLimits[0];\n maxTokens = _tokenLimits[1];\n liquidityPct = _settings[0];\n feeBP = _settings[1];\n listingType = _settings[2];\n\n if (autoAddLiquidity) {\n address lpPair = IUniswapV2Factory(router.factory()).getPair(address(token), router.WETH());\n if (lpPair == address(0)) {\n IUniswapV2Factory(router.factory()).createPair(address(token), router.WETH());\n }\n }\n }\n\n function addTokens(uint256 _amount) external onlyOwner {\n require(!tokensAdded, 'addTokens:TOKENS_ALREADY_ADDED');\n token.transferFrom(msg.sender, address(this), _amount);\n require(\n token.balanceOf(address(this)) >= hardCap getTokensForLiquidity(hardCap),\n 'addTokens:INSUFFICIENT_BALANCE'\n );\n tokensAdded = true;\n emit TokensAdded(_amount);\n }\n\n function removeTokens() external onlyOwner {\n require(tokensAdded, 'removeTokens:TOKENS_NOT_ADDED');\n require(timeOrBlock() > startTime, 'removeTokens:ALREADY_STARTED');\n uint256 amount = hardCap getTokensForLiquidity(hardCap);\n token.transfer(msg.sender, amount);\n tokensAdded = false;\n emit TokensRemoved();\n }\n\n function whitelistAddress(address _addr, uint256 _amount) external onlyOwner {\n whitelists[_addr] = _amount;\n emit AddressWhitelisted(_addr, _amount);\n }\n\n function buyTokens() external payable {\n require(tokensAdded, 'buyTokens:TOKENS_NOT_ADDED');\n require(timeOrBlock() <= endTime, 'buyTokens:ENDED');\n\n bool started = timeOrBlock() >= startTime;\n uint256 whitelistAmount = whitelists[msg.sender];\n if (whitelistAmount == 0) {\n require(started, 'buyTokens:NOT_STARTED');\n } else {\n require(timeOrBlock() >= whitelistStartTime, 'buyTokens:WHITELIST_NOT_STARTED');\n }\n\n uint256 amount = getTokenAmount(msg.value);\n require(amount >= minTokens, 'buyTokens:LESS_THAN_MIN');\n\n if (!started) {\n require(whitelistAmount >= amount, 'buyTokens:EXCEEDS_WHITELIST');\n }\n\n uint256 currentBalance = tokensBought[msg.sender];\n require(maxTokens >= amount currentBalance, 'buyTokens:MORE_THAN_MAX');\n require(hardCap >= tokensSold amount, 'buyTokens:NOT_ENOUGH_LEFT');\n\n balances[msg.sender] = msg.value;\n tokensBought[msg.sender] = amount;\n tokensSold = amount;\n\n if (currentBalance == 0) {\n participants = 1;\n }\n\n emit TokensBought(amount);\n\n // auto-claim tokens if claiming is open\n if (isClaimOpen()) {\n claimTokens();\n }\n\n if (!started) {\n whitelists[msg.sender] -= amount;\n }\n }\n\n function claimTokens() public {\n require(isClaimOpen(), 'claimTokens:NOT_CLAIMABLE');\n if (autoAddLiquidity && !liquidityAdded) {\n _addLiquidity();\n }\n uint256 amount = getTokenAmount(balances[msg.sender]);\n balances[msg.sender] = 0;\n tokensClaimed = amount;\n token.transfer(msg.sender, amount);\n emit TokensClaimed(amount);\n }\n\n function claimEth() external {\n require(timeOrBlock() > endTime, 'claimEth:NOT_ENDED');\n require(tokensSold < softCap, 'claimEth:SOFT_CAP_REACHED');\n uint256 balance = balances[msg.sender];\n balances[msg.sender] = 0;\n payable(msg.sender).transfer(balance);\n emit EthClaimed(balance);\n }\n\n function withdrawFunds() external onlyOwner {\n require(timeOrBlock() > endTime, 'withdrawFunds:NOT_ENDED');\n require(tokensSold >= softCap, 'withdrawFunds:SOFT_CAP_NOT_REACHED');\n\n // Transfer unsold tokens to owner or dead\n uint256 unsoldTokens = token.balanceOf(address(this)) tokensClaimed - tokensSold;\n\n uint256 transferTokens = liquidityAdded ? unsoldTokens : unsoldTokens - getTokensForLiquidity(tokensSold);\n if (transferTokens > 0) {\n address transferTo = burnUnsold ? 0x000000000000000000000000000000000000dEaD : owner();\n token.transfer(transferTo, transferTokens);\n }\n\n uint256 balance = address(this).balance;\n uint256 fee = (balance * feeBP) / 10000;\n payable(factory.feeTo()).transfer(fee);\n uint256 total = balance - fee;\n uint256 ethForLiquidity = liquidityAdded ? 0 : (total * liquidityPct) / 10000;\n uint256 withdrawableEth = total - ethForLiquidity;\n payable(owner()).transfer(withdrawableEth);\n emit FundsWithdrawn();\n }\n\n function withdrawLiquidity() external onlyOwner {\n require(tokensSold >= softCap, 'withdrawLiquidity:SOFT_CAP_NOT_REACHED');\n require(timeOrBlock() >= liquidityLockTime, 'withdrawLiquidity:LOCK_NOT_ENDED');\n IERC20 lpPair = IERC20(IUniswapV2Factory(router.factory()).getPair(address(token), router.WETH()));\n uint256 lpBalance = lpPair.balanceOf(address(this));\n lpPair.transfer(msg.sender, lpBalance);\n emit LiquidityWithdrawn();\n }\n\n function addLiquidity() external {\n require(timeOrBlock() > endTime, 'addLiquidity:NOT_ENDED');\n require(tokensSold >= softCap, 'addLiquidity:SOFT_CAP_NOT_REACHED');\n require(!liquidityAdded, 'addLiquidity:ALREADY_ADDED');\n _addLiquidity();\n }\n\n function _addLiquidity() internal {\n uint256 tokensForLiquidity = getTokensForLiquidity(tokensSold);\n if (tokensForLiquidity > 0) {\n uint256 initialTokenBalance = token.balanceOf(address(this));\n token.approve(address(router), tokensForLiquidity);\n\n uint256 balance = address(this).balance;\n uint256 initialEth = balance - (balance * feeBP) / 10000;\n uint256 ethForLiquidity = (initialEth * liquidityPct) / 10000;\n uint256 withdrawableEth = initialEth - ethForLiquidity;\n\n // add the liquidity\n router.addLiquidityETH{value: ethForLiquidity}(\n address(token),\n tokensForLiquidity,\n 0,\n 0,\n address(this),\n block.timestamp\n );\n\n uint256 ethLiquidityLeft = address(this).balance - withdrawableEth;\n uint256 ethToSwap = ethLiquidityLeft / 2;\n\n if (ethToSwap > 0) {\n address[] memory tradePath = new address[](2);\n tradePath[0] = router.WETH();\n tradePath[1] = address(token);\n router.swapExactETHForTokens{value: ethToSwap}(0, tradePath, address(this), block.timestamp);\n uint256 restTokensForLiquidity = initialTokenBalance - token.balanceOf(address(this));\n token.approve(address(router), restTokensForLiquidity);\n router.addLiquidityETH{value: ethToSwap}(\n address(token),\n restTokensForLiquidity,\n 0,\n 0,\n address(this),\n block.timestamp\n );\n }\n }\n liquidityAdded = true;\n emit LiquidityAdded();\n }\n\n function set(string memory _key, string memory _value) external onlyOwner {\n settings[_key] = _value;\n }\n\n function multiSet(string[2][] memory values) external onlyOwner {\n for (uint256 i = 0; i < values.length; i ) {\n settings[values[i][0]] = values[i][1];\n }\n }\n\n function isClaimOpen() public view returns (bool) {\n return timeOrBlock() >= claimTime && tokensSold >= softCap;\n }\n\n function getTokensForLiquidity(uint256 tokens) private view returns (uint256) {\n return (tokens * liquidityPct) / 10000;\n }\n\n function getTokenAmount(uint256 _ethValue) private view returns (uint256) {\n if (hardCapEth > 0) {\n return (_ethValue * hardCap) / hardCapEth;\n }\n uint256 whitelistAmount = whitelists[msg.sender];\n return startTime > timeOrBlock() ? whitelistAmount : maxTokens - tokensBought[msg.sender];\n }\n\n function timeOrBlock() private view returns (uint256) {\n return useBlocks ? block.number : block.timestamp;\n }\n}\n"
},
"@openzeppelin/contracts/token/ERC20/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\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 `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, 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 `sender` to `recipient` 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(address sender, address recipient, uint256 amount) 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/utils/Address.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{ value: amount }(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain`call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.staticcall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n"
},
"@openzeppelin/contracts/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\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 address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), 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 emit OwnershipTransferred(_owner, address(0));\n _owner = 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 emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n"
},
"contracts/interfaces/IUniswapV2Router02.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport './IUniswapV2Router01.sol';\n\ninterface IUniswapV2Router02 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/interfaces/IUniswapV2Factory.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\ninterface IUniswapV2Factory {\n event PairCreated(address indexed token0, address indexed token1, address pair, uint256);\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(address tokenA, address tokenB) external view 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) external returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n"
},
"contracts/interfaces/IFeeTo.sol": {
"content": "// SPDX-License-Identifier: agpl-3.0\n\npragma solidity 0.8.2;\n\ninterface IFeeTo {\n function feeTo() external view returns (address);\n}\n"
},
"@openzeppelin/contracts/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\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 this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n"
},
"contracts/interfaces/IUniswapV2Router01.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\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) external view returns (uint256[] memory amounts);\n\n function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts);\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"abi"
]
}
},
"libraries": {}
}
}}
"language": "Solidity",
"sources": {
"contracts/IgoSale.sol": {
"content": "// SPDX-License-Identifier: agpl-3.0\n\npragma solidity 0.8.2;\n\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport '@openzeppelin/contracts/utils/Address.sol';\nimport '@openzeppelin/contracts/access/Ownable.sol';\nimport './interfaces/IUniswapV2Router02.sol';\nimport './interfaces/IUniswapV2Factory.sol';\nimport './interfaces/IFeeTo.sol';\n\n/**\n * @title IgoSale\n * @notice An initial offering for a single token\n * @author @IgoFinance\n **/\ncontract IgoSale is Ownable {\n using Address for address;\n\n /// @notice Sale Token\n IERC20 public token;\n\n IFeeTo public factory;\n IUniswapV2Router02 public router;\n\n /// @notice Dates can be either timestamp or blocks (depending on useBlocks)\n uint256 public startTime;\n uint256 public endTime;\n uint256 public claimTime;\n uint256 public whitelistStartTime;\n uint256 public liquidityLockTime;\n\n bool public useBlocks;\n bool public burnUnsold;\n bool public autoAddLiquidity;\n\n uint256 public softCap;\n uint256 public hardCap;\n uint256 public hardCapEth;\n uint256 public minTokens;\n uint256 public maxTokens;\n\n /// @notice Percentage of the sale used for adding liquidity (on basis points)\n uint16 public liquidityPct;\n\n uint16 public feeBP;\n uint16 public listingType;\n\n /// @notice Wheter initialize method has been called (it can only be called once)\n bool public initialized = false;\n\n bool public tokensAdded = false;\n\n bool public liquidityAdded = false;\n\n /// @notice Balance of each address on native currency\n mapping(address => uint256) public balances;\n\n /// @notice Tokens bought by each address\n mapping(address => uint256) public tokensBought;\n\n /// @notice Whitelisted addresses and max whitelisted amount\n mapping(address => uint256) public whitelists;\n\n /// @notice Generic settings for the sale (website, social networks, etc)\n mapping(string => string) public settings;\n\n /// @notice Total number of participants\n uint256 public participants;\n\n /// @notice Number of tokens sold\n uint256 public tokensSold;\n\n /// @notice Total number of tokens already claimed\n uint256 public tokensClaimed;\n\n event TokensAdded(uint256 amount);\n event TokensRemoved();\n event AddressWhitelisted(address addr, uint256 amount);\n event TokensBought(uint256 amount);\n event TokensClaimed(uint256 amount);\n event EthClaimed(uint256 balance);\n event FundsWithdrawn();\n event LiquidityWithdrawn();\n event LiquidityAdded();\n\n constructor() {\n factory = IFeeTo(msg.sender);\n }\n\n /**\n * @dev Called by IgoFactory when a new offering is created\n **/\n function initialize(\n IERC20 _token,\n address _router,\n uint256[5] memory _dates,\n uint256[3] memory _caps,\n uint256[2] memory _tokenLimits,\n uint16[3] memory _settings,\n bool[3] memory _features\n ) external onlyOwner {\n require(!initialized, 'initialize:ALREADY_INITIALIZED');\n initialized = true;\n\n token = _token;\n router = IUniswapV2Router02(_router);\n startTime = _dates[0];\n endTime = _dates[1];\n claimTime = _dates[2];\n whitelistStartTime = _dates[3];\n liquidityLockTime = _dates[4];\n useBlocks = _features[0];\n burnUnsold = _features[1];\n autoAddLiquidity = _features[2];\n softCap = _caps[0];\n hardCap = _caps[1];\n hardCapEth = _caps[2];\n minTokens = _tokenLimits[0];\n maxTokens = _tokenLimits[1];\n liquidityPct = _settings[0];\n feeBP = _settings[1];\n listingType = _settings[2];\n\n if (autoAddLiquidity) {\n address lpPair = IUniswapV2Factory(router.factory()).getPair(address(token), router.WETH());\n if (lpPair == address(0)) {\n IUniswapV2Factory(router.factory()).createPair(address(token), router.WETH());\n }\n }\n }\n\n function addTokens(uint256 _amount) external onlyOwner {\n require(!tokensAdded, 'addTokens:TOKENS_ALREADY_ADDED');\n token.transferFrom(msg.sender, address(this), _amount);\n require(\n token.balanceOf(address(this)) >= hardCap getTokensForLiquidity(hardCap),\n 'addTokens:INSUFFICIENT_BALANCE'\n );\n tokensAdded = true;\n emit TokensAdded(_amount);\n }\n\n function removeTokens() external onlyOwner {\n require(tokensAdded, 'removeTokens:TOKENS_NOT_ADDED');\n require(timeOrBlock() > startTime, 'removeTokens:ALREADY_STARTED');\n uint256 amount = hardCap getTokensForLiquidity(hardCap);\n token.transfer(msg.sender, amount);\n tokensAdded = false;\n emit TokensRemoved();\n }\n\n function whitelistAddress(address _addr, uint256 _amount) external onlyOwner {\n whitelists[_addr] = _amount;\n emit AddressWhitelisted(_addr, _amount);\n }\n\n function buyTokens() external payable {\n require(tokensAdded, 'buyTokens:TOKENS_NOT_ADDED');\n require(timeOrBlock() <= endTime, 'buyTokens:ENDED');\n\n bool started = timeOrBlock() >= startTime;\n uint256 whitelistAmount = whitelists[msg.sender];\n if (whitelistAmount == 0) {\n require(started, 'buyTokens:NOT_STARTED');\n } else {\n require(timeOrBlock() >= whitelistStartTime, 'buyTokens:WHITELIST_NOT_STARTED');\n }\n\n uint256 amount = getTokenAmount(msg.value);\n require(amount >= minTokens, 'buyTokens:LESS_THAN_MIN');\n\n if (!started) {\n require(whitelistAmount >= amount, 'buyTokens:EXCEEDS_WHITELIST');\n }\n\n uint256 currentBalance = tokensBought[msg.sender];\n require(maxTokens >= amount currentBalance, 'buyTokens:MORE_THAN_MAX');\n require(hardCap >= tokensSold amount, 'buyTokens:NOT_ENOUGH_LEFT');\n\n balances[msg.sender] = msg.value;\n tokensBought[msg.sender] = amount;\n tokensSold = amount;\n\n if (currentBalance == 0) {\n participants = 1;\n }\n\n emit TokensBought(amount);\n\n // auto-claim tokens if claiming is open\n if (isClaimOpen()) {\n claimTokens();\n }\n\n if (!started) {\n whitelists[msg.sender] -= amount;\n }\n }\n\n function claimTokens() public {\n require(isClaimOpen(), 'claimTokens:NOT_CLAIMABLE');\n if (autoAddLiquidity && !liquidityAdded) {\n _addLiquidity();\n }\n uint256 amount = getTokenAmount(balances[msg.sender]);\n balances[msg.sender] = 0;\n tokensClaimed = amount;\n token.transfer(msg.sender, amount);\n emit TokensClaimed(amount);\n }\n\n function claimEth() external {\n require(timeOrBlock() > endTime, 'claimEth:NOT_ENDED');\n require(tokensSold < softCap, 'claimEth:SOFT_CAP_REACHED');\n uint256 balance = balances[msg.sender];\n balances[msg.sender] = 0;\n payable(msg.sender).transfer(balance);\n emit EthClaimed(balance);\n }\n\n function withdrawFunds() external onlyOwner {\n require(timeOrBlock() > endTime, 'withdrawFunds:NOT_ENDED');\n require(tokensSold >= softCap, 'withdrawFunds:SOFT_CAP_NOT_REACHED');\n\n // Transfer unsold tokens to owner or dead\n uint256 unsoldTokens = token.balanceOf(address(this)) tokensClaimed - tokensSold;\n\n uint256 transferTokens = liquidityAdded ? unsoldTokens : unsoldTokens - getTokensForLiquidity(tokensSold);\n if (transferTokens > 0) {\n address transferTo = burnUnsold ? 0x000000000000000000000000000000000000dEaD : owner();\n token.transfer(transferTo, transferTokens);\n }\n\n uint256 balance = address(this).balance;\n uint256 fee = (balance * feeBP) / 10000;\n payable(factory.feeTo()).transfer(fee);\n uint256 total = balance - fee;\n uint256 ethForLiquidity = liquidityAdded ? 0 : (total * liquidityPct) / 10000;\n uint256 withdrawableEth = total - ethForLiquidity;\n payable(owner()).transfer(withdrawableEth);\n emit FundsWithdrawn();\n }\n\n function withdrawLiquidity() external onlyOwner {\n require(tokensSold >= softCap, 'withdrawLiquidity:SOFT_CAP_NOT_REACHED');\n require(timeOrBlock() >= liquidityLockTime, 'withdrawLiquidity:LOCK_NOT_ENDED');\n IERC20 lpPair = IERC20(IUniswapV2Factory(router.factory()).getPair(address(token), router.WETH()));\n uint256 lpBalance = lpPair.balanceOf(address(this));\n lpPair.transfer(msg.sender, lpBalance);\n emit LiquidityWithdrawn();\n }\n\n function addLiquidity() external {\n require(timeOrBlock() > endTime, 'addLiquidity:NOT_ENDED');\n require(tokensSold >= softCap, 'addLiquidity:SOFT_CAP_NOT_REACHED');\n require(!liquidityAdded, 'addLiquidity:ALREADY_ADDED');\n _addLiquidity();\n }\n\n function _addLiquidity() internal {\n uint256 tokensForLiquidity = getTokensForLiquidity(tokensSold);\n if (tokensForLiquidity > 0) {\n uint256 initialTokenBalance = token.balanceOf(address(this));\n token.approve(address(router), tokensForLiquidity);\n\n uint256 balance = address(this).balance;\n uint256 initialEth = balance - (balance * feeBP) / 10000;\n uint256 ethForLiquidity = (initialEth * liquidityPct) / 10000;\n uint256 withdrawableEth = initialEth - ethForLiquidity;\n\n // add the liquidity\n router.addLiquidityETH{value: ethForLiquidity}(\n address(token),\n tokensForLiquidity,\n 0,\n 0,\n address(this),\n block.timestamp\n );\n\n uint256 ethLiquidityLeft = address(this).balance - withdrawableEth;\n uint256 ethToSwap = ethLiquidityLeft / 2;\n\n if (ethToSwap > 0) {\n address[] memory tradePath = new address[](2);\n tradePath[0] = router.WETH();\n tradePath[1] = address(token);\n router.swapExactETHForTokens{value: ethToSwap}(0, tradePath, address(this), block.timestamp);\n uint256 restTokensForLiquidity = initialTokenBalance - token.balanceOf(address(this));\n token.approve(address(router), restTokensForLiquidity);\n router.addLiquidityETH{value: ethToSwap}(\n address(token),\n restTokensForLiquidity,\n 0,\n 0,\n address(this),\n block.timestamp\n );\n }\n }\n liquidityAdded = true;\n emit LiquidityAdded();\n }\n\n function set(string memory _key, string memory _value) external onlyOwner {\n settings[_key] = _value;\n }\n\n function multiSet(string[2][] memory values) external onlyOwner {\n for (uint256 i = 0; i < values.length; i ) {\n settings[values[i][0]] = values[i][1];\n }\n }\n\n function isClaimOpen() public view returns (bool) {\n return timeOrBlock() >= claimTime && tokensSold >= softCap;\n }\n\n function getTokensForLiquidity(uint256 tokens) private view returns (uint256) {\n return (tokens * liquidityPct) / 10000;\n }\n\n function getTokenAmount(uint256 _ethValue) private view returns (uint256) {\n if (hardCapEth > 0) {\n return (_ethValue * hardCap) / hardCapEth;\n }\n uint256 whitelistAmount = whitelists[msg.sender];\n return startTime > timeOrBlock() ? whitelistAmount : maxTokens - tokensBought[msg.sender];\n }\n\n function timeOrBlock() private view returns (uint256) {\n return useBlocks ? block.number : block.timestamp;\n }\n}\n"
},
"@openzeppelin/contracts/token/ERC20/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\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 `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, 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 `sender` to `recipient` 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(address sender, address recipient, uint256 amount) 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/utils/Address.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{ value: amount }(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain`call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.staticcall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n"
},
"@openzeppelin/contracts/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\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 address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), 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 emit OwnershipTransferred(_owner, address(0));\n _owner = 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 emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n"
},
"contracts/interfaces/IUniswapV2Router02.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\nimport './IUniswapV2Router01.sol';\n\ninterface IUniswapV2Router02 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/interfaces/IUniswapV2Factory.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\n\ninterface IUniswapV2Factory {\n event PairCreated(address indexed token0, address indexed token1, address pair, uint256);\n\n function feeTo() external view returns (address);\n\n function feeToSetter() external view returns (address);\n\n function getPair(address tokenA, address tokenB) external view 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) external returns (address pair);\n\n function setFeeTo(address) external;\n\n function setFeeToSetter(address) external;\n}\n"
},
"contracts/interfaces/IFeeTo.sol": {
"content": "// SPDX-License-Identifier: agpl-3.0\n\npragma solidity 0.8.2;\n\ninterface IFeeTo {\n function feeTo() external view returns (address);\n}\n"
},
"@openzeppelin/contracts/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\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 this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n"
},
"contracts/interfaces/IUniswapV2Router01.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.2;\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) external view returns (uint256[] memory amounts);\n\n function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts);\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"abi"
]
}
},
"libraries": {}
}
}}