Token 10X: Africa's First Cryptocurrency Hub
CAKEDAO Token
CakeDAO (cDAO) is a community driven DAO protocol based on the PancakeSwap token CAKE.%uD83D%uDC8E%uD83D%uDC8E. %u2747%uFE0F 0% Team tokens %uD83D%uDD12%uD83D%uDD12 Liquidity locked for 365 days. %uD83D%uDD25%uD83D%uDD25 Become the earliest cDAO holder now. %uD83D%uDD25%uD83D%uDD25
...
About CAKEDAO
CakeDAO (cDAO) is a community driven DAO protocol based on the PancakeSwap token CAKE.%uD83D%uDC8E%uD83D%uDC8E. %u2747%uFE0F 0% Team tokens %uD83D%uDD12%uD83D%uDD12 Liquidity locked for 365 days. %uD83D%uDD25%uD83D%uDD25 Become the earliest cDAO holder now. %uD83D%uDD25%uD83D%uDD25
25 total visits
Token information and links
Circulating Supply
100000000000000000000000000000
Token Contract (BSC Chain)
0X7DB48967D8A869D7B65E0036712C74A64AAD62AC
Contract license: None
Launch Date
27/04/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-01-26
*/
/**
*Submitted for verification at BscScan.com on 2022-01-24
*/
/**
*Submitted for verification at BscScan.com on 2022-01-17
*/
pragma solidity ^0.8.6;
// import "hardhat/console.sol";
// SPDX-License-Identifier: Unlicensed
interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external;
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external;
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
abstract contract Ownable {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = msg.sender;
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == msg.sender, "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's ` ` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c a % b); // There is no case in which this doesn't hold
return c;
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint256);
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(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 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 (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 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 (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
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 (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(address to) external returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
interface IMasterChef {
function deposit(uint256 _pid, uint256 _amount) external;
function withdraw(uint256 _pid, uint256 _amount) external;
function enterStaking(uint256 _amount) external;
function leaveStaking(uint256 _amount) external;
function pendingCake(uint256 _pid, address _user) external view returns (uint256);
function userInfo(uint256 _pid, address _user) external view returns (uint256, uint256);
function emergencyWithdraw(uint256 _pid) external;
}
contract CakeDaoToken is IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) public isExcludedFromFee;
mapping(address => bool) public isDividendExempt;
mapping(address => bool) private _updated;
mapping(address => uint256) public shareholderIndexes;
mapping(address => bool) public isOperator;
event CDAODistributeLog(address user, uint256 amount);
event CakeDistributeLog(address user, uint256 amount);
uint256 private _tTotal;
uint256 private _tFeeTotal;
string private _name;
string private _symbol;
uint256 private _decimals;
address private fromAddress;
address private toAddress;
uint256 public distributeAmount;
uint256 public currentIndex;
uint256 public distributorGas = 500000;
address[] public shareholders;
uint256 public waitToAmount;
address public cake;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
constructor(address _router, address _cake) {
_name = "CAKEDAO";
_symbol = "cDAO";
_decimals = 18;
_tTotal = 100_000_000_000 ether;
_tOwned[0xA7cb9bD73A169b75D2f1155b1af8537e14270066] = _tTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(_router);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(
address(this),
_uniswapV2Router.WETH()
);
uniswapV2Router = _uniswapV2Router;
cake = _cake;
isExcludedFromFee[address(this)] = true;
isExcludedFromFee[msg.sender] = true;
isDividendExempt[address(this)] = true;
isDividendExempt[address(0)] = true;
isOperator[msg.sender] = true;
emit Transfer(address(0), msg.sender, _tTotal);
}
modifier onlyOperator() {
require(isOperator[msg.sender], "OPERATOR INVALID");
_;
}
function setOperator(address _operator, bool _flag) public onlyOperator {
require(isOperator[msg.sender], "OPERATOR INVALID");
isOperator[_operator] = _flag;
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
transferAction(from, to, amount);
if (fromAddress == address(0)) fromAddress = from;
if (toAddress == address(0)) toAddress = to;
if (!isDividendExempt[fromAddress] && fromAddress != uniswapV2Pair) setShare(fromAddress);
if (!isDividendExempt[toAddress] && toAddress != uniswapV2Pair) setShare(toAddress);
fromAddress = from;
toAddress = to;
}
function transferAction(
address from,
address to,
uint256 amount
) private {
if (isExcludedFromFee[from] || isExcludedFromFee[to] || from == address(uniswapV2Router)) {
_tokenTransfer(from, to, amount);
} else {
if (from == uniswapV2Pair) {
_tokenTransferBuy(from, to, amount);
} else if (to == uniswapV2Pair) {
_tokenTransferSell(from, to, amount);
} else {
_swapToWETHCake();
_tokenTransfer(from, to, amount);
if (distributeAmount >= 1e16 && IERC20(cake).balanceOf(address(this)) >= 1e16 && from != address(this)) {
process(distributorGas);
}
}
}
}
function _tokenTransferBuy(
address sender,
address recipient,
uint256 tAmount
) private {
uint256 actR = _feeTax(sender, tAmount);
uint256 leftR = 10000 - actR;
_tOwned[recipient] = _tOwned[recipient].add(tAmount.mul(leftR).div(10000));
emit Transfer(sender, recipient, tAmount.mul(leftR).div(10000));
}
function _tokenTransferSell(
address sender,
address recipient,
uint256 tAmount
) private {
uint256 actR = _feeTax(sender, tAmount);
uint256 leftR = 10000 - actR;
_swapToWETHCake();
_tOwned[recipient] = _tOwned[recipient].add(tAmount.mul(leftR).div(10000));
emit Transfer(sender, recipient, tAmount.mul(leftR).div(10000));
}
function _feeTax(address sender, uint256 tAmount) private returns (uint256) {
_tOwned[sender] = _tOwned[sender].sub(tAmount);
uint256 tRa = 900;
_takeLPFee(sender, tAmount.div(10000).mul(400)); //4% for lp
if (balanceOf(address(0)) < 99_900_000_000) {
tRa = tRa.add(300);
_takeburnFee(sender, tAmount.div(10000).mul(300)); //3% for burn
}
uint256 cakeWait = tAmount.div(10000).mul(500); //5% for cake
_tOwned[address(this)] = _tOwned[address(this)].add(cakeWait);
waitToAmount = waitToAmount.add(cakeWait);
emit Transfer(sender, address(this), cakeWait);
return tRa;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 tAmount
) private {
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_tOwned[recipient] = _tOwned[recipient].add(tAmount);
emit Transfer(sender, recipient, tAmount);
}
//=================
function distributeDividend(address shareholder, uint256 tAmount) internal {
distributeAmount = distributeAmount.sub(tAmount);
_tOwned[address(this)] = _tOwned[address(this)].sub(tAmount);
_tOwned[shareholder] = _tOwned[shareholder].add(tAmount);
emit Transfer(address(this), shareholder, tAmount);
emit CDAODistributeLog(shareholder, tAmount);
}
function setShare(address shareholder) private {
if (_updated[shareholder]) {
if (IERC20(uniswapV2Pair).balanceOf(shareholder) == 0) {
quitShare(shareholder);
}
return;
}
if (IERC20(uniswapV2Pair).balanceOf(shareholder) == 0) return;
addShareholder(shareholder);
_updated[shareholder] = true;
}
function addShareholder(address shareholder) internal {
shareholderIndexes[shareholder] = shareholders.length;
shareholders.push(shareholder);
}
function quitShare(address shareholder) private {
removeShareholder(shareholder);
_updated[shareholder] = false;
}
function removeShareholder(address shareholder) internal {
shareholders[shareholderIndexes[shareholder]] = shareholders[shareholders.length - 1];
shareholderIndexes[shareholders[shareholders.length - 1]] = shareholderIndexes[shareholder];
shareholders.pop();
}
//==========================
function _takeLPFee(address sender, uint256 tAmount) private {
_tOwned[address(this)] = _tOwned[address(this)].add(tAmount);
distributeAmount = distributeAmount.add(tAmount);
emit Transfer(sender, address(this), tAmount);
}
function _takeburnFee(address sender, uint256 tAmount) private {
_tOwned[address(0)] = _tOwned[address(0)].add(tAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);
emit Transfer(sender, address(0), tAmount);
}
/// base -------
function setExcluded(address account, bool _flag) public onlyOperator {
isExcludedFromFee[account] = _flag;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint256) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tOwned[account];
}
function transfer(address recipient, uint256 amount) public override {
_transfer(msg.sender, recipient, amount);
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override {
_transfer(sender, recipient, amount);
_approve(
sender,
msg.sender,
_allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance")
);
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(
msg.sender,
spender,
_allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")
);
return true;
}
receive() external payable {}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _swapToWETHCake() private {
if (waitToAmount == 0) return;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), waitToAmount);
uint256 beforeCake = IERC20(cake).balanceOf(address(this));
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
waitToAmount,
0,
path,
address(this),
block.timestamp
);
path[0] = uniswapV2Router.WETH();
path[1] = cake;
uniswapV2Router.swapExactETHForTokens{ value: address(this).balance }(0, path, address(this), block.timestamp);
waitToAmount = 0;
uint256 afterCake = IERC20(cake).balanceOf(address(this));
require(afterCake > beforeCake, "CAKE BALANCE INVALID");
}
function setDistributorGas(uint256 _distributorGas) public onlyOperator {
distributorGas = _distributorGas;
}
function process(uint256 gas) private {
uint256 shareholderCount = shareholders.length;
if (shareholderCount == 0) return;
uint256 gasUsed = 0;
uint256 gasLeft = gasleft();
uint256 iterations = 0;
uint256 cakeAmount = IERC20(cake).balanceOf(address(this));
while (gasUsed < gas && iterations < shareholderCount) {
if (currentIndex >= shareholders.length) {
currentIndex = 0;
}
uint256 amount = distributeAmount.mul(IERC20(uniswapV2Pair).balanceOf(shareholders[currentIndex])).div(
IERC20(uniswapV2Pair).totalSupply()
);
uint256 amountCake = cakeAmount.mul(IERC20(uniswapV2Pair).balanceOf(shareholders[currentIndex])).div(
IERC20(uniswapV2Pair).totalSupply()
);
if (balanceOf(address(this)) < amount) return;
if (IERC20(cake).balanceOf(address(this)) < amountCake) return;
IERC20(cake).transfer(shareholders[currentIndex], amountCake);
emit CakeDistributeLog(shareholders[currentIndex], amountCake);
distributeDividend(shareholders[currentIndex], amount);
gasUsed = gasUsed.add(gasLeft.sub(gasleft()));
gasLeft = gasleft();
currentIndex ;
iterations ;
}
}
function viewTokenOutAmount(
uint256 _amountIn,
address token0,
address token1
) public view returns (uint256[] memory) {
address[] memory path = new address[](2);
path[0] = token0;
path[1] = token1;
return uniswapV2Router.getAmountsOut(_amountIn, path);
}
}
*Submitted for verification at BscScan.com on 2022-01-26
*/
/**
*Submitted for verification at BscScan.com on 2022-01-24
*/
/**
*Submitted for verification at BscScan.com on 2022-01-17
*/
pragma solidity ^0.8.6;
// import "hardhat/console.sol";
// SPDX-License-Identifier: Unlicensed
interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external;
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external;
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
abstract contract Ownable {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = msg.sender;
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == msg.sender, "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's ` ` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c a % b); // There is no case in which this doesn't hold
return c;
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint256);
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(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 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 (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 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 (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
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 (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(address to) external returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
interface IMasterChef {
function deposit(uint256 _pid, uint256 _amount) external;
function withdraw(uint256 _pid, uint256 _amount) external;
function enterStaking(uint256 _amount) external;
function leaveStaking(uint256 _amount) external;
function pendingCake(uint256 _pid, address _user) external view returns (uint256);
function userInfo(uint256 _pid, address _user) external view returns (uint256, uint256);
function emergencyWithdraw(uint256 _pid) external;
}
contract CakeDaoToken is IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) public isExcludedFromFee;
mapping(address => bool) public isDividendExempt;
mapping(address => bool) private _updated;
mapping(address => uint256) public shareholderIndexes;
mapping(address => bool) public isOperator;
event CDAODistributeLog(address user, uint256 amount);
event CakeDistributeLog(address user, uint256 amount);
uint256 private _tTotal;
uint256 private _tFeeTotal;
string private _name;
string private _symbol;
uint256 private _decimals;
address private fromAddress;
address private toAddress;
uint256 public distributeAmount;
uint256 public currentIndex;
uint256 public distributorGas = 500000;
address[] public shareholders;
uint256 public waitToAmount;
address public cake;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
constructor(address _router, address _cake) {
_name = "CAKEDAO";
_symbol = "cDAO";
_decimals = 18;
_tTotal = 100_000_000_000 ether;
_tOwned[0xA7cb9bD73A169b75D2f1155b1af8537e14270066] = _tTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(_router);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(
address(this),
_uniswapV2Router.WETH()
);
uniswapV2Router = _uniswapV2Router;
cake = _cake;
isExcludedFromFee[address(this)] = true;
isExcludedFromFee[msg.sender] = true;
isDividendExempt[address(this)] = true;
isDividendExempt[address(0)] = true;
isOperator[msg.sender] = true;
emit Transfer(address(0), msg.sender, _tTotal);
}
modifier onlyOperator() {
require(isOperator[msg.sender], "OPERATOR INVALID");
_;
}
function setOperator(address _operator, bool _flag) public onlyOperator {
require(isOperator[msg.sender], "OPERATOR INVALID");
isOperator[_operator] = _flag;
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
transferAction(from, to, amount);
if (fromAddress == address(0)) fromAddress = from;
if (toAddress == address(0)) toAddress = to;
if (!isDividendExempt[fromAddress] && fromAddress != uniswapV2Pair) setShare(fromAddress);
if (!isDividendExempt[toAddress] && toAddress != uniswapV2Pair) setShare(toAddress);
fromAddress = from;
toAddress = to;
}
function transferAction(
address from,
address to,
uint256 amount
) private {
if (isExcludedFromFee[from] || isExcludedFromFee[to] || from == address(uniswapV2Router)) {
_tokenTransfer(from, to, amount);
} else {
if (from == uniswapV2Pair) {
_tokenTransferBuy(from, to, amount);
} else if (to == uniswapV2Pair) {
_tokenTransferSell(from, to, amount);
} else {
_swapToWETHCake();
_tokenTransfer(from, to, amount);
if (distributeAmount >= 1e16 && IERC20(cake).balanceOf(address(this)) >= 1e16 && from != address(this)) {
process(distributorGas);
}
}
}
}
function _tokenTransferBuy(
address sender,
address recipient,
uint256 tAmount
) private {
uint256 actR = _feeTax(sender, tAmount);
uint256 leftR = 10000 - actR;
_tOwned[recipient] = _tOwned[recipient].add(tAmount.mul(leftR).div(10000));
emit Transfer(sender, recipient, tAmount.mul(leftR).div(10000));
}
function _tokenTransferSell(
address sender,
address recipient,
uint256 tAmount
) private {
uint256 actR = _feeTax(sender, tAmount);
uint256 leftR = 10000 - actR;
_swapToWETHCake();
_tOwned[recipient] = _tOwned[recipient].add(tAmount.mul(leftR).div(10000));
emit Transfer(sender, recipient, tAmount.mul(leftR).div(10000));
}
function _feeTax(address sender, uint256 tAmount) private returns (uint256) {
_tOwned[sender] = _tOwned[sender].sub(tAmount);
uint256 tRa = 900;
_takeLPFee(sender, tAmount.div(10000).mul(400)); //4% for lp
if (balanceOf(address(0)) < 99_900_000_000) {
tRa = tRa.add(300);
_takeburnFee(sender, tAmount.div(10000).mul(300)); //3% for burn
}
uint256 cakeWait = tAmount.div(10000).mul(500); //5% for cake
_tOwned[address(this)] = _tOwned[address(this)].add(cakeWait);
waitToAmount = waitToAmount.add(cakeWait);
emit Transfer(sender, address(this), cakeWait);
return tRa;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 tAmount
) private {
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_tOwned[recipient] = _tOwned[recipient].add(tAmount);
emit Transfer(sender, recipient, tAmount);
}
//=================
function distributeDividend(address shareholder, uint256 tAmount) internal {
distributeAmount = distributeAmount.sub(tAmount);
_tOwned[address(this)] = _tOwned[address(this)].sub(tAmount);
_tOwned[shareholder] = _tOwned[shareholder].add(tAmount);
emit Transfer(address(this), shareholder, tAmount);
emit CDAODistributeLog(shareholder, tAmount);
}
function setShare(address shareholder) private {
if (_updated[shareholder]) {
if (IERC20(uniswapV2Pair).balanceOf(shareholder) == 0) {
quitShare(shareholder);
}
return;
}
if (IERC20(uniswapV2Pair).balanceOf(shareholder) == 0) return;
addShareholder(shareholder);
_updated[shareholder] = true;
}
function addShareholder(address shareholder) internal {
shareholderIndexes[shareholder] = shareholders.length;
shareholders.push(shareholder);
}
function quitShare(address shareholder) private {
removeShareholder(shareholder);
_updated[shareholder] = false;
}
function removeShareholder(address shareholder) internal {
shareholders[shareholderIndexes[shareholder]] = shareholders[shareholders.length - 1];
shareholderIndexes[shareholders[shareholders.length - 1]] = shareholderIndexes[shareholder];
shareholders.pop();
}
//==========================
function _takeLPFee(address sender, uint256 tAmount) private {
_tOwned[address(this)] = _tOwned[address(this)].add(tAmount);
distributeAmount = distributeAmount.add(tAmount);
emit Transfer(sender, address(this), tAmount);
}
function _takeburnFee(address sender, uint256 tAmount) private {
_tOwned[address(0)] = _tOwned[address(0)].add(tAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);
emit Transfer(sender, address(0), tAmount);
}
/// base -------
function setExcluded(address account, bool _flag) public onlyOperator {
isExcludedFromFee[account] = _flag;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint256) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tOwned[account];
}
function transfer(address recipient, uint256 amount) public override {
_transfer(msg.sender, recipient, amount);
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override {
_transfer(sender, recipient, amount);
_approve(
sender,
msg.sender,
_allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance")
);
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(
msg.sender,
spender,
_allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")
);
return true;
}
receive() external payable {}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _swapToWETHCake() private {
if (waitToAmount == 0) return;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), waitToAmount);
uint256 beforeCake = IERC20(cake).balanceOf(address(this));
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
waitToAmount,
0,
path,
address(this),
block.timestamp
);
path[0] = uniswapV2Router.WETH();
path[1] = cake;
uniswapV2Router.swapExactETHForTokens{ value: address(this).balance }(0, path, address(this), block.timestamp);
waitToAmount = 0;
uint256 afterCake = IERC20(cake).balanceOf(address(this));
require(afterCake > beforeCake, "CAKE BALANCE INVALID");
}
function setDistributorGas(uint256 _distributorGas) public onlyOperator {
distributorGas = _distributorGas;
}
function process(uint256 gas) private {
uint256 shareholderCount = shareholders.length;
if (shareholderCount == 0) return;
uint256 gasUsed = 0;
uint256 gasLeft = gasleft();
uint256 iterations = 0;
uint256 cakeAmount = IERC20(cake).balanceOf(address(this));
while (gasUsed < gas && iterations < shareholderCount) {
if (currentIndex >= shareholders.length) {
currentIndex = 0;
}
uint256 amount = distributeAmount.mul(IERC20(uniswapV2Pair).balanceOf(shareholders[currentIndex])).div(
IERC20(uniswapV2Pair).totalSupply()
);
uint256 amountCake = cakeAmount.mul(IERC20(uniswapV2Pair).balanceOf(shareholders[currentIndex])).div(
IERC20(uniswapV2Pair).totalSupply()
);
if (balanceOf(address(this)) < amount) return;
if (IERC20(cake).balanceOf(address(this)) < amountCake) return;
IERC20(cake).transfer(shareholders[currentIndex], amountCake);
emit CakeDistributeLog(shareholders[currentIndex], amountCake);
distributeDividend(shareholders[currentIndex], amount);
gasUsed = gasUsed.add(gasLeft.sub(gasleft()));
gasLeft = gasleft();
currentIndex ;
iterations ;
}
}
function viewTokenOutAmount(
uint256 _amountIn,
address token0,
address token1
) public view returns (uint256[] memory) {
address[] memory path = new address[](2);
path[0] = token0;
path[1] = token1;
return uniswapV2Router.getAmountsOut(_amountIn, path);
}
}