Token 10X: Africa's First Cryptocurrency Hub
EverINVESTS Token
Welcome to EverINVESTS Community
Biggest Fixed APY %u2013 385,945.80%
Auto Dual Reward
BUSD Dividend every 1 Hour
Get Rewards Every 15 Minutes / 96 Times Daily!
...
About EverINVESTS
Welcome to EverINVESTS Community
Biggest Fixed APY %u2013 385,945.80%
Auto Dual Reward
BUSD Dividend every 1 Hour
Get Rewards Every 15 Minutes / 96 Times Daily!
Biggest Fixed APY %u2013 385,945.80%
Auto Dual Reward
BUSD Dividend every 1 Hour
Get Rewards Every 15 Minutes / 96 Times Daily!
62 total visits
Token information and links
Circulating Supply
32500000000
Token Contract (BSC Chain)
0XB8D69180C82CDF6558C596FA89F54D39F5418A8E
Contract license: None
Launch Date
07/07/2022
KYC Information
No
Audit Information
None
Team Information
Team leader: None
Team leader contact: None
Contract source code
/**
*Submitted for verification at BscScan.com on 2022-07-07
*/
// SPDX-License-Identifier: Unlicensed
/**
* EverGrow Safuu Protocol EverSAFU = EverINVESTS Dual Reward with BUSD Dividend
* EverINVESTS Token
* Dual Reward with Auto-Staking, Auto-Compounding & BUSD Reflection
*
* Twitter : https://twitter.com/everinvests
* Telegram : https://t.me/ EbMiBmRyk905YTEy
*/
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;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
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);
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
);
}
interface IPancakeSwapPair {
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;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IPancakeSwapRouter{
function factory() external pure returns (address);
function WETH() external pure returns (address);
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 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);
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;
}
interface IPancakeSwapFactory {
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 IDividendDistributor {
function setDistributionCriteria(uint256 _minPeriod, uint256 _minDistribution) external;
function setShare(address shareholder, uint256 amount) external;
function deposit() external payable;
function process(uint256 gas) external;
}
contract DividendDistributor is IDividendDistributor {
using SafeMath for uint256;
address _token;
struct Share {
uint256 amount;
uint256 totalExcluded;
uint256 totalRealised;
}
IERC20 BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);
//address WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;
IPancakeSwapRouter 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 currentIndex;
uint256 public dividendsPerShareAccuracyFactor = 10 ** 36;
uint256 public minPeriod = 1 hours;
uint256 public minDistribution = 1 * (10 ** 18);
bool initialized;
modifier initialization() {
require(!initialized);
_;
initialized = true;
}
modifier onlyToken() {
require(msg.sender == _token); _;
}
constructor (address _router) {
router = _router != address(0)
? IPancakeSwapRouter(_router)
: IPancakeSwapRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);
_token = msg.sender;
}
function setDistributionCriteria(uint256 _minPeriod, uint256 _minDistribution) external override onlyToken {
minPeriod = _minPeriod;
minDistribution = _minDistribution;
}
function setShare(address shareholder, uint256 amount) external override onlyToken {
if(shares[shareholder].amount > 0){
distributeDividend(shareholder);
}
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 {
uint256 balanceBefore = BUSD.balanceOf(address(this));
address[] memory path = new address[](2);
path[0] = router.WETH();
path[1] = address(BUSD);
router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: msg.value}(
0,
path,
address(this),
block.timestamp
);
uint256 amount = BUSD.balanceOf(address(this)).sub(balanceBefore);
totalDividends = totalDividends.add(amount);
dividendsPerShare = dividendsPerShare.add(dividendsPerShareAccuracyFactor.mul(amount).div(totalShares));
}
function process(uint256 gas) external override onlyToken {
uint256 shareholderCount = shareholders.length;
if(shareholderCount == 0) { return; }
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 {
if(shares[shareholder].amount == 0){ return; }
uint256 amount = getUnpaidEarnings(shareholder);
if(amount > 0){
totalDistributed = totalDistributed.add(amount);
BUSD.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) {
if(shares[shareholder].amount == 0){ return 0; }
uint256 shareholderTotalDividends = getCumulativeDividends(shares[shareholder].amount);
uint256 shareholderTotalExcluded = shares[shareholder].totalExcluded;
if(shareholderTotalDividends <= shareholderTotalExcluded){ return 0; }
return shareholderTotalDividends.sub(shareholderTotalExcluded);
}
function getCumulativeDividends(uint256 share) internal view returns (uint256) {
return share.mul(dividendsPerShare).div(dividendsPerShareAccuracyFactor);
}
function addShareholder(address shareholder) internal {
shareholderIndexes[shareholder] = shareholders.length;
shareholders.push(shareholder);
}
function removeShareholder(address shareholder) internal {
shareholders[shareholderIndexes[shareholder]] = shareholders[shareholders.length-1];
shareholderIndexes[shareholders[shareholders.length-1]] = shareholderIndexes[shareholder];
shareholders.pop();
}
}
contract Ownable {
address private _owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
_owner = msg.sender;
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner());
_;
}
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(_owner);
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
abstract contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(
string memory name_,
string memory symbol_,
uint8 decimals_
) {
_name = name_;
_symbol = symbol_;
_decimals = decimals_;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
contract EverINVESTS is ERC20Detailed, Ownable {
using SafeMath for uint256;
using SafeMathInt for int256;
event LogRebase(uint256 indexed epoch, uint256 totalSupply);
IPancakeSwapPair public pairContract;
mapping(address => bool) _isFeeExempt;
modifier validRecipient(address to) {
require(to != address(0x0));
_;
}
uint256 public constant DECIMALS = 5;
uint256 public constant MAX_UINT256 = ~uint256(0);
uint8 public constant RATE_DECIMALS = 7;
uint256 private constant INITIAL_FRAGMENTS_SUPPLY =
325 * 10**3 * 10**DECIMALS;
uint256 public liquidityFee = 20;
uint256 public treasuryFee = 25;
uint256 public safuDividendFee = 70;
uint256 public sellFee = 20;
uint256 public autofirePitFee = 25;
uint256 public totalFee =
liquidityFee.add(treasuryFee).add(safuDividendFee).add(
autofirePitFee
);
uint256 public feeDenominator = 1000;
address DEAD = 0x000000000000000000000000000000000000dEaD;
address ZERO = 0x0000000000000000000000000000000000000000;
address public autoLiquidityReceiver;
address public treasuryReceiver;
DividendDistributor distributor;
address public safuDividendReceiver;
uint256 distributorGas = 500000;
address public autofirePit;
bool public swapEnabled = true;
IPancakeSwapRouter public router;
address public pair;
bool inSwap = false;
modifier swapping() {
inSwap = true;
_;
inSwap = false;
}
uint256 private constant TOTAL_GONS =
MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY);
uint256 private constant MAX_SUPPLY = 325 * 10**7 * 10**DECIMALS;
bool public _autoRebase;
bool public _autoAddLiquidity;
uint256 public _initRebaseStartTime;
uint256 public _lastRebasedTime;
uint256 public _lastAddLiquidityTime;
uint256 public _totalSupply;
uint256 private _gonsPerFragment;
mapping(address => uint256) private _gonBalances;
mapping(address => mapping(address => uint256)) private _allowedFragments;
mapping(address => bool) public blacklist;
mapping(address => bool) public isDividendExempt;
constructor() ERC20Detailed("EverINVESTS", "EverINVESTS", uint8(DECIMALS)) Ownable() {
//testnet
//router = IPancakeSwapRouter(0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3);
//mainnet
router = IPancakeSwapRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);
pair = IPancakeSwapFactory(router.factory()).createPair(
router.WETH(),
address(this)
);
autoLiquidityReceiver = 0x8Eb9742a182AD0999268E892911F126f9E6581B0;
treasuryReceiver = 0x9E06d58aE297598AFcAE849cD272873f5e7F9c7F;
autofirePit = 0x000000000000000000000000000000000000dEaD;
_allowedFragments[address(this)][address(router)] = uint256(-1);
pairContract = IPancakeSwapPair(pair);
distributor = new DividendDistributor(0x10ED43C718714eb63d5aA57B78B54704E256024E);
safuDividendReceiver = address(distributor);
isDividendExempt[msg.sender] = true;
isDividendExempt[pair] = true;
isDividendExempt[address(this)] = true;
isDividendExempt[DEAD] = true;
_totalSupply = INITIAL_FRAGMENTS_SUPPLY;
_gonBalances[treasuryReceiver] = TOTAL_GONS;
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
_initRebaseStartTime = block.timestamp;
_lastRebasedTime = block.timestamp;
_autoRebase = false;
_autoAddLiquidity = true;
_isFeeExempt[treasuryReceiver] = true;
_isFeeExempt[address(this)] = true;
_transferOwnership(treasuryReceiver);
emit Transfer(address(0x0), treasuryReceiver, _totalSupply);
}
function rebase() internal {
if ( inSwap ) return;
uint256 rebaseRate;
uint256 deltaTimeFromInit = block.timestamp - _initRebaseStartTime;
uint256 deltaTime = block.timestamp - _lastRebasedTime;
uint256 times = deltaTime.div(15 minutes);
uint256 epoch = times.mul(15);
if (deltaTimeFromInit < (365 days)) {
rebaseRate = 2355;
} else if (deltaTimeFromInit >= (365 days)) {
rebaseRate = 211;
} else if (deltaTimeFromInit >= ((15 * 365 days) / 10)) {
rebaseRate = 14;
} else if (deltaTimeFromInit >= (7 * 365 days)) {
rebaseRate = 2;
}
for (uint256 i = 0; i < times; i ) {
_totalSupply = _totalSupply
.mul((10**RATE_DECIMALS).add(rebaseRate))
.div(10**RATE_DECIMALS);
}
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
_lastRebasedTime = _lastRebasedTime.add(times.mul(15 minutes));
pairContract.sync();
emit LogRebase(epoch, _totalSupply);
}
function transfer(address to, uint256 value)
external
override
validRecipient(to)
returns (bool)
{
_transferFrom(msg.sender, to, value);
return true;
}
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 _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;
}
function _transferFrom(
address sender,
address recipient,
uint256 amount
) internal returns (bool) {
require(!blacklist[sender] && !blacklist[recipient], "in_blacklist");
if (inSwap) {
return _basicTransfer(sender, recipient, amount);
}
if (shouldRebase()) {
rebase();
}
if (shouldAddLiquidity()) {
addLiquidity();
}
if (shouldSwapBack()) {
swapBack();
}
uint256 gonAmount = amount.mul(_gonsPerFragment);
_gonBalances[sender] = _gonBalances[sender].sub(gonAmount);
uint256 gonAmountReceived = shouldTakeFee(sender, recipient)
? takeFee(sender, recipient, gonAmount)
: gonAmount;
_gonBalances[recipient] = _gonBalances[recipient].add(
gonAmountReceived
);
if(!isDividendExempt[sender]){ try distributor.setShare(sender, balanceOf(sender)) {} catch {} }
if(!isDividendExempt[recipient]){ try distributor.setShare(recipient, balanceOf(recipient)) {} catch {} }
try distributor.process(distributorGas) {} catch {}
emit Transfer(
sender,
recipient,
gonAmountReceived.div(_gonsPerFragment)
);
return true;
}
function takeFee(
address sender,
address recipient,
uint256 gonAmount
) internal returns (uint256) {
uint256 _totalFee = totalFee;
uint256 _treasuryFee = treasuryFee;
if (recipient == pair) {
_totalFee = totalFee.add(sellFee);
_treasuryFee = treasuryFee.add(sellFee);
}
uint256 feeAmount = gonAmount.div(feeDenominator).mul(_totalFee);
_gonBalances[autofirePit] = _gonBalances[autofirePit].add(
gonAmount.div(feeDenominator).mul(autofirePitFee)
);
_gonBalances[address(this)] = _gonBalances[address(this)].add(
gonAmount.div(feeDenominator).mul(_treasuryFee.add(safuDividendFee))
);
_gonBalances[autoLiquidityReceiver] = _gonBalances[autoLiquidityReceiver].add(
gonAmount.div(feeDenominator).mul(liquidityFee)
);
emit Transfer(sender, address(this), feeAmount.div(_gonsPerFragment));
return gonAmount.sub(feeAmount);
}
function addLiquidity() internal swapping {
uint256 autoLiquidityAmount = _gonBalances[autoLiquidityReceiver].div(
_gonsPerFragment
);
_gonBalances[address(this)] = _gonBalances[address(this)].add(
_gonBalances[autoLiquidityReceiver]
);
_gonBalances[autoLiquidityReceiver] = 0;
uint256 amountToLiquify = autoLiquidityAmount.div(2);
uint256 amountToSwap = autoLiquidityAmount.sub(amountToLiquify);
if( amountToSwap == 0 ) {
return;
}
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
uint256 balanceBefore = address(this).balance;
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap,
0,
path,
address(this),
block.timestamp
);
uint256 amountETHLiquidity = address(this).balance.sub(balanceBefore);
if (amountToLiquify > 0&&amountETHLiquidity > 0) {
router.addLiquidityETH{value: amountETHLiquidity}(
address(this),
amountToLiquify,
0,
0,
autoLiquidityReceiver,
block.timestamp
);
}
_lastAddLiquidityTime = block.timestamp;
}
function swapBack() internal swapping {
uint256 amountToSwap = _gonBalances[address(this)].div(_gonsPerFragment);
if( amountToSwap == 0) {
return;
}
uint256 balanceBefore = address(this).balance;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap,
0,
path,
address(this),
block.timestamp
);
uint256 amountETHToTreasuryAndSIF = address(this).balance.sub(
balanceBefore
);
(bool success, ) = payable(treasuryReceiver).call{
value: amountETHToTreasuryAndSIF.mul(treasuryFee).div(
treasuryFee.add(safuDividendFee)
),
gas: 30000
}("");
try distributor.deposit {
value: amountETHToTreasuryAndSIF.mul(safuDividendFee).div(treasuryFee.add(safuDividendFee))
} () {} catch {}
}
function withdrawAllToTreasury() external swapping onlyOwner {
uint256 amountToSwap = _gonBalances[address(this)].div(_gonsPerFragment);
require( amountToSwap > 0,"There is no EverINVESTS token deposited in token contract");
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap,
0,
path,
treasuryReceiver,
block.timestamp
);
}
function shouldTakeFee(address from, address to)
internal
view
returns (bool)
{
return
(pair == from || pair == to) &&
!_isFeeExempt[from];
}
function shouldRebase() internal view returns (bool) {
return
_autoRebase &&
(_totalSupply < MAX_SUPPLY) &&
msg.sender != pair &&
!inSwap &&
block.timestamp >= (_lastRebasedTime 15 minutes);
}
function shouldAddLiquidity() internal view returns (bool) {
return
_autoAddLiquidity &&
!inSwap &&
msg.sender != pair &&
block.timestamp >= (_lastAddLiquidityTime 2 days);
}
function shouldSwapBack() internal view returns (bool) {
return
!inSwap &&
msg.sender != pair ;
}
function setAutoRebase(bool _flag) external onlyOwner {
if (_flag) {
_autoRebase = _flag;
_lastRebasedTime = block.timestamp;
} else {
_autoRebase = _flag;
}
}
function setAutoAddLiquidity(bool _flag) external onlyOwner {
if(_flag) {
_autoAddLiquidity = _flag;
_lastAddLiquidityTime = block.timestamp;
} else {
_autoAddLiquidity = _flag;
}
}
function allowance(address owner_, address spender)
external
view
override
returns (uint256)
{
return _allowedFragments[owner_][spender];
}
function decreaseAllowance(address spender, uint256 subtractedValue)
external
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;
}
function increaseAllowance(address spender, uint256 addedValue)
external
returns (bool)
{
_allowedFragments[msg.sender][spender] = _allowedFragments[msg.sender][
spender
].add(addedValue);
emit Approval(
msg.sender,
spender,
_allowedFragments[msg.sender][spender]
);
return true;
}
function approve(address spender, uint256 value)
external
override
returns (bool)
{
_allowedFragments[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function checkFeeExempt(address _addr) external view returns (bool) {
return _isFeeExempt[_addr];
}
function setIsDividendExempt(address holder, bool exempt) external onlyOwner {
require(holder != address(this) && holder != pair);
isDividendExempt[holder] = exempt;
if (exempt) {
distributor.setShare(holder, 0);
} else {
distributor.setShare(holder, balanceOf(holder));
}
}
function setDistributionCriteria(uint256 _minPeriod, uint256 _minDistribution) external onlyOwner {
distributor.setDistributionCriteria(_minPeriod, _minDistribution);
}
function setDistributorSettings(uint256 gas) external onlyOwner {
require(gas < 750000, "Gas must be lower than 750000");
distributorGas = gas;
}
function getCirculatingSupply() public view returns (uint256) {
return
(TOTAL_GONS.sub(_gonBalances[DEAD]).sub(_gonBalances[ZERO])).div(
_gonsPerFragment
);
}
function isNotInSwap() external view returns (bool) {
return !inSwap;
}
function manualSync() external {
IPancakeSwapPair(pair).sync();
}
function setFeeReceivers(
address _autoLiquidityReceiver,
address _treasuryReceiver,
address _autofirePit
) external onlyOwner {
autoLiquidityReceiver = _autoLiquidityReceiver;
treasuryReceiver = _treasuryReceiver;
autofirePit = _autofirePit;
}
function getLiquidityBacking(uint256 accuracy)
public
view
returns (uint256)
{
uint256 liquidityBalance = _gonBalances[pair].div(_gonsPerFragment);
return
accuracy.mul(liquidityBalance.mul(2)).div(getCirculatingSupply());
}
function setWhitelist(address _addr) external onlyOwner {
_isFeeExempt[_addr] = true;
}
function setBotBlacklist(address _botAddress, bool _flag) external onlyOwner {
require(isContract(_botAddress), "only contract address, not allowed externally owned account");
blacklist[_botAddress] = _flag;
}
function setLP(address _address) external onlyOwner {
pairContract = IPancakeSwapPair(_address);
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _gonBalances[account].div(_gonsPerFragment);
}
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) }
return size > 0;
}
receive() external payable {}
}
*Submitted for verification at BscScan.com on 2022-07-07
*/
// SPDX-License-Identifier: Unlicensed
/**
* EverGrow Safuu Protocol EverSAFU = EverINVESTS Dual Reward with BUSD Dividend
* EverINVESTS Token
* Dual Reward with Auto-Staking, Auto-Compounding & BUSD Reflection
*
* Twitter : https://twitter.com/everinvests
* Telegram : https://t.me/ EbMiBmRyk905YTEy
*/
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;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
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);
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
);
}
interface IPancakeSwapPair {
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;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IPancakeSwapRouter{
function factory() external pure returns (address);
function WETH() external pure returns (address);
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 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);
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;
}
interface IPancakeSwapFactory {
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 IDividendDistributor {
function setDistributionCriteria(uint256 _minPeriod, uint256 _minDistribution) external;
function setShare(address shareholder, uint256 amount) external;
function deposit() external payable;
function process(uint256 gas) external;
}
contract DividendDistributor is IDividendDistributor {
using SafeMath for uint256;
address _token;
struct Share {
uint256 amount;
uint256 totalExcluded;
uint256 totalRealised;
}
IERC20 BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);
//address WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;
IPancakeSwapRouter 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 currentIndex;
uint256 public dividendsPerShareAccuracyFactor = 10 ** 36;
uint256 public minPeriod = 1 hours;
uint256 public minDistribution = 1 * (10 ** 18);
bool initialized;
modifier initialization() {
require(!initialized);
_;
initialized = true;
}
modifier onlyToken() {
require(msg.sender == _token); _;
}
constructor (address _router) {
router = _router != address(0)
? IPancakeSwapRouter(_router)
: IPancakeSwapRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);
_token = msg.sender;
}
function setDistributionCriteria(uint256 _minPeriod, uint256 _minDistribution) external override onlyToken {
minPeriod = _minPeriod;
minDistribution = _minDistribution;
}
function setShare(address shareholder, uint256 amount) external override onlyToken {
if(shares[shareholder].amount > 0){
distributeDividend(shareholder);
}
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 {
uint256 balanceBefore = BUSD.balanceOf(address(this));
address[] memory path = new address[](2);
path[0] = router.WETH();
path[1] = address(BUSD);
router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: msg.value}(
0,
path,
address(this),
block.timestamp
);
uint256 amount = BUSD.balanceOf(address(this)).sub(balanceBefore);
totalDividends = totalDividends.add(amount);
dividendsPerShare = dividendsPerShare.add(dividendsPerShareAccuracyFactor.mul(amount).div(totalShares));
}
function process(uint256 gas) external override onlyToken {
uint256 shareholderCount = shareholders.length;
if(shareholderCount == 0) { return; }
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 {
if(shares[shareholder].amount == 0){ return; }
uint256 amount = getUnpaidEarnings(shareholder);
if(amount > 0){
totalDistributed = totalDistributed.add(amount);
BUSD.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) {
if(shares[shareholder].amount == 0){ return 0; }
uint256 shareholderTotalDividends = getCumulativeDividends(shares[shareholder].amount);
uint256 shareholderTotalExcluded = shares[shareholder].totalExcluded;
if(shareholderTotalDividends <= shareholderTotalExcluded){ return 0; }
return shareholderTotalDividends.sub(shareholderTotalExcluded);
}
function getCumulativeDividends(uint256 share) internal view returns (uint256) {
return share.mul(dividendsPerShare).div(dividendsPerShareAccuracyFactor);
}
function addShareholder(address shareholder) internal {
shareholderIndexes[shareholder] = shareholders.length;
shareholders.push(shareholder);
}
function removeShareholder(address shareholder) internal {
shareholders[shareholderIndexes[shareholder]] = shareholders[shareholders.length-1];
shareholderIndexes[shareholders[shareholders.length-1]] = shareholderIndexes[shareholder];
shareholders.pop();
}
}
contract Ownable {
address private _owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
_owner = msg.sender;
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner());
_;
}
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(_owner);
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
abstract contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(
string memory name_,
string memory symbol_,
uint8 decimals_
) {
_name = name_;
_symbol = symbol_;
_decimals = decimals_;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
contract EverINVESTS is ERC20Detailed, Ownable {
using SafeMath for uint256;
using SafeMathInt for int256;
event LogRebase(uint256 indexed epoch, uint256 totalSupply);
IPancakeSwapPair public pairContract;
mapping(address => bool) _isFeeExempt;
modifier validRecipient(address to) {
require(to != address(0x0));
_;
}
uint256 public constant DECIMALS = 5;
uint256 public constant MAX_UINT256 = ~uint256(0);
uint8 public constant RATE_DECIMALS = 7;
uint256 private constant INITIAL_FRAGMENTS_SUPPLY =
325 * 10**3 * 10**DECIMALS;
uint256 public liquidityFee = 20;
uint256 public treasuryFee = 25;
uint256 public safuDividendFee = 70;
uint256 public sellFee = 20;
uint256 public autofirePitFee = 25;
uint256 public totalFee =
liquidityFee.add(treasuryFee).add(safuDividendFee).add(
autofirePitFee
);
uint256 public feeDenominator = 1000;
address DEAD = 0x000000000000000000000000000000000000dEaD;
address ZERO = 0x0000000000000000000000000000000000000000;
address public autoLiquidityReceiver;
address public treasuryReceiver;
DividendDistributor distributor;
address public safuDividendReceiver;
uint256 distributorGas = 500000;
address public autofirePit;
bool public swapEnabled = true;
IPancakeSwapRouter public router;
address public pair;
bool inSwap = false;
modifier swapping() {
inSwap = true;
_;
inSwap = false;
}
uint256 private constant TOTAL_GONS =
MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY);
uint256 private constant MAX_SUPPLY = 325 * 10**7 * 10**DECIMALS;
bool public _autoRebase;
bool public _autoAddLiquidity;
uint256 public _initRebaseStartTime;
uint256 public _lastRebasedTime;
uint256 public _lastAddLiquidityTime;
uint256 public _totalSupply;
uint256 private _gonsPerFragment;
mapping(address => uint256) private _gonBalances;
mapping(address => mapping(address => uint256)) private _allowedFragments;
mapping(address => bool) public blacklist;
mapping(address => bool) public isDividendExempt;
constructor() ERC20Detailed("EverINVESTS", "EverINVESTS", uint8(DECIMALS)) Ownable() {
//testnet
//router = IPancakeSwapRouter(0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3);
//mainnet
router = IPancakeSwapRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);
pair = IPancakeSwapFactory(router.factory()).createPair(
router.WETH(),
address(this)
);
autoLiquidityReceiver = 0x8Eb9742a182AD0999268E892911F126f9E6581B0;
treasuryReceiver = 0x9E06d58aE297598AFcAE849cD272873f5e7F9c7F;
autofirePit = 0x000000000000000000000000000000000000dEaD;
_allowedFragments[address(this)][address(router)] = uint256(-1);
pairContract = IPancakeSwapPair(pair);
distributor = new DividendDistributor(0x10ED43C718714eb63d5aA57B78B54704E256024E);
safuDividendReceiver = address(distributor);
isDividendExempt[msg.sender] = true;
isDividendExempt[pair] = true;
isDividendExempt[address(this)] = true;
isDividendExempt[DEAD] = true;
_totalSupply = INITIAL_FRAGMENTS_SUPPLY;
_gonBalances[treasuryReceiver] = TOTAL_GONS;
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
_initRebaseStartTime = block.timestamp;
_lastRebasedTime = block.timestamp;
_autoRebase = false;
_autoAddLiquidity = true;
_isFeeExempt[treasuryReceiver] = true;
_isFeeExempt[address(this)] = true;
_transferOwnership(treasuryReceiver);
emit Transfer(address(0x0), treasuryReceiver, _totalSupply);
}
function rebase() internal {
if ( inSwap ) return;
uint256 rebaseRate;
uint256 deltaTimeFromInit = block.timestamp - _initRebaseStartTime;
uint256 deltaTime = block.timestamp - _lastRebasedTime;
uint256 times = deltaTime.div(15 minutes);
uint256 epoch = times.mul(15);
if (deltaTimeFromInit < (365 days)) {
rebaseRate = 2355;
} else if (deltaTimeFromInit >= (365 days)) {
rebaseRate = 211;
} else if (deltaTimeFromInit >= ((15 * 365 days) / 10)) {
rebaseRate = 14;
} else if (deltaTimeFromInit >= (7 * 365 days)) {
rebaseRate = 2;
}
for (uint256 i = 0; i < times; i ) {
_totalSupply = _totalSupply
.mul((10**RATE_DECIMALS).add(rebaseRate))
.div(10**RATE_DECIMALS);
}
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
_lastRebasedTime = _lastRebasedTime.add(times.mul(15 minutes));
pairContract.sync();
emit LogRebase(epoch, _totalSupply);
}
function transfer(address to, uint256 value)
external
override
validRecipient(to)
returns (bool)
{
_transferFrom(msg.sender, to, value);
return true;
}
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 _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;
}
function _transferFrom(
address sender,
address recipient,
uint256 amount
) internal returns (bool) {
require(!blacklist[sender] && !blacklist[recipient], "in_blacklist");
if (inSwap) {
return _basicTransfer(sender, recipient, amount);
}
if (shouldRebase()) {
rebase();
}
if (shouldAddLiquidity()) {
addLiquidity();
}
if (shouldSwapBack()) {
swapBack();
}
uint256 gonAmount = amount.mul(_gonsPerFragment);
_gonBalances[sender] = _gonBalances[sender].sub(gonAmount);
uint256 gonAmountReceived = shouldTakeFee(sender, recipient)
? takeFee(sender, recipient, gonAmount)
: gonAmount;
_gonBalances[recipient] = _gonBalances[recipient].add(
gonAmountReceived
);
if(!isDividendExempt[sender]){ try distributor.setShare(sender, balanceOf(sender)) {} catch {} }
if(!isDividendExempt[recipient]){ try distributor.setShare(recipient, balanceOf(recipient)) {} catch {} }
try distributor.process(distributorGas) {} catch {}
emit Transfer(
sender,
recipient,
gonAmountReceived.div(_gonsPerFragment)
);
return true;
}
function takeFee(
address sender,
address recipient,
uint256 gonAmount
) internal returns (uint256) {
uint256 _totalFee = totalFee;
uint256 _treasuryFee = treasuryFee;
if (recipient == pair) {
_totalFee = totalFee.add(sellFee);
_treasuryFee = treasuryFee.add(sellFee);
}
uint256 feeAmount = gonAmount.div(feeDenominator).mul(_totalFee);
_gonBalances[autofirePit] = _gonBalances[autofirePit].add(
gonAmount.div(feeDenominator).mul(autofirePitFee)
);
_gonBalances[address(this)] = _gonBalances[address(this)].add(
gonAmount.div(feeDenominator).mul(_treasuryFee.add(safuDividendFee))
);
_gonBalances[autoLiquidityReceiver] = _gonBalances[autoLiquidityReceiver].add(
gonAmount.div(feeDenominator).mul(liquidityFee)
);
emit Transfer(sender, address(this), feeAmount.div(_gonsPerFragment));
return gonAmount.sub(feeAmount);
}
function addLiquidity() internal swapping {
uint256 autoLiquidityAmount = _gonBalances[autoLiquidityReceiver].div(
_gonsPerFragment
);
_gonBalances[address(this)] = _gonBalances[address(this)].add(
_gonBalances[autoLiquidityReceiver]
);
_gonBalances[autoLiquidityReceiver] = 0;
uint256 amountToLiquify = autoLiquidityAmount.div(2);
uint256 amountToSwap = autoLiquidityAmount.sub(amountToLiquify);
if( amountToSwap == 0 ) {
return;
}
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
uint256 balanceBefore = address(this).balance;
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap,
0,
path,
address(this),
block.timestamp
);
uint256 amountETHLiquidity = address(this).balance.sub(balanceBefore);
if (amountToLiquify > 0&&amountETHLiquidity > 0) {
router.addLiquidityETH{value: amountETHLiquidity}(
address(this),
amountToLiquify,
0,
0,
autoLiquidityReceiver,
block.timestamp
);
}
_lastAddLiquidityTime = block.timestamp;
}
function swapBack() internal swapping {
uint256 amountToSwap = _gonBalances[address(this)].div(_gonsPerFragment);
if( amountToSwap == 0) {
return;
}
uint256 balanceBefore = address(this).balance;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap,
0,
path,
address(this),
block.timestamp
);
uint256 amountETHToTreasuryAndSIF = address(this).balance.sub(
balanceBefore
);
(bool success, ) = payable(treasuryReceiver).call{
value: amountETHToTreasuryAndSIF.mul(treasuryFee).div(
treasuryFee.add(safuDividendFee)
),
gas: 30000
}("");
try distributor.deposit {
value: amountETHToTreasuryAndSIF.mul(safuDividendFee).div(treasuryFee.add(safuDividendFee))
} () {} catch {}
}
function withdrawAllToTreasury() external swapping onlyOwner {
uint256 amountToSwap = _gonBalances[address(this)].div(_gonsPerFragment);
require( amountToSwap > 0,"There is no EverINVESTS token deposited in token contract");
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap,
0,
path,
treasuryReceiver,
block.timestamp
);
}
function shouldTakeFee(address from, address to)
internal
view
returns (bool)
{
return
(pair == from || pair == to) &&
!_isFeeExempt[from];
}
function shouldRebase() internal view returns (bool) {
return
_autoRebase &&
(_totalSupply < MAX_SUPPLY) &&
msg.sender != pair &&
!inSwap &&
block.timestamp >= (_lastRebasedTime 15 minutes);
}
function shouldAddLiquidity() internal view returns (bool) {
return
_autoAddLiquidity &&
!inSwap &&
msg.sender != pair &&
block.timestamp >= (_lastAddLiquidityTime 2 days);
}
function shouldSwapBack() internal view returns (bool) {
return
!inSwap &&
msg.sender != pair ;
}
function setAutoRebase(bool _flag) external onlyOwner {
if (_flag) {
_autoRebase = _flag;
_lastRebasedTime = block.timestamp;
} else {
_autoRebase = _flag;
}
}
function setAutoAddLiquidity(bool _flag) external onlyOwner {
if(_flag) {
_autoAddLiquidity = _flag;
_lastAddLiquidityTime = block.timestamp;
} else {
_autoAddLiquidity = _flag;
}
}
function allowance(address owner_, address spender)
external
view
override
returns (uint256)
{
return _allowedFragments[owner_][spender];
}
function decreaseAllowance(address spender, uint256 subtractedValue)
external
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;
}
function increaseAllowance(address spender, uint256 addedValue)
external
returns (bool)
{
_allowedFragments[msg.sender][spender] = _allowedFragments[msg.sender][
spender
].add(addedValue);
emit Approval(
msg.sender,
spender,
_allowedFragments[msg.sender][spender]
);
return true;
}
function approve(address spender, uint256 value)
external
override
returns (bool)
{
_allowedFragments[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function checkFeeExempt(address _addr) external view returns (bool) {
return _isFeeExempt[_addr];
}
function setIsDividendExempt(address holder, bool exempt) external onlyOwner {
require(holder != address(this) && holder != pair);
isDividendExempt[holder] = exempt;
if (exempt) {
distributor.setShare(holder, 0);
} else {
distributor.setShare(holder, balanceOf(holder));
}
}
function setDistributionCriteria(uint256 _minPeriod, uint256 _minDistribution) external onlyOwner {
distributor.setDistributionCriteria(_minPeriod, _minDistribution);
}
function setDistributorSettings(uint256 gas) external onlyOwner {
require(gas < 750000, "Gas must be lower than 750000");
distributorGas = gas;
}
function getCirculatingSupply() public view returns (uint256) {
return
(TOTAL_GONS.sub(_gonBalances[DEAD]).sub(_gonBalances[ZERO])).div(
_gonsPerFragment
);
}
function isNotInSwap() external view returns (bool) {
return !inSwap;
}
function manualSync() external {
IPancakeSwapPair(pair).sync();
}
function setFeeReceivers(
address _autoLiquidityReceiver,
address _treasuryReceiver,
address _autofirePit
) external onlyOwner {
autoLiquidityReceiver = _autoLiquidityReceiver;
treasuryReceiver = _treasuryReceiver;
autofirePit = _autofirePit;
}
function getLiquidityBacking(uint256 accuracy)
public
view
returns (uint256)
{
uint256 liquidityBalance = _gonBalances[pair].div(_gonsPerFragment);
return
accuracy.mul(liquidityBalance.mul(2)).div(getCirculatingSupply());
}
function setWhitelist(address _addr) external onlyOwner {
_isFeeExempt[_addr] = true;
}
function setBotBlacklist(address _botAddress, bool _flag) external onlyOwner {
require(isContract(_botAddress), "only contract address, not allowed externally owned account");
blacklist[_botAddress] = _flag;
}
function setLP(address _address) external onlyOwner {
pairContract = IPancakeSwapPair(_address);
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _gonBalances[account].div(_gonsPerFragment);
}
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) }
return size > 0;
}
receive() external payable {}
}