|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.13;
|
|
|
|
|
|
|
|
interface IERC20 {
|
|
function totalSupply() external view returns (uint256);
|
|
function decimals() external view returns (uint8);
|
|
function symbol() external view returns (string memory);
|
|
function name() external view returns (string memory);
|
|
function getOwner() external view returns (address);
|
|
function balanceOf(address account) external view returns (uint256);
|
|
function transfer(address recipient, uint256 amount) external returns (bool);
|
|
function allowance(address _owner, address spender) external view returns (uint256);
|
|
function approve(address spender, uint256 amount) external returns (bool);
|
|
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
|
|
event Transfer(address indexed from, address indexed to, uint256 value);
|
|
event Approval(address indexed owner, address indexed spender, uint256 value);
|
|
}
|
|
|
|
|
|
interface IUniswapV2ERC20 {
|
|
event Approval(address indexed owner, address indexed spender, uint value);
|
|
event Transfer(address indexed from, address indexed to, uint value);
|
|
|
|
function name() external pure returns (string memory);
|
|
function symbol() external pure returns (string memory);
|
|
function decimals() external pure returns (uint8);
|
|
function totalSupply() external view returns (uint);
|
|
function balanceOf(address owner) external view returns (uint);
|
|
function allowance(address owner, address spender) external view returns (uint);
|
|
function approve(address spender, uint value) external returns (bool);
|
|
function transfer(address to, uint value) external returns (bool);
|
|
function transferFrom(address from, address to, uint value) external returns (bool);
|
|
function DOMAIN_SEPARATOR() external view returns (bytes32);
|
|
function PERMIT_TYPEHASH() external pure returns (bytes32);
|
|
function nonces(address owner) external view returns (uint);
|
|
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
|
|
}
|
|
|
|
interface IUniswapV2Factory {
|
|
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
|
|
|
|
function feeTo() external view returns (address);
|
|
function feeToSetter() external view returns (address);
|
|
function getPair(address tokenA, address tokenB) external view returns (address pair);
|
|
function allPairs(uint) external view returns (address pair);
|
|
function allPairsLength() external view returns (uint);
|
|
function createPair(address tokenA, address tokenB) external returns (address pair);
|
|
function setFeeTo(address) external;
|
|
function setFeeToSetter(address) external;
|
|
}
|
|
|
|
interface IUniswapV2Router01 {
|
|
function addLiquidity(
|
|
address tokenA,
|
|
address tokenB,
|
|
uint amountADesired,
|
|
uint amountBDesired,
|
|
uint amountAMin,
|
|
uint amountBMin,
|
|
address to,
|
|
uint deadline
|
|
) external returns (uint amountA, uint amountB, uint liquidity);
|
|
function addLiquidityETH(
|
|
address token,
|
|
uint amountTokenDesired,
|
|
uint amountTokenMin,
|
|
uint amountETHMin,
|
|
address to,
|
|
uint deadline
|
|
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
|
|
function removeLiquidity(
|
|
address tokenA,
|
|
address tokenB,
|
|
uint liquidity,
|
|
uint amountAMin,
|
|
uint amountBMin,
|
|
address to,
|
|
uint deadline
|
|
) external returns (uint amountA, uint amountB);
|
|
function removeLiquidityETH(
|
|
address token,
|
|
uint liquidity,
|
|
uint amountTokenMin,
|
|
uint amountETHMin,
|
|
address to,
|
|
uint deadline
|
|
) external returns (uint amountToken, uint amountETH);
|
|
function removeLiquidityWithPermit(
|
|
address tokenA,
|
|
address tokenB,
|
|
uint liquidity,
|
|
uint amountAMin,
|
|
uint amountBMin,
|
|
address to,
|
|
uint deadline,
|
|
bool approveMax, uint8 v, bytes32 r, bytes32 s
|
|
) external returns (uint amountA, uint amountB);
|
|
function removeLiquidityETHWithPermit(
|
|
address token,
|
|
uint liquidity,
|
|
uint amountTokenMin,
|
|
uint amountETHMin,
|
|
address to,
|
|
uint deadline,
|
|
bool approveMax, uint8 v, bytes32 r, bytes32 s
|
|
) external returns (uint amountToken, uint amountETH);
|
|
function swapExactTokensForTokens(
|
|
uint amountIn,
|
|
uint amountOutMin,
|
|
address[] calldata path,
|
|
address to,
|
|
uint deadline
|
|
) external returns (uint[] memory amounts);
|
|
function swapTokensForExactTokens(
|
|
uint amountOut,
|
|
uint amountInMax,
|
|
address[] calldata path,
|
|
address to,
|
|
uint deadline
|
|
) external returns (uint[] memory amounts);
|
|
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
|
|
external
|
|
payable
|
|
returns (uint[] memory amounts);
|
|
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
|
|
external
|
|
returns (uint[] memory amounts);
|
|
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
|
|
external
|
|
returns (uint[] memory amounts);
|
|
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
|
|
external
|
|
payable
|
|
returns (uint[] memory amounts);
|
|
|
|
function factory() external pure returns (address);
|
|
function WETH() external pure returns (address);
|
|
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
|
|
function getamountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
|
|
function getamountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
|
|
function getamountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
|
|
function getamountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
|
|
}
|
|
|
|
interface IUniswapV2Router02 is IUniswapV2Router01 {
|
|
function removeLiquidityETHSupportingFeeOnTransferTokens(
|
|
address token,
|
|
uint liquidity,
|
|
uint amountTokenMin,
|
|
uint amountETHMin,
|
|
address to,
|
|
uint deadline
|
|
) external returns (uint amountETH);
|
|
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
|
|
address token,
|
|
uint liquidity,
|
|
uint amountTokenMin,
|
|
uint amountETHMin,
|
|
address to,
|
|
uint deadline,
|
|
bool approveMax, uint8 v, bytes32 r, bytes32 s
|
|
) external returns (uint amountETH);
|
|
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
|
|
uint amountIn,
|
|
uint amountOutMin,
|
|
address[] calldata path,
|
|
address to,
|
|
uint deadline
|
|
) external;
|
|
function swapExactETHForTokensSupportingFeeOnTransferTokens(
|
|
uint amountOutMin,
|
|
address[] calldata path,
|
|
address to,
|
|
uint deadline
|
|
) external payable;
|
|
function swapExactTokensForETHSupportingFeeOnTransferTokens(
|
|
uint amountIn,
|
|
uint amountOutMin,
|
|
address[] calldata path,
|
|
address to,
|
|
uint deadline
|
|
) external;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract contract Ownable {
|
|
address private _owner;
|
|
|
|
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
|
|
|
|
|
|
|
|
|
|
constructor () {
|
|
address msgSender = msg.sender;
|
|
_owner = msgSender;
|
|
emit OwnershipTransferred(address(0), msgSender);
|
|
}
|
|
|
|
|
|
|
|
|
|
function owner() public view returns (address) {
|
|
return _owner;
|
|
}
|
|
|
|
|
|
|
|
|
|
modifier onlyOwner() {
|
|
require(owner() == msg.sender, "Ownable: caller is not the owner");
|
|
_;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function renounceOwnership() public onlyOwner {
|
|
emit OwnershipTransferred(_owner, address(0));
|
|
_owner = address(0);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function transferOwnership(address newOwner) public onlyOwner {
|
|
require(newOwner != address(0), "Ownable: new owner is the zero address");
|
|
emit OwnershipTransferred(_owner, newOwner);
|
|
_owner = newOwner;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
library Address {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isContract(address account) internal view returns (bool) {
|
|
|
|
|
|
|
|
|
|
uint256 size;
|
|
|
|
assembly { size := extcodesize(account) }
|
|
return size > 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sendValue(address payable recipient, uint256 amount) internal {
|
|
require(address(this).balance >= amount, "Address: insufficient balance");
|
|
|
|
|
|
(bool success, ) = recipient.call{ value: amount }("");
|
|
require(success, "Address: unable to send value, recipient may have reverted");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
|
|
return functionCall(target, data, "Address: low-level call failed");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
|
|
return functionCallWithValue(target, data, 0, errorMessage);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
|
|
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
|
|
require(address(this).balance >= value, "Address: insufficient balance for call");
|
|
require(isContract(target), "Address: call to non-contract");
|
|
|
|
|
|
(bool success, bytes memory returndata) = target.call{ value: value }(data);
|
|
return _verifyCallResult(success, returndata, errorMessage);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
|
|
return functionStaticCall(target, data, "Address: low-level static call failed");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
|
|
require(isContract(target), "Address: static call to non-contract");
|
|
|
|
|
|
(bool success, bytes memory returndata) = target.staticcall(data);
|
|
return _verifyCallResult(success, returndata, errorMessage);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
|
|
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
|
|
require(isContract(target), "Address: delegate call to non-contract");
|
|
|
|
|
|
(bool success, bytes memory returndata) = target.delegatecall(data);
|
|
return _verifyCallResult(success, returndata, errorMessage);
|
|
}
|
|
|
|
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
|
|
if (success) {
|
|
return returndata;
|
|
} else {
|
|
|
|
if (returndata.length > 0) {
|
|
|
|
|
|
|
|
assembly {
|
|
let returndata_size := mload(returndata)
|
|
revert(add(32, returndata), returndata_size)
|
|
}
|
|
} else {
|
|
revert(errorMessage);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
library EnumerableSet {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Set {
|
|
|
|
bytes32[] _values;
|
|
|
|
|
|
|
|
mapping (bytes32 => uint256) _indexes;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _add(Set storage set, bytes32 value) private returns (bool) {
|
|
if (!_contains(set, value)) {
|
|
set._values.push(value);
|
|
|
|
|
|
set._indexes[value] = set._values.length;
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _remove(Set storage set, bytes32 value) private returns (bool) {
|
|
|
|
uint256 valueIndex = set._indexes[value];
|
|
|
|
if (valueIndex != 0) {
|
|
|
|
|
|
|
|
|
|
uint256 toDeleteIndex = valueIndex - 1;
|
|
uint256 lastIndex = set._values.length - 1;
|
|
|
|
|
|
|
|
|
|
bytes32 lastvalue = set._values[lastIndex];
|
|
|
|
|
|
set._values[toDeleteIndex] = lastvalue;
|
|
|
|
set._indexes[lastvalue] = valueIndex;
|
|
|
|
|
|
set._values.pop();
|
|
|
|
|
|
delete set._indexes[value];
|
|
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
function _contains(Set storage set, bytes32 value) private view returns (bool) {
|
|
return set._indexes[value] != 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
function _length(Set storage set) private view returns (uint256) {
|
|
return set._values.length;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _at(Set storage set, uint256 index) private view returns (bytes32) {
|
|
require(set._values.length > index, "EnumerableSet: index out of bounds");
|
|
return set._values[index];
|
|
}
|
|
|
|
|
|
|
|
struct Bytes32Set {
|
|
Set _inner;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
|
|
return _add(set._inner, value);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
|
|
return _remove(set._inner, value);
|
|
}
|
|
|
|
|
|
|
|
|
|
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
|
|
return _contains(set._inner, value);
|
|
}
|
|
|
|
|
|
|
|
|
|
function length(Bytes32Set storage set) internal view returns (uint256) {
|
|
return _length(set._inner);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
|
|
return _at(set._inner, index);
|
|
}
|
|
|
|
|
|
|
|
struct AddressSet {
|
|
Set _inner;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function add(AddressSet storage set, address value) internal returns (bool) {
|
|
return _add(set._inner, bytes32(uint256(uint160(value))));
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function remove(AddressSet storage set, address value) internal returns (bool) {
|
|
return _remove(set._inner, bytes32(uint256(uint160(value))));
|
|
}
|
|
|
|
|
|
|
|
|
|
function contains(AddressSet storage set, address value) internal view returns (bool) {
|
|
return _contains(set._inner, bytes32(uint256(uint160(value))));
|
|
}
|
|
|
|
|
|
|
|
|
|
function length(AddressSet storage set) internal view returns (uint256) {
|
|
return _length(set._inner);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function at(AddressSet storage set, uint256 index) internal view returns (address) {
|
|
return address(uint160(uint256(_at(set._inner, index))));
|
|
}
|
|
|
|
|
|
|
|
struct UintSet {
|
|
Set _inner;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function add(UintSet storage set, uint256 value) internal returns (bool) {
|
|
return _add(set._inner, bytes32(value));
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function remove(UintSet storage set, uint256 value) internal returns (bool) {
|
|
return _remove(set._inner, bytes32(value));
|
|
}
|
|
|
|
|
|
|
|
|
|
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
|
|
return _contains(set._inner, bytes32(value));
|
|
}
|
|
|
|
|
|
|
|
|
|
function length(UintSet storage set) internal view returns (uint256) {
|
|
return _length(set._inner);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
|
|
return uint256(_at(set._inner, index));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
contract DogegoD is IERC20, Ownable
|
|
{
|
|
using Address for address;
|
|
using EnumerableSet for EnumerableSet.AddressSet;
|
|
|
|
event antiBotBan(address indexed value);
|
|
|
|
mapping (address => uint256) private _balances;
|
|
mapping (address => mapping (address => uint256)) private _allowances;
|
|
mapping (address => uint256) private _sellLock;
|
|
mapping (address => uint256) private _buyLock;
|
|
|
|
EnumerableSet.AddressSet private _excluded;
|
|
EnumerableSet.AddressSet private _excludedFromSellLock;
|
|
EnumerableSet.AddressSet private _excludedFromBuyLock;
|
|
EnumerableSet.AddressSet private _excludedFromStaking;
|
|
|
|
EnumerableSet.AddressSet private _isBlacklisted;
|
|
|
|
|
|
string private constant _name = 'DogegoD';
|
|
string private constant _symbol = '$DogegoD';
|
|
uint8 private constant _decimals = 9;
|
|
uint256 public constant InitialSupply= 100000000 * 10**_decimals;
|
|
|
|
|
|
uint256 private tradingEnabledAt;
|
|
uint256 public autoBanTime = 30;
|
|
uint256 public enableAutoBlacklist = 0;
|
|
|
|
uint8 public constant BalanceLimitDivider=25;
|
|
|
|
uint16 public constant SellLimitDivider=100;
|
|
|
|
uint16 public constant MaxSellLockTime= 0 seconds;
|
|
|
|
uint16 public constant MaxBuyLockTime= 0 seconds;
|
|
|
|
uint256 private constant DefaultLiquidityLockTime= 1800;
|
|
|
|
address public PrizeWallet=payable(0xCc1129B3Bcc090D930Cb79926Fa59B6Ae52b189f);
|
|
address public Marketing=payable(0x14169B3c7835d686293D4279B31863389efAf729);
|
|
|
|
address private constant UniswapV2Router=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
|
|
|
|
|
|
|
|
uint256 private _circulatingSupply =InitialSupply;
|
|
uint256 public balanceLimit = _circulatingSupply;
|
|
uint256 public sellLimit = _circulatingSupply;
|
|
uint256 private MaxBuy = 4000000 * 10**_decimals;
|
|
|
|
|
|
uint8 private _buyTax;
|
|
uint8 private _sellTax;
|
|
uint8 private _transferTax;
|
|
|
|
uint8 private _burnTax;
|
|
uint8 private _liquidityTax;
|
|
uint8 private _stakingTax;
|
|
|
|
|
|
address private _uniswapv2PairAddress;
|
|
IUniswapV2Router02 private _uniswapv2Router;
|
|
|
|
|
|
|
|
function _isTeam(address addr) private view returns (bool){
|
|
return addr==owner()||addr==PrizeWallet||addr==Marketing;
|
|
}
|
|
|
|
//Constructor///////////
|
|
|
|
constructor () {
|
|
//contract creator gets 90% of the token to create LP-Pair
|
|
uint256 deployerBalance=_circulatingSupply;
|
|
_balances[msg.sender] = deployerBalance;
|
|
emit Transfer(address(0), msg.sender, deployerBalance);
|
|
// UniswapV2 Router
|
|
_uniswapv2Router = IUniswapV2Router02(UniswapV2Router);
|
|
//Creates a UniswapV2 Pair
|
|
_uniswapv2PairAddress = IUniswapV2Factory(_uniswapv2Router.factory()).createPair(address(this), _uniswapv2Router.WETH());
|
|
|
|
//Sets Buy/Sell limits
|
|
balanceLimit=InitialSupply/BalanceLimitDivider;
|
|
sellLimit=InitialSupply/SellLimitDivider;
|
|
|
|
//Sets sellLockTime
|
|
sellLockTime=0;
|
|
|
|
//Sets buyLockTime
|
|
buyLockTime=0;
|
|
|
|
//Set Starting Tax
|
|
|
|
_buyTax=10;
|
|
_sellTax=10;
|
|
_transferTax=10;
|
|
|
|
_burnTax=0;
|
|
_liquidityTax=30;
|
|
_stakingTax=70;
|
|
|
|
//Team wallets and deployer are excluded from Taxes
|
|
_excluded.add(PrizeWallet);
|
|
_excluded.add(Marketing);
|
|
_excluded.add(msg.sender);
|
|
//excludes UniswapV2 Router, pair, contract and burn address from staking
|
|
_excludedFromStaking.add(address(_uniswapv2Router));
|
|
_excludedFromStaking.add(_uniswapv2PairAddress);
|
|
_excludedFromStaking.add(address(this));
|
|
_excludedFromStaking.add(0x000000000000000000000000000000000000dEaD);
|
|
|
|
}
|
|
|
|
//Transfer functionality///
|
|
|
|
//transfer function, every transfer runs through this function
|
|
function _transfer(address sender, address recipient, uint256 amount) private{
|
|
require(sender != address(0), "Transfer from zero");
|
|
require(recipient != address(0), "Transfer to zero");
|
|
|
|
//Manually Excluded adresses are transfering tax and lock free
|
|
bool isExcluded = (_excluded.contains(sender) || _excluded.contains(recipient));
|
|
|
|
//Transactions from and to the contract are always tax and lock free
|
|
bool isContractTransfer=(sender==address(this) || recipient==address(this));
|
|
|
|
//transfers between UniswapV2Router and UniswapV2Pair are tax and lock free
|
|
address uniswapv2Router=address(_uniswapv2Router);
|
|
bool isLiquidityTransfer = ((sender == _uniswapv2PairAddress && recipient == uniswapv2Router)
|
|
|| (recipient == _uniswapv2PairAddress && sender == uniswapv2Router));
|
|
|
|
//differentiate between buy/sell/transfer to apply different taxes/restrictions
|
|
bool isBuy=sender==_uniswapv2PairAddress|| sender == uniswapv2Router;
|
|
bool isSell=recipient==_uniswapv2PairAddress|| recipient == uniswapv2Router;
|
|
|
|
//Pick transfer
|
|
if(isContractTransfer || isLiquidityTransfer || isExcluded){
|
|
_feelessTransfer(sender, recipient, amount);
|
|
}
|
|
else{
|
|
//once trading is enabled, it can't be turned off again
|
|
require(tradingEnabled,"trading not yet enabled");
|
|
_taxedTransfer(sender,recipient,amount,isBuy,isSell);
|
|
}
|
|
}
|
|
//applies taxes, checks for limits, locks generates autoLP and stakingETH, and autostakes
|
|
function _taxedTransfer(address sender, address recipient, uint256 amount,bool isBuy,bool isSell) private{
|
|
uint256 recipientBalance = _balances[recipient];
|
|
uint256 senderBalance = _balances[sender];
|
|
require(senderBalance >= amount, "Transfer exceeds balance");
|
|
|
|
uint8 tax;
|
|
if(isSell){
|
|
if(!_excludedFromSellLock.contains(sender)){
|
|
//If seller sold less than sellLockTime(2h 50m) ago, sell is declined, can be disabled by Team
|
|
require(_sellLock[sender]<=block.timestamp||sellLockDisabled,"Seller in sellLock");
|
|
//Sets the time sellers get locked(2 hours 50 mins by default)
|
|
_sellLock[sender]=block.timestamp+sellLockTime;
|
|
}
|
|
//Sells can't exceed the sell limit(21,000 Tokens at start, can be updated to circulating supply)
|
|
require(amount<=sellLimit,"Dump protection");
|
|
require(_isBlacklisted.contains(sender) == false, "Address blacklisted!");
|
|
|
|
if (block.timestamp <= tradingEnabledAt + autoBanTime && enableAutoBlacklist == 1) {
|
|
_isBlacklisted.add(sender);
|
|
emit antiBotBan(sender);
|
|
}
|
|
|
|
tax=_sellTax;
|
|
|
|
|
|
} else if(isBuy){
|
|
if(!_excludedFromBuyLock.contains(recipient)){
|
|
//If buyer bought less than buyLockTime(2h 50m) ago, buy is declined, can be disabled by Team
|
|
require(_buyLock[recipient]<=block.timestamp||buyLockDisabled,"Buyer in buyLock");
|
|
//Sets the time buyers get locked(2 hours 50 mins by default)
|
|
_buyLock[recipient]=block.timestamp+buyLockTime;
|
|
}
|
|
//Checks If the recipient balance(excluding Taxes) would exceed Balance Limit
|
|
require(recipientBalance+amount<=balanceLimit,"whale protection");
|
|
require(amount <= MaxBuy,"Tx amount exceeding max buy amount");
|
|
require(_isBlacklisted.contains(recipient) == false, "Address blacklisted!");
|
|
|
|
if (block.timestamp <= tradingEnabledAt + autoBanTime && enableAutoBlacklist == 1) {
|
|
_isBlacklisted.add(recipient);
|
|
emit antiBotBan(recipient);
|
|
}
|
|
|
|
tax=_buyTax;
|
|
|
|
} else {//Transfer
|
|
//withdraws ETH when sending less or equal to 1 Token
|
|
//that way you can withdraw without connecting to any dApp.
|
|
//might needs higher gas limit
|
|
if(amount<=10**(_decimals)) claimETH(sender);
|
|
//Checks If the recipient balance(excluding Taxes) would exceed Balance Limit
|
|
require(recipientBalance+amount<=balanceLimit,"whale protection");
|
|
//Transfers are disabled in sell lock, this doesn't stop someone from transfering before
|
|
//selling, but there is no satisfying solution for that, and you would need to pax additional tax
|
|
if(!_excludedFromSellLock.contains(sender))
|
|
require(_sellLock[sender]<=block.timestamp||sellLockDisabled,"Sender in Lock");
|
|
|
|
require(_isBlacklisted.contains(sender) == false, "Sender address blacklisted!");
|
|
require(_isBlacklisted.contains(recipient) == false, "Recipient address blacklisted!");
|
|
|
|
if (block.timestamp <= tradingEnabledAt + autoBanTime && enableAutoBlacklist == 1) {
|
|
_isBlacklisted.add(sender);
|
|
emit antiBotBan(sender);
|
|
}
|
|
|
|
tax=_transferTax;
|
|
|
|
}
|
|
//Swapping AutoLP and MarketingETH is only possible if sender is not uniswapv2 pair,
|
|
//if its not manually disabled, if its not already swapping and if its a Sell to avoid
|
|
// people from causing a large price impact from repeatedly transfering when theres a large backlog of Tokens
|
|
if((sender!=_uniswapv2PairAddress)&&(!manualConversion)&&(!_isSwappingContractModifier)&&isSell)
|
|
_swapContractToken();
|
|
//Calculates the exact token amount for each tax
|
|
uint256 tokensToBeBurnt=_calculateFee(amount, tax, _burnTax);
|
|
//staking and liquidity Tax get treated the same, only during conversion they get split
|
|
uint256 contractToken=_calculateFee(amount, tax, _stakingTax+_liquidityTax);
|
|
//Subtract the Taxed Tokens from the amount
|
|
uint256 taxedAmount=amount-(tokensToBeBurnt + contractToken);
|
|
|
|
//Removes token and handles staking
|
|
_removeToken(sender,amount);
|
|
|
|
//Adds the taxed tokens to the contract wallet
|
|
_balances[address(this)] += contractToken;
|
|
//Burns tokens
|
|
_circulatingSupply-=tokensToBeBurnt;
|
|
|
|
//Adds token and handles staking
|
|
_addToken(recipient, taxedAmount);
|
|
|
|
emit Transfer(sender,recipient,taxedAmount);
|
|
|
|
}
|
|
|
|
//Feeless transfer only transfers and autostakes
|
|
function _feelessTransfer(address sender, address recipient, uint256 amount) private{
|
|
uint256 senderBalance = _balances[sender];
|
|
require(senderBalance >= amount, "Transfer exceeds balance");
|
|
//Removes token and handles staking
|
|
_removeToken(sender,amount);
|
|
//Adds token and handles staking
|
|
_addToken(recipient, amount);
|
|
|
|
emit Transfer(sender,recipient,amount);
|
|
|
|
}
|
|
//Calculates the token that should be taxed
|
|
function _calculateFee(uint256 amount, uint8 tax, uint8 taxPercent) private pure returns (uint256) {
|
|
return (amount*tax*taxPercent) / 10000;
|
|
}
|
|
|
|
//ETH Autostake/////////////////////////////////////////////////////////////////////////////////////////
|
|
//Autostake uses the balances of each holder to redistribute auto generated ETH.
|
|
//Each transaction _addToken and _removeToken gets called for the transaction amount
|
|
//WithdrawETH can be used for any holder to withdraw ETH at any time, like true Staking,
|
|
//so unlike MRAT clones you can leave and forget your Token and claim after a while
|
|
|
|
//lock for the withdraw
|
|
bool private _isWithdrawing;
|
|
//Multiplier to add some accuracy to profitPerShare
|
|
uint256 private constant DistributionMultiplier = 2**64;
|
|
//profit for each share a holder holds, a share equals a token.
|
|
uint256 public profitPerShare;
|
|
//the total reward distributed through staking, for tracking purposes
|
|
uint256 public totalStakingReward;
|
|
//the total payout through staking, for tracking purposes
|
|
uint256 public totalPayouts;
|
|
|
|
|
|
uint8 public marketingShare=100;
|
|
//balance that is claimable by the team
|
|
uint256 public marketingBalance;
|
|
|
|
//Mapping of the already paid out(or missed) shares of each staker
|
|
mapping(address => uint256) private alreadyPaidShares;
|
|
|
|
mapping(address => uint256) private toBePaid;
|
|
|
|
|
|
|
|
|
|
function isExcludedFromStaking(address addr) public view returns (bool){
|
|
return _excludedFromStaking.contains(addr);
|
|
}
|
|
|
|
|
|
function isBlacklisted(address addr) public view returns (bool){
|
|
return _isBlacklisted.contains(addr);
|
|
}
|
|
|
|
function _getTotalShares() public view returns (uint256){
|
|
uint256 shares=_circulatingSupply;
|
|
|
|
|
|
for(uint i=0; i<_excludedFromStaking.length(); i++){
|
|
shares-=_balances[_excludedFromStaking.at(i)];
|
|
}
|
|
return shares;
|
|
}
|
|
|
|
|
|
function _addToken(address addr, uint256 amount) private {
|
|
|
|
uint256 newAmount=_balances[addr]+amount;
|
|
|
|
if(isExcludedFromStaking(addr)){
|
|
_balances[addr]=newAmount;
|
|
return;
|
|
}
|
|
|
|
|
|
uint256 payment=_newDividentsOf(addr);
|
|
|
|
alreadyPaidShares[addr] = profitPerShare * newAmount;
|
|
|
|
toBePaid[addr]+=payment;
|
|
|
|
_balances[addr]=newAmount;
|
|
}
|
|
|
|
|
|
|
|
function _removeToken(address addr, uint256 amount) private {
|
|
|
|
uint256 newAmount=_balances[addr]-amount;
|
|
|
|
if(isExcludedFromStaking(addr)){
|
|
_balances[addr]=newAmount;
|
|
return;
|
|
}
|
|
|
|
|
|
uint256 payment=_newDividentsOf(addr);
|
|
|
|
_balances[addr]=newAmount;
|
|
|
|
alreadyPaidShares[addr] = profitPerShare * newAmount;
|
|
|
|
toBePaid[addr]+=payment;
|
|
}
|
|
|
|
|
|
|
|
|
|
function _newDividentsOf(address staker) private view returns (uint256) {
|
|
uint256 fullPayout = profitPerShare * _balances[staker];
|
|
|
|
|
|
if(fullPayout<alreadyPaidShares[staker]) return 0;
|
|
return (fullPayout - alreadyPaidShares[staker]) / DistributionMultiplier;
|
|
}
|
|
|
|
|
|
function _distributeStake(uint256 ETHamount) private {
|
|
|
|
uint256 marketingSplit = (ETHamount * marketingShare) / 100;
|
|
uint256 amount = ETHamount - marketingSplit;
|
|
|
|
marketingBalance+=marketingSplit;
|
|
|
|
if (amount > 0) {
|
|
totalStakingReward += amount;
|
|
uint256 totalShares=_getTotalShares();
|
|
|
|
if (totalShares == 0) {
|
|
marketingBalance += amount;
|
|
}else{
|
|
|
|
profitPerShare += ((amount * DistributionMultiplier) / totalShares);
|
|
}
|
|
}
|
|
}
|
|
event OnWithdrawETH(uint256 amount, address recipient);
|
|
|
|
|
|
function claimETH(address addr) private{
|
|
require(!_isWithdrawing);
|
|
_isWithdrawing=true;
|
|
uint256 amount;
|
|
if(isExcludedFromStaking(addr)){
|
|
|
|
amount=toBePaid[addr];
|
|
toBePaid[addr]=0;
|
|
}
|
|
else{
|
|
uint256 newAmount=_newDividentsOf(addr);
|
|
|
|
alreadyPaidShares[addr] = profitPerShare * _balances[addr];
|
|
|
|
amount=toBePaid[addr]+newAmount;
|
|
toBePaid[addr]=0;
|
|
}
|
|
if(amount==0){
|
|
_isWithdrawing=false;
|
|
return;
|
|
}
|
|
totalPayouts+=amount;
|
|
address[] memory path = new address[](2);
|
|
path[0] = _uniswapv2Router.WETH();
|
|
path[1] = 0x4Fabb145d64652a948d72533023f6E7A623C7C53;
|
|
|
|
_uniswapv2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}(
|
|
0,
|
|
path,
|
|
addr,
|
|
block.timestamp);
|
|
|
|
emit OnWithdrawETH(amount, addr);
|
|
_isWithdrawing=false;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint256 public totalLPETH;
|
|
|
|
bool private _isSwappingContractModifier;
|
|
modifier lockTheSwap {
|
|
_isSwappingContractModifier = true;
|
|
_;
|
|
_isSwappingContractModifier = false;
|
|
}
|
|
uint256 currentAmountToSwap = 400000 * 10**_decimals;
|
|
|
|
|
|
function _swapContractToken() private lockTheSwap{
|
|
uint256 contractBalance=_balances[address(this)];
|
|
uint16 totalTax=_liquidityTax+_stakingTax;
|
|
uint256 tokenToSwap = currentAmountToSwap;
|
|
|
|
if(contractBalance<tokenToSwap||totalTax==0){
|
|
return;
|
|
}
|
|
//splits the token in TokenForLiquidity and tokenForMarketing
|
|
uint256 tokenForLiquidity=(tokenToSwap*_liquidityTax)/totalTax;
|
|
uint256 tokenForMarketing= tokenToSwap-tokenForLiquidity;
|
|
|
|
//splits tokenForLiquidity in 2 halves
|
|
uint256 liqToken=tokenForLiquidity/2;
|
|
uint256 liqETHToken=tokenForLiquidity-liqToken;
|
|
|
|
//swaps marktetingToken and the liquidity token half for ETH
|
|
uint256 swapToken=liqETHToken+tokenForMarketing;
|
|
//Gets the initial ETH balance, so swap won't touch any staked ETH
|
|
uint256 initialETHBalance = address(this).balance;
|
|
_swapTokenForETH(swapToken);
|
|
uint256 newETH=(address(this).balance - initialETHBalance);
|
|
//calculates the amount of ETH belonging to the LP-Pair and converts them to LP
|
|
uint256 liqETH = (newETH*liqETHToken)/swapToken;
|
|
_addLiquidity(liqToken, liqETH);
|
|
//Get the ETH balance after LP generation to get the
|
|
//exact amount of token left for Staking
|
|
uint256 distributeETH=(address(this).balance - initialETHBalance);
|
|
//distributes remaining ETH between stakers and Marketing
|
|
_distributeStake(distributeETH);
|
|
}
|
|
//swaps tokens on the contract for ETH
|
|
function _swapTokenForETH(uint256 amount) private {
|
|
_approve(address(this), address(_uniswapv2Router), amount);
|
|
address[] memory path = new address[](2);
|
|
path[0] = address(this);
|
|
path[1] = _uniswapv2Router.WETH();
|
|
|
|
_uniswapv2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
|
|
amount,
|
|
0,
|
|
path,
|
|
address(this),
|
|
block.timestamp
|
|
);
|
|
}
|
|
//Adds Liquidity directly to the contract where LP are locked(unlike safemoon forks, that transfer it to the owner)
|
|
function _addLiquidity(uint256 tokenamount, uint256 ethamount) private {
|
|
totalLPETH+=ethamount;
|
|
_approve(address(this), address(_uniswapv2Router), tokenamount);
|
|
_uniswapv2Router.addLiquidityETH{value: ethamount}(
|
|
address(this),
|
|
tokenamount,
|
|
0,
|
|
0,
|
|
address(this),
|
|
block.timestamp
|
|
);
|
|
}
|
|
|
|
//public functions /////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
function getLiquidityReleaseTimeInSeconds() public view returns (uint256){
|
|
if(block.timestamp<_liquidityUnlockTime){
|
|
return _liquidityUnlockTime-block.timestamp;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
function getBurnedTokens() public view returns(uint256){
|
|
return (InitialSupply-_circulatingSupply)/10**_decimals;
|
|
}
|
|
|
|
function getLimits() public view returns(uint256 balance, uint256 sell){
|
|
return(balanceLimit/10**_decimals, sellLimit/10**_decimals);
|
|
}
|
|
|
|
function getTaxes() public view returns(uint256 burnTax,uint256 liquidityTax,uint256 marketingTax, uint256 buyTax, uint256 sellTax, uint256 transferTax){
|
|
return (_burnTax,_liquidityTax,_stakingTax,_buyTax,_sellTax,_transferTax);
|
|
}
|
|
|
|
//How long is a given address still locked from selling
|
|
function getAddressSellLockTimeInSeconds(address AddressToCheck) public view returns (uint256){
|
|
uint256 lockTime=_sellLock[AddressToCheck];
|
|
if(lockTime<=block.timestamp)
|
|
{
|
|
return 0;
|
|
}
|
|
return lockTime-block.timestamp;
|
|
}
|
|
function getSellLockTimeInSeconds() public view returns(uint256){
|
|
return sellLockTime;
|
|
}
|
|
|
|
function getcurrentAmountToSwap() public view returns (uint256){
|
|
return currentAmountToSwap;
|
|
}
|
|
|
|
//How long is a given address still locked from buying
|
|
function getAddressBuyLockTimeInSeconds(address AddressToCheck) public view returns (uint256){
|
|
uint256 lockTime=_buyLock[AddressToCheck];
|
|
if(lockTime<=block.timestamp)
|
|
{
|
|
return 0;
|
|
}
|
|
return lockTime-block.timestamp;
|
|
}
|
|
function getBuyLockTimeInSeconds() public view returns(uint256){
|
|
return buyLockTime;
|
|
}
|
|
|
|
//Functions every wallet can call
|
|
//Resets sell lock of caller to the default sellLockTime should something go very wrong
|
|
function AddressResetSellLock() public{
|
|
_sellLock[msg.sender]=block.timestamp+sellLockTime;
|
|
}
|
|
|
|
//Resets buy lock of caller to the default buyLockTime should something go very wrong
|
|
function AddressResetBuyLock() public{
|
|
_buyLock[msg.sender]=block.timestamp+buyLockTime;
|
|
|
|
}
|
|
|
|
//withdraws dividents of sender
|
|
function Rewards() public{
|
|
claimETH(msg.sender);
|
|
}
|
|
|
|
function getDividents(address addr) public view returns (uint256){
|
|
if(isExcludedFromStaking(addr)) return toBePaid[addr];
|
|
return _newDividentsOf(addr)+toBePaid[addr];
|
|
}
|
|
|
|
//Settings//////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
bool public sellLockDisabled;
|
|
uint256 public sellLockTime;
|
|
bool public buyLockDisabled;
|
|
uint256 public buyLockTime;
|
|
bool public manualConversion;
|
|
|
|
function CollectMarketingETH() public onlyOwner{
|
|
uint256 amount=marketingBalance;
|
|
marketingBalance=0;
|
|
payable(PrizeWallet).transfer((amount*50) / 100);
|
|
payable(Marketing).transfer((amount*50) / 100);
|
|
}
|
|
function TeamCollectXMarketingETH(uint256 amount) public onlyOwner{
|
|
require(amount<=marketingBalance);
|
|
marketingBalance-=amount;
|
|
payable(PrizeWallet).transfer((amount*50) / 100);
|
|
payable(Marketing).transfer((amount*50) / 100);
|
|
}
|
|
|
|
//switches autoLiquidity and marketing ETH generation during transfers
|
|
function TeamSwitchManualETHConversion(bool manual) public onlyOwner{
|
|
manualConversion=manual;
|
|
}
|
|
|
|
function TeamChangeMaxBuy(uint256 newMaxBuy) public onlyOwner{
|
|
MaxBuy=newMaxBuy * 10**_decimals;
|
|
}
|
|
|
|
function TeamChangePrizeWallet(address newPrizeWallet) public onlyOwner{
|
|
PrizeWallet=payable(newPrizeWallet);
|
|
}
|
|
|
|
function TeamChangeMarketing(address newMarketing) public onlyOwner{
|
|
Marketing=payable(newMarketing);
|
|
}
|
|
|
|
//Disables the timeLock after selling for everyone
|
|
function TeamDisableSellLock(bool disabled) public onlyOwner{
|
|
sellLockDisabled=disabled;
|
|
}
|
|
|
|
//Disables the timeLock after buying for everyone
|
|
function TeamDisableBuyLock(bool disabled) public onlyOwner{
|
|
buyLockDisabled=disabled;
|
|
}
|
|
|
|
//Sets SellLockTime, needs to be lower than MaxSellLockTime
|
|
function TeamSetSellLockTime(uint256 sellLockSeconds)public onlyOwner{
|
|
require(sellLockSeconds<=MaxSellLockTime,"Sell Lock time too high");
|
|
sellLockTime=sellLockSeconds;
|
|
}
|
|
|
|
//Sets BuyLockTime, needs to be lower than MaxBuyLockTime
|
|
function TeamSetBuyLockTime(uint256 buyLockSeconds)public onlyOwner{
|
|
require(buyLockSeconds<=MaxBuyLockTime,"Buy Lock time too high");
|
|
buyLockTime=buyLockSeconds;
|
|
}
|
|
|
|
//Allows CA owner to change how much the contract sells to prevent massive contract sells as the token grows.
|
|
function TeamUpdateAmountToSwap(uint256 newSwapAmount) public onlyOwner{
|
|
currentAmountToSwap = newSwapAmount;
|
|
}
|
|
|
|
//Allows wallet exclusion to be added after launch
|
|
function AddWalletExclusion(address exclusionAdd) public onlyOwner{
|
|
_excluded.add(exclusionAdd);
|
|
}
|
|
|
|
//Sets Taxes
|
|
function TeamSetTaxes(uint8 burnTaxes, uint8 liquidityTaxes, uint8 stakingTaxes,uint8 buyTax, uint8 sellTax, uint8 transferTax) public onlyOwner{
|
|
uint8 totalTax=burnTaxes+liquidityTaxes+stakingTaxes;
|
|
require(totalTax==100, "burn+liq+marketing needs to equal 100%");
|
|
|
|
_burnTax=burnTaxes;
|
|
_liquidityTax=liquidityTaxes;
|
|
_stakingTax=stakingTaxes;
|
|
|
|
_buyTax=buyTax;
|
|
_sellTax=sellTax;
|
|
_transferTax=transferTax;
|
|
}
|
|
|
|
//How much of the staking tax should be allocated for marketing
|
|
function TeamChangeMarketingShare(uint8 newShare) public onlyOwner{
|
|
require(newShare<=100);
|
|
marketingShare=newShare;
|
|
}
|
|
//manually converts contract token to LP and staking ETH
|
|
function TeamCreateLPandETH() public onlyOwner{
|
|
_swapContractToken();
|
|
}
|
|
|
|
//Limits need to be at least target, to avoid setting value to 0(avoid potential Honeypot)
|
|
function TeamUpdateLimits(uint256 newBalanceLimit, uint256 newSellLimit) public onlyOwner{
|
|
//SellLimit needs to be below 1% to avoid a Large Price impact when generating auto LP
|
|
require(newSellLimit<_circulatingSupply/100);
|
|
//Adds decimals to limits
|
|
newBalanceLimit=newBalanceLimit*10**_decimals;
|
|
newSellLimit=newSellLimit*10**_decimals;
|
|
//Calculates the target Limits based on supply
|
|
uint256 targetBalanceLimit=_circulatingSupply/BalanceLimitDivider;
|
|
uint256 targetSellLimit=_circulatingSupply/SellLimitDivider;
|
|
|
|
require((newBalanceLimit>=targetBalanceLimit),
|
|
"newBalanceLimit needs to be at least target");
|
|
require((newSellLimit>=targetSellLimit),
|
|
"newSellLimit needs to be at least target");
|
|
|
|
balanceLimit = newBalanceLimit;
|
|
sellLimit = newSellLimit;
|
|
}
|
|
|
|
//Adds address to blacklist and prevents sells, buys or transfers.
|
|
function addAddressToBlacklist(address blacklistedAddress) external onlyOwner {
|
|
_isBlacklisted.add(blacklistedAddress);
|
|
}
|
|
|
|
//Remove address from blacklist and allow sells, buys or transfers.
|
|
function removeAddressFromBlacklist(address blacklistedAddress) external onlyOwner {
|
|
_isBlacklisted.remove(blacklistedAddress);
|
|
}
|
|
|
|
//Setup Functions///////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
bool public tradingEnabled;
|
|
address private _liquidityTokenAddress;
|
|
//Enables trading for everyone
|
|
function SetupEnableTrading() public onlyOwner{
|
|
tradingEnabled=true;
|
|
tradingEnabledAt=block.timestamp;
|
|
}
|
|
|
|
//Sets up the LP-Token Address required for LP Release
|
|
function SetupLiquidityTokenAddress(address liquidityTokenAddress) public onlyOwner{
|
|
_liquidityTokenAddress=liquidityTokenAddress;
|
|
}
|
|
|
|
//Liquidity Lock////////////////////////////////////////////////////////////////////////////////////////
|
|
//the timestamp when Liquidity unlocks
|
|
uint256 private _liquidityUnlockTime;
|
|
|
|
function TeamExtendLiquidityLock(uint256 secondsUntilUnlock) public onlyOwner{
|
|
_prolongLiquidityLock(secondsUntilUnlock+block.timestamp);
|
|
}
|
|
function _prolongLiquidityLock(uint256 newUnlockTime) private{
|
|
// require new unlock time to be longer than old one
|
|
require(newUnlockTime>_liquidityUnlockTime);
|
|
_liquidityUnlockTime=newUnlockTime;
|
|
}
|
|
|
|
//Release Liquidity Tokens once unlock time is over
|
|
function REL() public onlyOwner {
|
|
//Only callable if liquidity Unlock time is over
|
|
require(block.timestamp >= _liquidityUnlockTime, "Not yet unlocked");
|
|
|
|
IUniswapV2ERC20 liquidityToken = IUniswapV2ERC20(_liquidityTokenAddress);
|
|
uint256 amount = liquidityToken.balanceOf(address(this));
|
|
|
|
//Liquidity release if something goes wrong at start
|
|
liquidityToken.transfer(PrizeWallet, amount);
|
|
|
|
}
|
|
//Removes Liquidity once unlock Time is over,
|
|
function REM(bool addToStaking) public onlyOwner{
|
|
//Only callable if liquidity Unlock time is over
|
|
require(block.timestamp >= _liquidityUnlockTime, "Not yet unlocked");
|
|
_liquidityUnlockTime=block.timestamp+DefaultLiquidityLockTime;
|
|
IUniswapV2ERC20 liquidityToken = IUniswapV2ERC20(_liquidityTokenAddress);
|
|
uint256 amount = liquidityToken.balanceOf(address(this));
|
|
|
|
liquidityToken.approve(address(_uniswapv2Router),amount);
|
|
//Removes Liquidity and either distributes liquidity ETH to stakers, or
|
|
// adds them to marketing Balance
|
|
//Token will be converted
|
|
//to Liquidity and Staking ETH again
|
|
uint256 initialETHBalance = address(this).balance;
|
|
_uniswapv2Router.removeLiquidityETHSupportingFeeOnTransferTokens(
|
|
address(this),
|
|
amount,
|
|
0,
|
|
0,
|
|
address(this),
|
|
block.timestamp
|
|
);
|
|
uint256 newETHBalance = address(this).balance-initialETHBalance;
|
|
if(addToStaking){
|
|
_distributeStake(newETHBalance);
|
|
}
|
|
else{
|
|
marketingBalance+=newETHBalance;
|
|
}
|
|
|
|
}
|
|
//Releases all remaining ETH on the contract wallet, so ETH wont be burned
|
|
function TeamCollectRemainingETH() public onlyOwner{
|
|
require(block.timestamp >= _liquidityUnlockTime, "Not yet unlocked");
|
|
_liquidityUnlockTime=block.timestamp+DefaultLiquidityLockTime;
|
|
(bool sent,) =PrizeWallet.call{value: (address(this).balance)}("");
|
|
require(sent);
|
|
}
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//external//////////////////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
receive() external payable {}
|
|
fallback() external payable {}
|
|
// IERC20
|
|
|
|
function getOwner() external view override returns (address) {
|
|
return owner();
|
|
}
|
|
|
|
function name() external pure override returns (string memory) {
|
|
return _name;
|
|
}
|
|
|
|
function symbol() external pure override returns (string memory) {
|
|
return _symbol;
|
|
}
|
|
|
|
function decimals() external pure override returns (uint8) {
|
|
return _decimals;
|
|
}
|
|
|
|
function totalSupply() external view override returns (uint256) {
|
|
return _circulatingSupply;
|
|
}
|
|
|
|
function balanceOf(address account) external view override returns (uint256) {
|
|
return _balances[account];
|
|
}
|
|
|
|
function transfer(address recipient, uint256 amount) external override returns (bool) {
|
|
_transfer(msg.sender, recipient, amount);
|
|
return true;
|
|
}
|
|
|
|
function allowance(address _owner, address spender) external view override returns (uint256) {
|
|
return _allowances[_owner][spender];
|
|
}
|
|
|
|
function approve(address spender, uint256 amount) external override returns (bool) {
|
|
_approve(msg.sender, spender, amount);
|
|
return true;
|
|
}
|
|
function _approve(address owner, address spender, uint256 amount) private {
|
|
require(owner != address(0), "Approve from zero");
|
|
require(spender != address(0), "Approve to zero");
|
|
|
|
_allowances[owner][spender] = amount;
|
|
emit Approval(owner, spender, amount);
|
|
}
|
|
|
|
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
|
|
_transfer(sender, recipient, amount);
|
|
|
|
uint256 currentAllowance = _allowances[sender][msg.sender];
|
|
require(currentAllowance >= amount, "Transfer > allowance");
|
|
|
|
_approve(sender, msg.sender, currentAllowance - amount);
|
|
return true;
|
|
}
|
|
|
|
// IERC20 - Helpers
|
|
|
|
function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
|
|
_approve(msg.sender, spender, _allowances[msg.sender][spender] + addedValue);
|
|
return true;
|
|
}
|
|
|
|
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
|
|
uint256 currentAllowance = _allowances[msg.sender][spender];
|
|
require(currentAllowance >= subtractedValue, "<0 allowance");
|
|
|
|
_approve(msg.sender, spender, currentAllowance - subtractedValue);
|
|
return true;
|
|
}
|
|
|
|
} |