WSFvsFLibero

/**
/**
*Submitted for verification at BscScan.com on 2022-03-28
*Submitted for verification at FtmScan.com on 2022-03-29
*/
*/
// SPDX-License-Identifier: Unlicensed
// SPDX-License-Identifier: MIT
//
pragma solidity ^0.7.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
abstract contract Auth is Context{
address owner;
mapping (address => bool) private authorizations;
constructor(address _owner) {
owner = _owner;
authorizations[_owner] = true;
}
modifier onlyOwner() {
require(isOwner(msg.sender)); _;
}
modifier authorized() {
require(isAuthorized(msg.sender)); _;
}
function authorize(address adr) public onlyOwner {
authorizations[adr] = true;
emit Authorized(adr);
}
function unauthorize(address adr) public onlyOwner {
authorizations[adr] = false;
emit Unauthorized(adr);
}
function isOwner(address account) public view returns (bool) {
return account == owner;
}
function isAuthorized(address adr) public view returns (bool) {
return authorizations[adr];
}
function transferOwnership(address payable adr) public onlyOwner {
owner = adr;
authorizations[adr] = true;
emit OwnershipTransferred(adr);
}
pragma solidity ^0.7.4;
event OwnershipTransferred(address owner);
event Authorized(address adr);
event Unauthorized(address adr);
}
library SafeMathInt {
library SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MAX_INT256 = ~(int256(1) << 255);
int256 private constant MAX_INT256 = ~(int256(1) << 255);
function mul(int256 a, int256 b) internal pure returns (int256) {
function mul(int256 a, int256 b) internal pure returns (int256) {
int256 c = a * b;
int256 c = a * b;
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));
require((b == 0) || (c / b == a));
require((b == 0) || (c / b == a));
return c;
return c;
}
}
function div(int256 a, int256 b) internal pure returns (int256) {
function div(int256 a, int256 b) internal pure returns (int256) {
require(b != -1 || a != MIN_INT256);
require(b != -1 || a != MIN_INT256);
return a / b;
return a / b;
}
}
function sub(int256 a, int256 b) internal pure returns (int256) {
function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
return c;
}
}
function add(int256 a, int256 b) internal pure returns (int256) {
function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a));
require((b >= 0 && c >= a) || (b < 0 && c < a));
return c;
return c;
}
}
function abs(int256 a) internal pure returns (int256) {
function abs(int256 a) internal pure returns (int256) {
require(a != MIN_INT256);
require(a != MIN_INT256);
return a < 0 ? -a : a;
return a < 0 ? -a : a;
}
}
}
}
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(
function sub(
uint256 a,
uint256 a,
uint256 b,
uint256 b,
string memory errorMessage
string memory errorMessage
) internal pure returns (uint256) {
) 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(
function div(
uint256 a,
uint256 a,
uint256 b,
uint256 b,
string memory errorMessage
string memory errorMessage
) internal pure returns (uint256) {
) internal pure returns (uint256) {
require(b > 0, errorMessage);
require(b > 0, errorMessage);
uint256 c = a / b;
uint256 c = a / b;
return c;
return c;
}
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
require(b != 0);
return a % b;
return a % b;
}
}
}
}
interface IERC20 {
interface IERC20 {
function totalSupply() external view returns (uint256);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
function allowance(address owner, address spender) external view returns (uint256);
external
view
returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(
function transferFrom(address from, address to, uint256 value) external returns (bool);
address from,
address to,
uint256 value
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
event Approval(address indexed owner, address indexed spender, uint256 value);
address indexed owner,
address indexed spender,
uint256 value
);
}
}
interface IPancakeSwapPair {
interface InterfaceLP {
event Approval(address indexed owner, address indexed spender, uint value);
function sync() external;
event Transfer(address indexed from, address indexed to, uint value);
}
function name() external pure returns (string memory);
library Roles {
function symbol() external pure returns (string memory);
struct Role {
function decimals() external pure returns (uint8);
mapping (address => bool) bearer;
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 add(Role storage role, address account) internal {
function transfer(address to, uint value) external returns (bool);
require(!has(role, account), "Roles: account already has role");
function transferFrom(address from, address to, uint value) external returns (bool);
role.bearer[account] = true;
}
function DOMAIN_SEPARATOR() external view returns (bytes32);
function remove(Role storage role, address account) internal {
function PERMIT_TYPEHASH() external pure returns (bytes32);
require(has(role, account), "Roles: account does not have role");
function nonces(address owner) external view returns (uint);
role.bearer[account] = false;
}
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
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];
}
}
event Mint(address indexed sender, uint amount0, uint amount1);
abstract contract ERC20Detailed is IERC20 {
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
string private _name;
event Swap(
string private _symbol;
address indexed sender,
uint8 private _decimals;
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
constructor(
function factory() external view returns (address);
string memory _tokenName,
function token0() external view returns (address);
string memory _tokenSymbol,
function token1() external view returns (address);
uint8 _tokenDecimals
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
) {
function price0CumulativeLast() external view returns (uint);
_name = _tokenName;
function price1CumulativeLast() external view returns (uint);
_symbol = _tokenSymbol;
function kLast() external view returns (uint);
_decimals = _tokenDecimals;
}
function mint(address to) external returns (uint liquidity);
function name() public view returns (string memory) {
function burn(address to) external returns (uint amount0, uint amount1);
return _name;
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
}
function skim(address to) external;
function sync() external;
function symbol() public view returns (string memory) {
return _symbol;
}
function initialize(address, address) external;
function decimals() public view returns (uint8) {
return _decimals;
}
}
}
interface IPancakeSwapRouter{
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);
)
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
external
payable
payable
returns (uint[] memory amounts);
returns (
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
uint256 amountToken,
external
uint256 amountETH,
returns (uint[] memory amounts);
uint256 liquidity
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(
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 IPancakeSwapFactory {
interface IDEXFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function createPair(address tokenA, address tokenB)
external
function feeTo() external view returns (address);
returns (address pair);
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;
}
}
contract Ownable {
contract FLiberoToken is ERC20Detailed, Auth {
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 WallStreetFinance is ERC20Detailed, Ownable {
using SafeMath for uint256;
using SafeMath for uint256;
using SafeMathInt for int256;
using SafeMathInt for int256;
bool public initialDistributionFinished = false;
bool public autoRebase = false;
bool public feesOnNormalTransfers = true;
bool public isLiquidityInFtm = true;
bool public isRfvInFtm = true;
bool public isLiquidityEnabled = true;
string public _name = "WallStreet Finance";
uint256 public rewardYield = 1402777;
string public _symbol = "WSF";
uint256 public rebaseFrequency = 600;
uint8 public _decimals = 5;
uint256 public nextRebase = block.timestamp + 31536000;
uint256 public maxSellTransactionAmount = 2000000 * 10 ** 18;
uint256 public swapThreshold = 400000 * 10**18;
IPancakeSwapPair public pairContract;
mapping(address => bool) _isFeeExempt;
mapping(address => bool) _isFeeExempt;
address[] private _makerPairs;
mapping (address => bool) public automatedMarketMakerPairs;
modifier validRecipient(address to) {
uint256 private constant REWARD_YIELD_DENOMINATOR = 10000000000;
require(to != address(0x0));
uint256 private constant MAX_TOTAL_BUY_FEE_RATE = 250;
_;
uint256 private constant MAX_TOTAL_SELL_FEE_RATE = 500;
}
uint256 private constant FEE_DENOMINATOR = 1000;
uint256 private constant MIN_MAX_SELL_AMOUNT = 1000 * 10**18;
uint256 private constant MAX_REBASE_FREQUENCY = 1800;
uint256 private constant DECIMALS = 18;
uint256 private constant MAX_UINT256 = ~uint256(0);
uint256 private constant INITIAL_FRAGMENTS_SUPPLY = 15 * 10**8 * 10**DECIMALS;
uint256 private constant TOTAL_GONS = MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY);
uint256 private constant MAX_SUPPLY = ~uint128(0);
uint256 public constant DECIMALS = 5;
address private constant DEAD = 0x000000000000000000000000000000000000dEaD;
uint256 public constant MAX_UINT256 = ~uint256(0);
address private constant ZERO = 0x0000000000000000000000000000000000000000;
uint8 public constant RATE_DECIMALS = 7;
address public constant usdcToken = 0x04068DA6C83AFCFA0e13ba15A6696662335D5B75;
address public liquidityReceiver = 0x730736E3cdffc531b74eb8B30bD2CC50beb8Ab3c;
address public treasuryReceiver = 0x3ff8970f17d463b83D289827B7B8E5Eed61Cc3e8;
address public riskFreeValueReceiver = 0x14c02711A4678fc7De388e77e99B07753C856e84;
address public xLiberoReceiver = 0x8689EDAb5Bdb17b11273a5C9412C4BBC8f2Ec4F8;
uint256 private constant INITIAL_FRAGMENTS_SUPPLY = 10 * 10**6 * 10**DECIMALS;
IDEXRouter public router;
address public pair;
uint256 public liquidityFee = 40;
uint256 public liquidityFee = 40;
uint256 public treasuryFee = 20;
uint256 public treasuryFee = 30;
uint256 public insuranceFee = 60;
uint256 public buyFeeRFV = 50;
uint256 public wsfBankFee = 20;
uint256 public buyBurnFee = 20;
uint256 public nftHolderFee = 20;
uint256 public buyxLiberoFee = 0;
uint256 public sellFeeTreasuryAdded = 20;
uint256 public sellFee = wsfBankFee.add(nftHolderFee);
uint256 public sellFeeRFVAdded = 40;
uint256 public burnFee = 10;
uint256 public sellBurnFeeAdded = 0;
uint256 public totalFee = liquidityFee.add(treasuryFee).add(insuranceFee).add(burnFee);
uint256 public sellxLiberoFeeAdded = 0;
uint256 public feeDenominator = 1000;
uint256 public totalBuyFee = liquidityFee.add(treasuryFee).add(buyFeeRFV).add(buyBurnFee).add(buyxLiberoFee);
uint256 public totalSellFee = totalBuyFee.add(sellFeeTreasuryAdded).add(sellFeeRFVAdded).add(sellBurnFeeAdded).add(sellxLiberoFeeAdded);
address DEAD = 0x000000000000000000000000000000000000dEaD;
bool inSwap;
address ZERO = 0x0000000000000000000000000000000000000000;
address public wsfBankReceiver;
address public nftHolderReceiver;
address public lpReceiver;
address public treasuryReceiver;
address public insuranceReceiver;
address public firePit;
address public pairAddress;
bool public swapEnabled = true;
IPancakeSwapRouter public router;
address public pair;
bool inSwap = false;
modifier swapping() {
modifier swapping() {
inSwap = true;
inSwap = true;
_;
_;
inSwap = false;
inSwap = false;
}
}
uint256 private constant TOTAL_GONS = MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY);
modifier validRecipient(address to) {
uint256 private constant MAX_SUPPLY = 10 * 10**10 * 10**DECIMALS;
require(to != address(0x0));
_;
}
// BOOL Variables
uint256 private _totalSupply;
bool public _autoRebase = true;
bool public _autoAddLiquidity = true;
// INT Variables
uint256 public _initRebaseStartTime;
uint256 public _lastRebasedTime;
uint256 public _lastAddLiquidityTime;
uint256 public _totalSupply;
uint256 private _gonsPerFragment;
uint256 private _gonsPerFragment;
// MAPPING
mapping(address => uint256) private _gonBalances;
mapping(address => uint256) private _gonBalances;
mapping(address => mapping(address => uint256)) private _allowedFragments;
mapping(address => mapping(address => uint256)) private _allowedFragments;
mapping(address => bool) public blacklist;
// EVENT
constructor() ERC20Detailed("Fantom Libero Financial Freedom", "FLIBERO", uint8(DECIMALS)) Auth(msg.sender) {
event Rebased(uint256 indexed epoch, uint256 totalSupply);
router = IDEXRouter(0xF491e7B69E4244ad4002BC14e878a34207E38c29);
pair = IDEXFactory(router.factory()).createPair(address(this), router.WETH());
address pairUsdc = IDEXFactory(router.factory()).createPair(address(this), usdcToken);
constructor() ERC20Detailed("WallStreet Finance", "WSF", uint8(DECIMALS)) Ownable() {
_allowedFragments[address(this)][address(router)] = uint256(-1);
_allowedFragments[address(this)][pair] = uint256(-1);
_allowedFragments[address(this)][address(this)] = uint256(-1);
_allowedFragments[address(this)][pairUsdc] = uint256(-1);
router = IPancakeSwapRouter(0x10ED43C718714eb63d5aA57B78B54704E256024E);
setAutomatedMarketMakerPair(pair, true);
pair = IPancakeSwapFactory(router.factory()).createPair(
setAutomatedMarketMakerPair(pairUsdc, true);
router.WETH(),
address(this)
);
lpReceiver = 0x5562640B953b6c2f79a655E930aFa68b2a65C627;
treasuryReceiver = 0xa9fe433E3014772bbfeA2B56F8F23CD7b87B2cbb;
insuranceReceiver = 0x180f8387A0538ee058D305877df5acdBa0947498;
wsfBankReceiver = 0xEF0935155365db7496304bedc964470C589b9916;
nftHolderReceiver = 0x741490Fa4c7C67c395C0b5F78a1D6Baaaaa75a09;
firePit = 0x0000000000000000000000000000000000000000;
_allowedFragments[address(this)][address(router)] = uint256(-1);
pairAddress = pair;
pairContract = IPancakeSwapPair(pair);
_totalSupply = INITIAL_FRAGMENTS_SUPPLY;
_totalSupply = INITIAL_FRAGMENTS_SUPPLY;
_gonBalances[owner()] = TOTAL_GONS;
_gonBalances[msg.sender] = TOTAL_GONS;
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
_gonsPerFragment = TOTAL_GONS.div(_totalSupply);
_initRebaseStartTime = block.timestamp;
_lastRebasedTime = block.number;
_isFeeExempt[owner()] = true;
_isFeeExempt[treasuryReceiver] = true;
_isFeeExempt[riskFreeValueReceiver] = true;
_isFeeExempt[address(this)] = true;
_isFeeExempt[address(this)] = true;
_isFeeExempt[msg.sender] = true;
emit Transfer(address(0x0), owner(), _totalSupply);
IERC20(usdcToken).approve(address(router), uint256(-1));
IERC20(usdcToken).approve(address(pairUsdc), uint256(-1));
IERC20(usdcToken).approve(address(this), uint256(-1));
emit Transfer(address(0x0), msg.sender, _totalSupply);
}
}
function setZeroFees() external onlyOwner {
receive() external payable {}
liquidityFee = 0;
treasuryFee = 0;
insuranceFee = 0;
wsfBankFee = 0;
nftHolderFee = 0;
burnFee = 0;
sellFee = 0;
function totalSupply() external view override returns (uint256) {
totalFee = 0;
return _totalSupply;
}
}
function setNormalFees() external onlyOwner {
function allowance(address owner_, address spender) external view override returns (uint256){
liquidityFee = 40;
return _allowedFragments[owner_][spender];
treasuryFee = 20;
}
insuranceFee = 60;
wsfBankFee = 20;
nftHolderFee = 20;
burnFee = 10;
sellFee = wsfBankFee.add(nftHolderFee);
function balanceOf(address who) public view override returns (uint256) {
totalFee = liquidityFee.add(treasuryFee).add(insuranceFee).add(burnFee);
return _gonBalances[who].div(_gonsPerFragment);
}
function checkFeeExempt(address _addr) external view returns (bool) {
return _isFeeExempt[_addr];
}
}
function manualRebase() external onlyOwner {
function shouldRebase() internal view returns (bool) {
rebase();
return nextRebase <= block.timestamp;
}
}
function rebase() internal {
function shouldTakeFee(address from, address to) internal view returns (bool) {
if(_isFeeExempt[from] || _isFeeExempt[to]){
return false;
}else if (feesOnNormalTransfers){
return true;
}else{
return (automatedMarketMakerPairs[from] || automatedMarketMakerPairs[to]);
}
}
if ( inSwap ) return;
function shouldSwapBack() internal view returns (bool) {
return
!automatedMarketMakerPairs[msg.sender] &&
!inSwap &&
swapThreshold > 0 &&
totalBuyFee.add(totalSellFee) > 0 &&
balanceOf(address(this)) >= swapThreshold;
}
uint deno = 10**7 * 10**18;
function getCirculatingSupply() public view returns (uint256) {
uint rebaseRate = 858 * 10**18;
return (TOTAL_GONS.sub(_gonBalances[DEAD]).sub(_gonBalances[ZERO])).div(_gonsPerFragment);
uint minuteRebaseRate = 17100 * 10**18;
}
uint hourRebaseRate = 1000000 * 10**18;
uint dayRebaseRate = 188800000 * 10**18;
uint blockCount = block.number.sub(_lastRebasedTime);
function manualSync() public {
uint tmp = _totalSupply;
for(uint i = 0; i < _makerPairs.length; i++){
for (uint idx = 0; idx < blockCount.mod(20); idx++) { // 3 sec rebase
try InterfaceLP(_makerPairs[i]).sync() {
// S' = S(1+p)^r
tmp = tmp.mul(deno.mul(100).add(rebaseRate)).div(deno.mul(100));
}
for (uint idx = 0; idx < blockCount.div(20).mod(60); idx++) { // 1 min rebase
}catch Error (string memory reason) {
// S' = S(1+p)^r
emit GenericErrorEvent("manualSync(): _makerPairs.sync() Failed");
tmp = tmp.mul(deno.mul(100).add(minuteRebaseRate)).div(deno.mul(100));
emit GenericErrorEvent(reason);
}
}
}
for (uint idx = 0; idx < blockCount.div(20 * 60).mod(24); idx++) { // 1 hour rebase
// S' = S(1+p)^r
tmp = tmp.mul(deno.mul(100).add(hourRebaseRate)).div(deno.mul(100));
}
for (uint idx = 0; idx < blockCount.div(20 * 60 * 24); idx++) { // 1 day rebase
// S' = S(1+p)^r
tmp = tmp.mul(deno.mul(100).add(dayRebaseRate)).div(deno.mul(100));
}
_totalSupply = tmp;
_gonsPerFragment = TOTAL_GONS.div(tmp);
_lastRebasedTime = block.number;
pairContract.sync();
emit Rebased(block.timestamp, _totalSupply);
}
}
function transfer(address to, uint256 value)
function transfer(address to, uint256 value) external override validRecipient(to) returns (bool){
external
override
validRecipient(to)
returns (bool)
{
_transferFrom(msg.sender, to, value);
_transferFrom(msg.sender, to, value);
return true;
return true;
}
}
function transferFrom(
function _basicTransfer(address from, address to, uint256 amount) internal returns (bool) {
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);
uint256 gonAmount = amount.mul(_gonsPerFragment);
_gonBalances[from] = _gonBalances[from].sub(gonAmount);
_gonBalances[from] = _gonBalances[from].sub(gonAmount);
_gonBalances[to] = _gonBalances[to].add(gonAmount);
_gonBalances[to] = _gonBalances[to].add(gonAmount);
emit Transfer(from, to, amount);
return true;
return true;
}
}
function _transferFrom(
function _transferFrom(address sender, address recipient, uint256 amount) internal returns (bool) {
address sender,
bool excludedAccount = _isFeeExempt[sender] || _isFeeExempt[recipient];
address recipient,
uint256 amount
require(initialDistributionFinished || excludedAccount, "Trading not started");
) internal returns (bool) {
require(!blacklist[sender] && !blacklist[recipient], "in_blacklist");
if (
automatedMarketMakerPairs[recipient] &&
!excludedAccount
) {
require(amount <= maxSellTransactionAmount, "Error amount");
}
if (inSwap) {
if (inSwap) {
return _basicTransfer(sender, recipient, amount);
return _basicTransfer(sender, recipient, amount);
}
}
if (shouldRebase()) {
rebase();
}
if (shouldAddLiquidity()) {
uint256 gonAmount = amount.mul(_gonsPerFragment);
addLiquidity();
}
if (shouldSwapBack()) {
if (shouldSwapBack()) {
swapBack();
swapBack();
}
}
uint256 gonAmount = amount.mul(_gonsPerFragment);
_gonBalances[sender] = _gonBalances[sender].sub(gonAmount);
_gonBalances[sender] = _gonBalances[sender].sub(gonAmount);
uint256 gonAmountReceived = shouldTakeFee(sender, recipient)
? takeFee(sender, recipient, gonAmount)
: gonAmount;
_gonBalances[recipient] = _gonBalances[recipient].add(
gonAmountReceived
);
uint256 gonAmountReceived = shouldTakeFee(sender, recipient) ? takeFee(sender, recipient, gonAmount) : gonAmount;
_gonBalances[recipient] = _gonBalances[recipient].add(gonAmountReceived);
emit Transfer(
emit Transfer(
sender,
sender,
recipient,
recipient,
gonAmountReceived.div(_gonsPerFragment)
gonAmountReceived.div(_gonsPerFragment)
);
);
if(
shouldRebase() &&
autoRebase &&
!automatedMarketMakerPairs[sender] &&
!automatedMarketMakerPairs[recipient]
) {
_rebase();
manualSync();
}
return true;
return true;
}
}
function takeFee(
function transferFrom(address from, address to, uint256 value) external override validRecipient(to) returns (bool) {
address sender,
if (_allowedFragments[from][msg.sender] != uint256(-1)) {
address recipient,
_allowedFragments[from][msg.sender] = _allowedFragments[from][
uint256 gonAmount
msg.sender
) internal returns (uint256) {
].sub(value, "Insufficient Allowance");
uint256 _totalFee = totalFee;
}
_transferFrom(from, to, value);
return true;
}
function _swapAndLiquify(uint256 contractTokenBalance) private {
uint256 half = contractTokenBalance.div(2);
uint256 otherHalf = contractTokenBalance.sub(half);
if(isLiquidityInFtm){
uint256 initialBalance = address(this).balance;
_swapTokensForFTM(half, address(this));
uint256 newBalance = address(this).balance.sub(initialBalance);
_addLiquidity(otherHalf, newBalance);
if (recipient == pair) {
emit SwapAndLiquify(half, newBalance, otherHalf);
_totalFee = totalFee.add(sellFee);
}else{
}
uint256 initialBalance = IERC20(usdcToken).balanceOf(address(this));
uint256 feeAmount = gonAmount.div(feeDenominator).mul(_totalFee);
_swapTokensForUsdc(half, address(this));
_gonBalances[firePit] = _gonBalances[firePit].add(
uint256 newBalance = IERC20(usdcToken).balanceOf(address(this)).sub(initialBalance);
gonAmount.div(feeDenominator).mul(burnFee)
);
uint256 maintainFee = _totalFee - burnFee - liquidityFee;
_gonBalances[address(this)] = _gonBalances[address(this)].add(
addLiquidityUsdc(otherHalf, newBalance);
gonAmount.div(feeDenominator).mul(maintainFee)
);
_gonBalances[lpReceiver] = _gonBalances[lpReceiver].add(
gonAmount.div(feeDenominator).mul(liquidityFee)
);
emit Transfer(sender, address(this), feeAmount.div(_gonsPerFragment));
emit SwapAndLiquifyUsdc(half, newBalance, otherHalf);
return gonAmount.sub(feeAmount);
}
}
}
function addLiquidity() internal swapping {
function _addLiquidity(uint256 tokenAmount, uint256 ftmAmount) private {
uint256 autoLiquidityAmount = _gonBalances[lpReceiver].div(
router.addLiquidityETH{value: ftmAmount}(
_gonsPerFragment
address(this),
tokenAmount,
0,
0,
liquidityReceiver,
block.timestamp
);
);
_gonBalances[address(this)] = _gonBalances[address(this)].add(
}
_gonBalances[lpReceiver]
function addLiquidityUsdc(uint256 tokenAmount, uint256 usdcAmount) private {
router.addLiquidity(
address(this),
usdcToken,
tokenAmount,
usdcAmount,
0,
0,
liquidityReceiver,
block.timestamp
);
);
_gonBalances[lpReceiver] = 0;
}
uint256 amountToLiquify = autoLiquidityAmount.div(2);
uint256 amountToSwap = autoLiquidityAmount.sub(amountToLiquify);
if( amountToSwap == 0 ) {
function _swapTokensForFTM(uint256 tokenAmount, address receiver) private {
return;
}
address[] memory path = new address[](2);
address[] memory path = new address[](2);
path[0] = address(this);
path[0] = address(this);
path[1] = router.WETH();
path[1] = router.WETH();
uint256 balanceBefore = address(this).balance;
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap,
tokenAmount,
0,
0,
path,
path,
address(this),
receiver,
block.timestamp
block.timestamp
);
);
}
function _swapTokensForUsdc(uint256 tokenAmount, address receiver) private {
address[] memory path = new address[](3);
path[0] = address(this);
path[1] = router.WETH();
path[2] = usdcToken;
uint256 amountETHLiquidity = address(this).balance.sub(balanceBefore);
router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
receiver,
block.timestamp
);
}
function swapBack() internal swapping {
uint256 realTotalFee = totalBuyFee.add(totalSellFee);
uint256 dynamicLiquidityFee = isLiquidityEnabled ? liquidityFee : 0;
uint256 contractTokenBalance = _gonBalances[address(this)].div(_gonsPerFragment);
uint256 amountToLiquify = contractTokenBalance.mul(dynamicLiquidityFee.mul(2)).div(realTotalFee);
uint256 amountToBurn = contractTokenBalance.mul(buyBurnFee.mul(2).add(sellBurnFeeAdded)).div(realTotalFee);
uint256 amountToRFV = contractTokenBalance.mul(buyFeeRFV.mul(2).add(sellFeeRFVAdded)).div(realTotalFee);
uint256 amountToxLibero = contractTokenBalance.mul(buyxLiberoFee.mul(2).add(sellxLiberoFeeAdded)).div(realTotalFee);
uint256 amountToTreasury = contractTokenBalance.sub(amountToLiquify).sub(amountToBurn).sub(amountToRFV).sub(amountToxLibero);
if(amountToLiquify > 0){
_swapAndLiquify(amountToLiquify);
}
if (amountToLiquify > 0&&amountETHLiquidity > 0) {
if(amountToBurn > 0){
router.addLiquidityETH{value: amountETHLiquidity}(
_basicTransfer(address(this), DEAD, amountToBurn);
address(this),
amountToLiquify,
0,
0,
owner(),
block.timestamp
);
}
}
_lastAddLiquidityTime = block.timestamp;
}
function swapBack() internal swapping {
if(amountToRFV > 0){
if(isRfvInFtm){
_swapTokensForFTM(amountToRFV, riskFreeValueReceiver);
}else{
_swapTokensForUsdc(amountToRFV, riskFreeValueReceiver);
}
}
uint256 amountToSwap = _gonBalances[address(this)].div(_gonsPerFragment);
if(amountToxLibero > 0){
_swapTokensForUsdc(amountToxLibero, xLiberoReceiver);
}
if( amountToSwap == 0) {
if(amountToTreasury > 0){
return;
_swapTokensForFTM(amountToTreasury, treasuryReceiver);
}
}
uint256 balanceBefore = address(this).balance;
emit SwapBack(contractTokenBalance, amountToLiquify, amountToRFV, amountToTreasury);
address[] memory path = new address[](2);
}
path[0] = address(this);
path[1] = router.WETH();
function takeFee(address sender, address recipient, uint256 gonAmount) internal returns (uint256){
uint256 _realFee = totalBuyFee;
if(automatedMarketMakerPairs[recipient]) _realFee = totalSellFee;
uint256 feeAmount = gonAmount.mul(_realFee).div(FEE_DENOMINATOR);
_gonBalances[address(this)] = _gonBalances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount.div(_gonsPerFragment));
return gonAmount.sub(feeAmount);
}
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool){
amountToSwap,
uint256 oldValue = _allowedFragments[msg.sender][spender];
0,
if (subtractedValue >= oldValue) {
path,
_allowedFragments[msg.sender][spender] = 0;
address(this),
} else {
block.timestamp
_allowedFragments[msg.sender][spender] = oldValue.sub(
subtractedValue
);
}
emit Approval(
msg.sender,
spender,
_allowedFragments[msg.sender][spender]
);
);
return true;
}
uint256 currentBalance = address(this).balance.sub(
function increaseAllowance(address spender, uint256 addedValue) external returns (bool){
balanceBefore
_allowedFragments[msg.sender][spender] = _allowedFragments[msg.sender][
spender
].add(addedValue);
emit Approval(
msg.sender,
spender,
_allowedFragments[msg.sender][spender]
);
);
return true;