quanticvsxprotocol

/**
/**
*Submitted for verification at BscScan.com on 2022-02-22
*Submitted for verification at BscScan.com on 2022-03-01
*/
*/
// SPDX-License-Identifier: unlicensed
pragma solidity ^0.7.4;
library SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MAX_INT256 = ~(int256(1) << 255);
function mul(int256 a, int256 b) internal pure returns (int256) {
int256 c = a * b;
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));
require((b == 0) || (c / b == a));
return c;
}
function div(int256 a, int256 b) internal pure returns (int256) {
require(b != -1 || a != MIN_INT256);
return a / b;
}
function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
}
function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a));
return c;
}
function abs(int256 a) internal pure returns (int256) {
require(a != MIN_INT256);
return a < 0 ? -a : a;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
pragma solidity ^0.7.4;
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
require(c >= a, "SafeMath: addition overflow");
return c;
return c;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
return sub(a, b, "SafeMath: subtraction overflow");
}
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
require(b <= a, errorMessage);
uint256 c = a - b;
uint256 c = a - b;
return c;
return c;
}
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
if (a == 0) {
return 0;
return 0;
}
}
uint256 c = a * b;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
require(c / a == b, "SafeMath: multiplication overflow");
return c;
return c;
}
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
return div(a, b, "SafeMath: division by zero");
}
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
require(b > 0, errorMessage);
uint256 c = a / b;
uint256 c = a / b;
return c;
return c;
}
}
}
library SafeMathInt {
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
int256 private constant MIN_INT256 = int256(1) << 255;
require(b != 0);
int256 private constant MAX_INT256 = ~(int256(1) << 255);
return a % b;
function mul(int256 a, int256 b) internal pure returns (int256) {
int256 c = a * b;
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));
require((b == 0) || (c / b == a));
return c;
}
}
}
function div(int256 a, int256 b) internal pure returns (int256) {
interface InterfaceLP {
require(b != -1 || a != MIN_INT256);
function sync() external;
}
return a / b;
library Roles {
struct Role {
mapping (address => bool) bearer;
}
}
function sub(int256 a, int256 b) internal pure returns (int256) {
/**
int256 c = a - b;
* @dev Give an account access to this role.
require((b >= 0 && c <= a) || (b < 0 && c > a));
*/
return c;
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
}
function add(int256 a, int256 b) internal pure returns (int256) {
/**
int256 c = a + b;
* @dev Remove an account's access to this role.
require((b >= 0 && c >= a) || (b < 0 && c < a));
*/
return c;
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
}
function abs(int256 a) internal pure returns (int256) {
/**
require(a != MIN_INT256);
* @dev Check if an account has this role.
return a < 0 ? -a : a;
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
}
}
/**
contract MinterRole {
* BEP20 standard interface.
using Roles for Roles.Role;
*/
interface IBEP20 {
event MinterAdded(address indexed account);
function totalSupply() external view returns (uint256);
event MinterRemoved(address indexed account);
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);
}
abstract contract Auth {
Roles.Role private _minters;
address internal owner;
mapping (address => bool) internal authorizations;
constructor(address _owner) {
constructor () {
owner = _owner;
_addMinter(msg.sender);
authorizations[_owner] = true;
}
}
modifier onlyOwner() {
modifier onlyMinter() {
require(isOwner(msg.sender), "!OWNER"); _;
require(isMinter(msg.sender), "MinterRole: caller does not have the Minter role");
_;
}
}
modifier authorized() {
function isMinter(address account) public view returns (bool) {
require(isAuthorized(msg.sender), "!AUTHORIZED"); _;
return _minters.has(account);
}
}
function authorize(address adr) public onlyOwner {
function renounceMinter() public {
authorizations[adr] = true;
_removeMinter(msg.sender);
}
}
function unauthorize(address adr) public onlyOwner {
function _addMinter(address account) internal {
authorizations[adr] = false;
_minters.add(account);
emit MinterAdded(account);
}
}
function isOwner(address account) public view returns (bool) {
function _removeMinter(address account) internal {
return account == owner;
_minters.remove(account);
emit MinterRemoved(account);
}
}
}
function isAuthorized(address adr) public view returns (bool) {
abstract contract ERC20Detailed is IERC20 {
return authorizations[adr];
string private _name;
}
string private _symbol;
uint8 private _decimals;
function transferOwnership(address payable adr) public onlyOwner {
constructor(
owner = adr;
string memory name,
authorizations[adr] = true;
string memory symbol,
emit OwnershipTransferred(adr);
uint8 decimals
) {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
}
event OwnershipTransferred(address owner);
function name() public view returns (string memory) {
}
return _name;
}
interface IDEXFactory {
function symbol() public view returns (string memory) {
function createPair(address tokenA, address tokenB) external returns (address pair);
return _symbol;
}
}
interface InterfaceLP {
function decimals() public view returns (uint8) {
function sync() external;
return _decimals;
}
}
}
interface IDEXRouter {
interface IDEXRouter {
function factory() external pure returns (address);
function factory() external pure returns (address);
function WETH() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
function addLiquidity(
address tokenA,
address tokenA,
address tokenB,
address tokenB,
uint amountADesired,
uint256 amountADesired,
uint amountBDesired,
uint256 amountBDesired,
uint amountAMin,
uint256 amountAMin,
uint amountBMin,
uint256 amountBMin,
address to,
address to,
uint deadline
uint256 deadline
) external returns (uint amountA, uint amountB, uint liquidity);
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
function addLiquidityETH(
address token,
address token,
uint amountTokenDesired,
uint256 amountTokenDesired,
uint amountTokenMin,
uint256 amountTokenMin,
uint amountETHMin,
uint256 amountETHMin,
address to,
address to,
uint deadline
uint256 deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint256 amountIn,
uint amountOutMin,
uint256 amountOutMin,
address[] calldata path,
address[] calldata path,
address to,
address to,
uint deadline
uint256 deadline
) external;
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
uint256 amountOutMin,
address[] calldata path,
address[] calldata path,
address to,
address to,
uint deadline
uint256 deadline
) external payable;
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint256 amountIn,
uint amountOutMin,
uint256 amountOutMin,
address[] calldata path,
address[] calldata path,
address to,
address to,
uint deadline
uint256 deadline
) external;
) external;
}
}
interface IDividendDistributor {
interface IDEXFactory {
function setDistributionCriteria(uint256 _minPeriod, uint256 _minDistribution) external;
function createPair(address tokenA, address tokenB)
function setShare(address shareholder, uint256 amount) external;
external
function deposit() external payable;
returns (address pair);
function process(uint256 gas) external;
}
}
contract DividendDistributor is IDividendDistributor {
contract Ownable {
using SafeMath for uint256;
address private _owner;
address _token;
event OwnershipRenounced(address indexed previousOwner);
struct Share {
event OwnershipTransferred(
uint256 amount;
address indexed previousOwner,
uint256 totalExcluded;
address indexed newOwner
uint256 totalRealised;
);
}
IBEP20 RWRD = IBEP20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);
address WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;
IDEXRouter router;
address[] shareholders;
mapping (address => uint256) shareholderIndexes;
mapping (address => uint256) shareholderClaims;
mapping (address => Share) public shares;
uint256 public totalShares;
uint256 public totalDividends;
uint256 public totalDistributed;
uint256 public dividendsPerShare;
uint256 public dividendsPerShareAccuracyFactor = 10 ** 36;
uint256 public minPeriod = 45 * 60;
constructor() {
uint256 public minDistribution = 1 * (10 ** 25);
_owner = msg.sender;
uint256 currentIndex;
bool initialized;
modifier initialization() {
require(!initialized);
_;
initialized = true;
}
}
modifier onlyToken() {
function owner() public view returns (address) {
require(msg.sender == _token); _;
return _owner;
}
}
constructor (address _router) {
modifier onlyOwner() {
router = _router != address(0)
require(isOwner());
? IDEXRouter(_router)
_;
: IDEXRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);
_token = msg.sender;
}
}
function setDistributionCriteria(uint256 _minPeriod, uint256 _minDistribution) external override onlyToken {
function isOwner() public view returns (bool) {
minPeriod = _minPeriod;
return msg.sender == _owner;
minDistribution = _minDistribution;
}
}
function setShare(address shareholder, uint256 amount) external override onlyToken {
function renounceOwnership() public onlyOwner {
if(shares[shareholder].amount > 0){
emit OwnershipRenounced(_owner);
distributeDividend(shareholder);
_owner = address(0);
}
if(amount > 0 && shares[shareholder].amount == 0){
addShareholder(shareholder);
}else if(amount == 0 && shares[shareholder].amount > 0){
removeShareholder(shareholder);
}
totalShares = totalShares.sub(shares[shareholder].amount).add(amount);
shares[shareholder].amount = amount;
shares[shareholder].totalExcluded = getCumulativeDividends(shares[shareholder].amount);
}
}
function deposit() external payable override onlyToken {
function transferOwnership(address newOwner) public onlyOwner {
uint256 balanceBefore = RWRD.balanceOf(address(this));
_transferOwnership(newOwner);
address[] memory path = new address[](2);
path[0] = WBNB;
path[1] = address(RWRD);
router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: msg.value}(
0,
path,
address(this),
block.timestamp
);
uint256 amount = RWRD.balanceOf(address(this)).sub(balanceBefore);
totalDividends = totalDividends.add(amount);
dividendsPerShare = dividendsPerShare.add(dividendsPerShareAccuracyFactor.mul(amount).div(totalShares));
}
}
function process(uint256 gas) external override onlyToken {
function _transferOwnership(address newOwner) internal {
uint256 shareholderCount = shareholders.length;
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
if(shareholderCount == 0) { return; }
_owner = newOwner;
uint256 gasUsed = 0;
uint256 gasLeft = gasleft();
uint256 iterations = 0;
while(gasUsed < gas && iterations < shareholderCount) {
if(currentIndex >= shareholderCount){
currentIndex = 0;
}
if(shouldDistribute(shareholders[currentIndex])){
distributeDividend(shareholders[currentIndex]);
}
gasUsed = gasUsed.add(gasLeft.sub(gasleft()));
gasLeft = gasleft();
currentIndex++;
iterations++;
}
}
}
}
function shouldDistribute(address shareholder) internal view returns (bool) {
return shareholderClaims[shareholder] + minPeriod < block.timestamp
&& getUnpaidEarnings(shareholder) > minDistribution;
}
function distributeDividend(address shareholder) internal {
contract Xprotocol is ERC20Detailed, Ownable, MinterRole {
if(shares[shareholder].amount == 0){ return; }
using SafeMath for uint256;
using SafeMathInt for int256;
uint256 amount = getUnpaidEarnings(shareholder);
event LogRebase(uint256 indexed epoch, uint256 totalSupply);
if(amount > 0){
totalDistributed = totalDistributed.add(amount);
RWRD.transfer(shareholder, amount);
shareholderClaims[shareholder] = block.timestamp;
shares[shareholder].totalRealised = shares[shareholder].totalRealised.add(amount);
shares[shareholder].totalExcluded = getCumulativeDividends(shares[shareholder].amount);
}
}
function claimDividend() external {
distributeDividend(msg.sender);
}
function getUnpaidEarnings(address shareholder) public view returns (uint256) {
InterfaceLP public pairContract;
if(shares[shareholder].amount == 0){ return 0; }
uint256 shareholderTotalDividends = getCumulativeDividends(shares[shareholder].amount);
bool public initialDistributionFinished;
uint256 shareholderTotalExcluded = shares[shareholder].totalExcluded;
if(shareholderTotalDividends <= shareholderTotalExcluded){ return 0; }
mapping(address => bool) allowTransfer;
mapping(address => bool) _isFeeExempt;
return shareholderTotalDividends.sub(shareholderTotalExcluded);
modifier initialDistributionLock() {
require(
initialDistributionFinished ||
isOwner() ||
allowTransfer[msg.sender]
);
_;
}
}
function getCumulativeDividends(uint256 share) internal view returns (uint256) {
modifier validRecipient(address to) {
return share.mul(dividendsPerShare).div(dividendsPerShareAccuracyFactor);
require(to != address(0x0));
_;
}
}
function addShareholder(address shareholder) internal {
uint256 private constant DECIMALS = 18;
shareholderIndexes[shareholder] = shareholders.length;
uint256 private constant MAX_UINT256 = ~uint256(0);
shareholders.push(shareholder);
}
function removeShareholder(address shareholder) internal {
uint256 private constant INITIAL_FRAGMENTS_SUPPLY = 4 * 10**9 * 10**DECIMALS;
shareholders[shareholderIndexes[shareholder]] = shareholders[shareholders.length-1];
shareholderIndexes[shareholders[shareholders.length-1]] = shareholderIndexes[shareholder];
shareholders.pop();
}
}
contract Quantic is IBEP20, Auth {
uint256 public liquidityFee = 5;
using SafeMath for uint256;
uint256 public Treasury = 3;
using SafeMathInt for int256;
uint256 public RiskFreeValue = 5;
uint256 public sellFee = 5;
uint256 public totalFee = liquidityFee.add(Treasury).add(RiskFreeValue);
uint256 public feeDenominator = 100;
address WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;
address DEAD = 0x000000000000000000000000000000000000dEaD;
address DEAD = 0x000000000000000000000000000000000000dEaD;
address ZERO = 0x0000000000000000000000000000000000000000;
address ZERO = 0x0000000000000000000000000000000000000000;
string constant _name = "Quantic";
string constant _symbol = "Quantic";
uint8 constant _decimals = 18;
//mapping (address => uint256) _balances;
mapping (address => uint256) _rBalance;
mapping (address => mapping (address => uint256)) _allowances;
mapping (address => bool) public isFeeExempt;
mapping (address => bool) public isTxLimitExempt;
mapping (address => bool) public isTimelockExempt;
mapping (address => bool) public isDividendExempt;
uint256 public liquidityFee = 5;
uint256 public reflectionFee = 3;
uint256 public treasuryFee = 3;
uint256 public sustainabilityFee = 5;
uint256 public totalFee = treasuryFee + reflectionFee + liquidityFee + sustainabilityFee;
uint256 public feeDenominator = 100;
// Anti-Bot v2
uint256 public maxRoomRent = 8000000000;
bool public blacklistMode = true;
mapping (address => bool) public isBlacklisted;
uint256 public deadBlocks = 1;
uint256 public launchedAt = 0;
uint256 public sellMultiplier = 111;
address public autoLiquidityReceiver;
address public autoLiquidityReceiver;
address public treasuryFeeReceiver;
address public TreasuryReceiver;
address public sustainabilityFeeReceiver;
address public RiskFreeValueReceiver;
uint256 targetLiquidity = 90;
uint256 targetLiquidity = 50;
uint256 targetLiquidityDenominator = 100;
uint256 targetLiquidityDenominator = 100;
IDEXRouter public router;
IDEXRouter public router;
address public pair;
address public pair;
InterfaceLP public pairContract;
bool public tradingOpen = false;
DividendDistributor public distributor;
uint256 distributorGas = 500000;
bool public buyCooldownEnabled = true;
uint8 public cooldownTimerInterval = 15;
mapping (address => uint) private cooldownTimer;
bool public swapEnabled = true;
bool public swapEnabled = true;
uint256 private gonSwapThreshold = (TOTAL_GONS * 10) / 10000;
bool inSwap;
bool inSwap;
modifier swapping() { inSwap = true; _; inSwap = false; }
modifier swapping() {
inSwap = true;
address public master;
modifier onlyMaster() {
require(msg.sender == master || isOwner(msg.sender));
_;
_;
inSwap = false;
}
}
event LogRebase(uint256 indexed epoch, uint256 totalSupply);
uint256 private constant TOTAL_GONS =
MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY);
uint256 private constant INITIAL_FRAGMENTS_SUPPLY = 4 * 10**9 * 10**_decimals;
uint256 public swapThreshold = rSupply * 10 / 10000;
uint256 public rebase_count = 0;
uint256 public rate;
uint256 public _totalSupply;
uint256 private constant MAX_UINT256 = ~uint256(0);
uint256 private constant MAX_SUPPLY = ~uint128(0);
uint256 private constant MAX_SUPPLY = ~uint128(0);
uint256 private constant rSupply = MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY);
uint256 private _totalSupply;
uint256 private _gonsPerFragment;
mapping(address => uint256) private _gonBalances;
mapping(address => mapping(address => uint256)) private _allowedFragments;
mapping(address => bool) public blacklist;
constructor() ERC20Detailed("Xprotocol", "XPT", uint8(DECIMALS)) {
router = IDEXRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E); //Sushi 0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506 // Cake 0x10ED43C718714eb63d5aA57B78B54704E256024E
pair = IDEXFactory(router.factory()).createPair(
router.WETH(),
address(this)
);
autoLiquidityReceiver = 0x1d285c2Aa376eA3bb22fa794e398EDa698853dAE;
TreasuryReceiver = 0xBE39cCC7d570Ff7D6e25f8B1E7Cc4C07b61fdfCb;
RiskFreeValueReceiver = 0x1318aFA72C50E38b1a22d3FEd0E3eDA1FC013A60;
_allowedFragments[address(this)][address(router)] = uint256(-1);
pairContract = InterfaceLP(pair);
// Max wallet & Transaction
_totalSupply = INITIAL_FRAGMENTS_SUPPLY;
uint256 public _maxTxAmount = rSupply.div(100).mul(1);
_gonBalances[TreasuryReceiver] = TOTAL_GONS;
uint256 public _maxWalletToken = rSupply.div(100).mul(2);
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
function rebase_percentage(uint256 _percentage_base1000, bool reduce) external onlyMaster returns (uint256 newSupply){
initialDistributionFinished = false;
_isFeeExempt[TreasuryReceiver] = true;
_isFeeExempt[address(this)] = true;
if(reduce){
_transferOwnership(TreasuryReceiver);
newSupply = rebase(0,int(_totalSupply.div(1000000000).mul(_percentage_base1000)).mul(-1));
emit Transfer(address(0x0), TreasuryReceiver, _totalSupply);
} else{
newSupply = rebase(0,int(_totalSupply.div(1000000000).mul(_percentage_base1000)));
}
}
}
// Sauce
function updateBlacklist(address _user, bool _flag) public onlyOwner{
function rebase(uint256 epoch, int256 supplyDelta) public onlyMaster returns (uint256) {
blacklist[_user] = _flag;
rebase_count++;
}
if(epoch == 0){
epoch = rebase_count;
}
function rebase(uint256 epoch, int256 supplyDelta)
external
onlyOwner
returns (uint256)
{
require(!inSwap, "Try again");
require(!inSwap, "Try again");
if (supplyDelta == 0) {
if (supplyDelta == 0) {
emit LogRebase(epoch, _totalSupply);
emit LogRebase(epoch, _totalSupply);
return _totalSupply;
return _totalSupply;
}
}
if (supplyDelta < 0) {
if (supplyDelta < 0) {
_totalSupply = _totalSupply.sub(uint256(-supplyDelta));
_totalSupply = _totalSupply.sub(uint256(-supplyDelta));
} else {
} else {
_totalSupply = _totalSupply.add(uint256(supplyDelta));
_totalSupply = _totalSupply.add(uint256(supplyDelta));
}
}
if (_totalSupply > MAX_SUPPLY) {
if (_totalSupply > MAX_SUPPLY) {
_totalSupply = MAX_SUPPLY;
_totalSupply = MAX_SUPPLY;
}
}
rate = rSupply.div(_totalSupply);
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
pairContract.sync();
pairContract.sync();
emit LogRebase(epoch, _totalSupply);
emit LogRebase(epoch, _totalSupply);
return _totalSupply;
return _totalSupply;
}
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function transfer(address to, uint256 value)
external
override
validRecipient(to)
initialDistributionLock
returns (bool)
{
_transferFrom(msg.sender, to, value);
return true;
}
constructor () Auth(msg.sender) {
function setLP(address _address) external onlyOwner {
router = IDEXRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);
pairContract = InterfaceLP(_address);
pair = IDEXFactory(router.factory()).createPair(WBNB, address(this));
_isFeeExempt[_address];
_allowances[address(this)][address(router)] = uint256(-1);
}
function allowance(address owner_, address spender)
pairContract = InterfaceLP(pair);
external
_totalSupply = INITIAL_FRAGMENTS_SUPPLY;
view
rate = rSupply.div(_totalSupply);
override
returns (uint256)
{
return _allowedFragments[owner_][spender];
}
function balanceOf(address who) external view override returns (uint256) {
return _gonBalances[who].div(_gonsPerFragment);
}
distributor = new DividendDistributor(address(router));
function _basicTransfer(
address from,
address to,
uint256 amount
) internal returns (bool) {
uint256 gonAmount = amount.mul(_gonsPerFragment);
_gonBalances[from] = _gonBalances[from].sub(gonAmount);
_gonBalances[to] = _gonBalances[to].add(gonAmount);
return true;
}
isFeeExempt[msg.sender] = true;
function _transferFrom(
isTxLimitExempt[msg.sender] = true;
address sender,
address recipient,
uint256 amount
) internal returns (bool) {
require(!blacklist[sender] && !blacklist[recipient], 'in_blacklist');
if (inSwap) {
return _basicTransfer(sender, recipient, amount);
}
isTimelockExempt[msg.sender] = true;
uint256 gonAmount = amount.mul(_gonsPerFragment);
isTimelockExempt[DEAD] = true;
isTimelockExempt[address(this)] = true;
if (shouldSwapBack()) {
swapBack();
}
isDividendExempt[pair] = true;
_gonBalances[sender] = _gonBalances[sender].sub(gonAmount);
isDividendExempt[address(this)] = true;
isDividendExempt[DEAD] = true;
autoLiquidityReceiver = msg.sender;
uint256 gonAmountReceived = shouldTakeFee(sender, recipient)
treasuryFeeReceiver = 0x86b9b757c931d10736089D5488367abfb196FdB4;
? takeFee(sender, recipient, gonAmount)
sustainabilityFeeReceiver = 0x199b4354075c457882952AAC87e52Fb5DDB6379D;
: gonAmount;
_gonBalances[recipient] = _gonBalances[recipient].add(
gonAmountReceived
);
_rBalance[msg.sender] = rSupply;
emit Transfer(
emit Transfer(address(0), msg.sender, _totalSupply);
sender,
recipient,
gonAmountReceived.div(_gonsPerFragment)
);
return true;
}
}
receive() external payable { }
function transferFrom(
address from,
address to,
uint256 value
) external override validRecipient(to) returns (bool) {
if (_allowedFragments[from][msg.sender] != uint256(-1)) {
_allowedFragments[from][msg.sender] = _allowedFragments[from][
msg.sender
].sub(value, "Insufficient Allowance");
}
_transferFrom(from, to, value);
return true;
function totalSupply() external view override returns (uint256) { return _totalSupply; }
function decimals() external pure override returns (uint8) { return _decimals; }
function symbol() external pure override returns (string memory) { return _symbol; }
function name() external pure override returns (string memory) { return _name; }
function getOwner() external view override returns (address) { return owner; }
function balanceOf(address account) public view override returns (uint256) {
return _rBalance[account].div(rate);
}
}
function allowance(address holder, address spender) external view override returns (uint256) { return _allowances[holder][spender]; }
function approve(address spender, uint256 amount) public override returns (bool) {
function swapBack() internal swapping {
_allowances[msg.sender][spender] = amount;
uint256 dynamicLiquidityFee = isOverLiquified(
emit Approval(msg.sender, spender, amount);
targetLiquidity,
return true;
targetLiquidityDenominator
}
)
? 0
: liquidityFee;
uint256 contractTokenBalance = _gonBalances[address(this)].div(
_gonsPerFragment
);
uint256 amountToLiquify = contractTokenBalance
.mul(dynamicLiquidityFee)
.div(totalFee)
.div(2);
uint256 amountToSwap = contractTokenBalance.sub(amountToLiquify);
address[] memory path = new address[](2);
path[0] = address(this);
function approveMax(address spender) external returns (bool) {
path[1] = router.WETH();
return approve(spender, uint256(-1));
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
uint256 balanceBefore = address(this).balance;
return _transferFrom(msg.sender, recipient, amount);
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
if(_allowances[sender][msg.sender] != uint256(-1)){
amountToSwap,
_allowances[sender][msg.sender] = _allowances[sender][msg.sender].sub(amount, "Insufficient Allowance");
0,
}
path,
address(this),
block.timestamp
);
return _transferFrom(sender, recipient, amount);
uint256 amountETH = address(this).balance.sub(balanceBefore);
}
function _transferFrom(address sender, address recipient, uint256 amount) internal returns (bool) {
uint256 totalETHFee = totalFee.sub(dynamicLiquidityFee.div(2));
if(inSwap){ return _basicTransfer(sender, recipient, amount); }
if(!authorizations[sender] && !authorizations[recipient]){
uint256 amountETHLiquidity = amountETH
require(tradingOpen,"Trading not open yet");
.mul(dynamicLiquidityFee)
}
.div(totalETHFee)
.div(2);
uint256 amountETHRiskFreeValue = amountETH.mul(RiskFreeValue).div(totalETHFee);
uint256 amountETHTreasury = amountETH.mul(Treasury).div(
totalETHFee
);
uint256 rAmount = amount.mul(rate);
(bool success, ) = payable(TreasuryReceiver).call{
value: amountETHTreasury,
gas: 30000
}("");
(success, ) = payable(RiskFreeValueReceiver).call{
value: amountETHRiskFreeValue,
gas: 30000
}("");
if (!authorizations[sender] && recipient != address(this) && recipient != address(DEAD) && recipient != pair && recipient != treasuryFeeReceiver && recipient != sustainabilityFeeReceiver && recipient != autoLiquidityReceiver){
success = false;
uint256 heldTokens = balanceOf(recipient);
require((heldTokens + rAmount) <= _maxWalletToken,"Total Holding is currently limited, you can not buy that much.");}
if (sender == pair &&
buyCooldownEnabled &&
!isTimelockExempt[recipient]) {
require(cooldownTimer[recipient] < block.timestamp,"buy Cooldown exists");
cooldownTimer[recipient] = block.timestamp + cooldownTimerInterval;
}
// Blacklist
if (amountToLiquify > 0) {
if(blacklistMode){
router.addLiquidityETH{value: amountETHLiquidity}(
require(!isBlacklisted[sender] && !isBlacklisted[recipient],"Blacklisted");
address(this),
amountToLiquify,
0,
0,
autoLiquidityReceiver,
block.timestamp
);
}
}
}
// Checks max transaction limit
checkTxLimit(sender, rAmount);
if(shouldSwapBack()){ swapBack(); }
function takeFee(address sender, address recipient, uint256 gonAmount)
internal
returns (uint256)
{
uint256 _totalFee = totalFee;
if(recipient == pair) _totalFee = _totalFee.add(sellFee);
//Exchange tokens
uint256 feeAmount = gonAmount.mul(_totalFee).div(feeDenominator);
_rBalance[sender] = _rBalance[sender].sub(rAmount, "Insufficient Balance");
uint256 amountReceived = (!shouldTakeFee(sender) || !shouldTakeFee(recipient)) ? rAmount : takeFee(sender, rAmount,(recipient == pair));
_gonBalances[address(this)] = _gonBalances[address(this)].add(
_rBalance[recipient] = _rBalance[recipient].add(amountReceived);
feeAmount
);
emit Transfer(sender, address(this), feeAmount.div(_gonsPerFragment));
// Dividend tracker
return gonAmount.sub(feeAmount);
if(!isDividendExempt[sender]) {
}
try distributor.setShare(sender, balanceOf(sender)) {} catch {}
}
if(!isDividendExempt[recipient]) {
function decreaseAllowance(address spender, uint256 subtractedValue)
try distributor.setShare(recipient, balanceOf(recipient)) {} catch {}
external
initialDistributionLock
returns (bool)
{
uint256 oldValue = _allowedFragments[msg.sender][spender];
if (subtractedValue >= oldValue) {
_allowedFragments[msg.sender][spender] = 0;
} else {
_allowedFragments[msg.sender][spender] = oldValue.sub(
subtractedValue
);
}
}
emit Approval(
msg.sender,
spender,
_allowedFragments[msg.sender][spender]
);
return true;
}
try distributor.process(distributorGas) {} catch {}
function increaseAllowance(address spender, uint256 addedValue)
external
emit Transfer(sender, recipient, amountReceived.div(rate));
initialDistributionLock
returns (bool)
{
_allowedFragments[msg.sender][spender] = _allowedFragments[msg.sender][
spender
].add(addedValue);
emit Approval(
msg.sender,
spender,
_allowedFragments[msg.sender][spender]
);
return true;
return true;
}
}
// Changed
function approve(address spender, uint256 value)
external
function _basicTransfer(address sender, address recipient, uint256 amount) internal returns (bool) {
override
uint256 rAmount = amount.mul(rate);
initialDistributionLock
_rBalance[sender] = _rBalance[sender].sub(rAmount, "Insufficient Balance");
returns (bool)
_rBalance[recipient] = _rBalance[recipient].add(rAmount);
{
emit Transfer(sender, recipient, rAmount.div(rate));
_allowedFragments[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
return true;
}
}
function checkTxLimit(address sender, uint256 rAmount) internal view {
function checkFeeExempt(address _addr) external view returns (bool) {
require(rAmount <= _maxTxAmount || isTxLimitExempt[sender], "TX Limit Exceeded");
return _isFeeExempt[_addr];
}
}
function shouldTakeFee(address sender) internal view returns (bool) {
function setInitialDistributionFinished() external onlyOwner {
return !isFeeExempt[sender];
initialDistributionFinished = true;
}
}
function enableTransfer(address _addr) external onlyOwner {
allowTransfer[_addr] = true;
}
function takeFee(address sender, uint256 rAmount, bool isSell) internal returns (uint256) {
function setFeeExempt(address _addr) external onlyOwner {
_isFeeExempt[_addr] = true;
uint256 multiplier = 100;
}
if(isSell){
multiplier = sellMultiplier;
function shouldTakeFee(address from, address to) internal view returns (bool) {
}
return (pair == from || pair == to) && (!_isFeeExempt[from]);
}
uint256 feeAmount = rAmount.div(feeDenominator * 100).mul(totalFee).mul(multiplier);
function mint(address recipient, uint256 amount) external onlyMinter {
_totalSupply = _totalSupply.add(uint256(amount));
if(!isSell && (launchedAt + deadBlocks) > block.number){
if (_totalSupply > MAX_SUPPLY) {
feeAmount = rAmount.div(100).mul(99);
_totalSupply = MAX_SUPPLY;
}
}
_rBalance[address(this)] = _rBalance[address(this)].add(feeAmount);
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
emit Transfer(sender, address(this), feeAmount.div(rate));
pairContract.sync();
_gonBalances[recipient] = _gonBalances[recipient].add(amount);
}
return rAmount.sub(feeAmount);
function setSwapBackSettings(
bool _enabled,
uint256 _num,
uint256 _denom
) external onlyOwner {
swapEnabled = _enabled;
gonSwapThreshold = TOTAL_GONS.div(_denom).mul(_num);
}
}
function shouldSwapBack() internal view returns (bool) {
function shouldSwapBack() internal view returns (bool) {
return msg.sender != pair
return
&& !inSwap
msg.sender != pair &&
&& swapEnabled
!inSwap &&
&& _rBalance[address(this)] >= swapThreshold;
swapEnabled &&
_gonBalances[address(this)] >= gonSwapThreshold;
}
}
function getCirculatingSupply() public view returns (uint256) {
return
(TOTAL_GONS.sub(_gonBalances[DEAD]).sub(_gonBalances[ZERO])).div(
_gonsPerFragment
);
}
function clearStuckBalance(uint256 amountPercentage) external authorized {
function setTargetLiquidity(uint256 target, uint256 accuracy) external onlyOwner {
uint256 amountBNB = address(this).balance;
targetLiquidity = target;
payable(treasuryFeeReceiver).transfer(amountBNB * amountPercentage / 100);
targetLiquidityDenominator = accuracy;
}
}
function addMinter(address account) public onlyOwner {
_addMinter(account);
function clearStuckBalance_sender(uint256 amountPercentage) external authorized {
uint256 amountBNB = address(this).balance;
payable(msg.sender).transfer(amountBNB * amountPercentage / 100);
}
}
function removeMinter(address account) public onlyOwner {
_removeMinter(account);
function set_sell_multiplier(uint256 Multiplier) external onlyOwner{
sellMultiplier = Multiplier;
require(Multiplier < 120, "Sell Fees cannot exceed more than 20% of the buy tax");
}
}
// switch Trading
function isNotInSwap() external view returns (bool) {
return !inSwap;
function tradingStatus(bool _status, uint256 _deadBlocks) external onlyOwner {
tradingOpen = _status;
if(tradingOpen && launchedAt == 0){
launchedAt = block.number;
deadBlocks = _deadBlocks;
}
}
}
function launchStatus(uint256 _launchblock) external onlyOwner {
function sendPresale(address[] calldata recipients, uint256[] calldata values)
launchedAt = _launchblock;
external
onlyOwner
{
for (uint256 i = 0; i < recipients.length; i++) {
_transferFrom(msg.sender, recipients[i], values[i]);
}