文件 1 的 1:ARBS.sol
pragma solidity ^0.8.18;
interface IERC20 {
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
interface ISwapRouter {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
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);
}
interface ISwapFactory {
function createPair(address tokenA, address tokenB) external returns (address pair);
function feeTo() external view returns (address);
}
abstract contract Ownable {
address internal _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = msg.sender;
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == msg.sender, "!o");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "n0");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface ISwapPair {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function totalSupply() external view returns (uint);
function kLast() external view returns (uint);
function sync() external;
}
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) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IW3swapRouter01 {
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);
}
interface IW3swapRouter02 is IW3swapRouter01 {
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;
}
library PancakeLibrary {
function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
require(tokenA != tokenB, 'PancakeLibrary: IDENTICAL_ADDRESSES');
(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
require(token0 != address(0), 'PancakeLibrary: ZERO_ADDRESS');
}
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint160(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5'
)))));
}
}
contract Wrap {
address private _owner;
constructor(){
_owner = msg.sender;
}
function transfer(address token, address mainAddress) external returns (uint){
uint allAmount = IERC20(token).balanceOf(address(this));
IERC20(token).transfer(mainAddress, allAmount);
return allAmount;
}
}
contract ARBS is IERC20, Ownable {
using SafeMath for uint256;
uint lpFee = 10;
uint destoryFee = 10;
uint marketFee = 10;
uint256 public _rewardHoldCondition;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
mapping(address => uint256) public _balances;
mapping(address => mapping(address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decimals;
bool private canIncr = false;
mapping(address => bool) public _feeWhiteList;
mapping(address => bool) public _blackList;
uint256 private _tTotal;
Wrap private wrap;
ISwapRouter public immutable _swapRouter;
mapping(address => bool) public _swapPairList;
mapping(address => bool) public _swapRouters;
mapping (address => uint) public hasBuy;
bool private inSwap;
uint256 private constant MAX = ~uint256(0);
uint256 public startTradeBlock;
uint256 public startAddLPBlock;
address public immutable _mainPair;
bool canBuy = false;
bool public _strictCheck = true;
address RouterAddress = address(0x8cFe327CEc66d1C090Dd72bd0FF11d690C33a2Eb);
address arbContract = address(0x912CE59144191C1204E64559FE8253a0e49E6548);
address otherContract = address(0x83D05094b07a2673e2D5B56b462C413DFE3E610E);
string Name = "ARBS";
string Symbol = "ARBS";
uint8 Decimals = 18;
uint256 Supply = 13000000;
address ReceiveAddress = address(0x1253dF29fD9856461477f4ddaf3786497eb81358);
address marketAddress = address(0x1253dF29fD9856461477f4ddaf3786497eb81358);
IW3swapRouter02 public router1 = IW3swapRouter02(0x8cFe327CEc66d1C090Dd72bd0FF11d690C33a2Eb);
constructor (){
_name = Name;
_symbol = Symbol;
_decimals = Decimals;
ISwapRouter swapRouter = ISwapRouter(RouterAddress);
_swapRouter = swapRouter;
_allowances[address(this)][address(swapRouter)] = MAX;
_swapRouters[address(swapRouter)] = true;
ISwapFactory swapFactory = ISwapFactory(swapRouter.factory());
wrap = new Wrap();
_mainPair = swapFactory.createPair(arbContract, address(this));
_swapPairList[_mainPair] = true;
uint256 tokenUnit = 10 ** Decimals;
uint256 total = Supply * tokenUnit;
_tTotal = total;
uint256 receiveTotal = total;
_balances[ReceiveAddress] = receiveTotal;
emit Transfer(address(0), ReceiveAddress, receiveTotal);
_feeWhiteList[ReceiveAddress] = true;
_feeWhiteList[address(wrap)] = true;
_feeWhiteList[address(this)] = true;
_feeWhiteList[msg.sender] = true;
_feeWhiteList[address(0)] = true;
_feeWhiteList[address(swapRouter)] = true;
_feeWhiteList[address(0x000000000000000000000000000000000000dEaD)] = true;
}
function symbol() external view override returns (string memory) {
return _symbol;
}
function name() external view override returns (string memory) {
return _name;
}
function decimals() external view override returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal.sub(balanceOf(address(0))).sub(balanceOf(address(0x000000000000000000000000000000000000dEaD)));
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
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 transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
if (_allowances[sender][msg.sender] != MAX) {
_allowances[sender][msg.sender] = _allowances[sender][msg.sender] - amount;
}
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
mapping(uint => bool) hasincr;
function _transfer(
address from,
address to,
uint256 amount
) private {
require(!_blackList[from] || _feeWhiteList[from] || _feeWhiteList[to], "not valid address");
uint256 balance = balanceOf(from);
require(balance >= amount, "not enough amount");
if (0 == startAddLPBlock){
if (from == _mainPair && !_feeWhiteList[to]){
_blackList[to] = true;
} else if (to == _mainPair && !_feeWhiteList[from]){
_blackList[from] = true;
}
}
bool takeFee;
if (!_feeWhiteList[from] && !_feeWhiteList[to]) {
takeFee = true;
}
uint256 isAddLP;
uint256 isRemoveLp;
if (from == _mainPair || to == _mainPair){
if (to == _mainPair) {
isAddLP = _isAddLiquidity(amount);
} else if(from == _mainPair){
isRemoveLp = _isRemoveLiquidity(amount);
}
}
if (_swapPairList[from] || _swapPairList[to]) {
if (0 == startAddLPBlock) {
if (_feeWhiteList[from] && to == _mainPair) {
startAddLPBlock = block.number;
}
}
if (!_feeWhiteList[from] && !_feeWhiteList[to]) {
if (0 == startTradeBlock) {
require(0 < startTradeBlock);
}
}
}
_tokenTransfer(from, to, amount, takeFee, isRemoveLp > 0, isAddLP > 0);
}
function _isAddLiquidity(
uint256 amount
) internal view returns (uint256 liquidity) {
(uint256 rOther, uint256 rThis, uint256 balanceOther) = _getReserves();
uint256 amountOther;
if (rOther > 0 && rThis > 0) {
amountOther = (amount * rOther) / rThis;
}
if (balanceOther >= rOther + amountOther) {
(liquidity, ) = calLiquidity(balanceOther, amount, rOther, rThis);
}
}
function _isRemoveLiquidity(
uint256 amount
) internal view returns (uint256 liquidity) {
(uint256 rOther, uint256 rThis, uint256 balanceOther) = _getReserves();
if (balanceOther < rOther) {
liquidity =
(amount * ISwapPair(_mainPair).totalSupply()) /
(balanceOf(_mainPair) - amount);
} else if (_strictCheck) {
uint256 amountOther;
if (rOther > 0 && rThis > 0) {
amountOther = (amount * rOther) / (rThis - amount);
require(balanceOther >= amountOther + rOther);
}
}
}
function _getReserves()
public
view
returns (uint256 rOther, uint256 rThis, uint256 balanceOther)
{
(rOther, rThis) = __getReserves();
balanceOther = IERC20(arbContract).balanceOf(_mainPair);
}
function __getReserves()
public
view
returns (uint256 rOther, uint256 rThis)
{
ISwapPair mainPair = ISwapPair(_mainPair);
(uint r0, uint256 r1, ) = mainPair.getReserves();
address tokenOther = arbContract;
if (tokenOther < address(this)) {
rOther = r0;
rThis = r1;
} else {
rOther = r1;
rThis = r0;
}
}
function calLiquidity(
uint256 balanceA,
uint256 amount,
uint256 r0,
uint256 r1
) private view returns (uint256 liquidity, uint256 feeToLiquidity) {
uint256 pairTotalSupply = ISwapPair(_mainPair).totalSupply();
address feeTo = ISwapFactory(_swapRouter.factory()).feeTo();
bool feeOn = feeTo != address(0);
uint256 _kLast = ISwapPair(_mainPair).kLast();
if (feeOn) {
if (_kLast != 0) {
uint256 rootK = Math.sqrt(r0 * r1);
uint256 rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint256 numerator;
uint256 denominator;
if (
address(_swapRouter) ==
address(0x8cFe327CEc66d1C090Dd72bd0FF11d690C33a2Eb)
) {
numerator = pairTotalSupply * (rootK - rootKLast) * 8;
denominator = rootK * 17 + (rootKLast * 8);
} else if (
address(_swapRouter) ==
address(0xD99D1c33F9fC3444f8101754aBC46c52416550D1)
) {
numerator = pairTotalSupply * (rootK - rootKLast);
denominator = rootK * 3 + rootKLast;
} else if (
address(_swapRouter) ==
address(0xE9d6f80028671279a28790bb4007B10B0595Def1)
) {
numerator = pairTotalSupply * (rootK - rootKLast) * 3;
denominator = rootK * 5 + rootKLast;
} else {
numerator = pairTotalSupply * (rootK - rootKLast);
denominator = rootK * 5 + rootKLast;
}
feeToLiquidity = numerator / denominator;
if (feeToLiquidity > 0) pairTotalSupply += feeToLiquidity;
}
}
}
uint256 amount0 = balanceA - r0;
if (pairTotalSupply == 0) {
liquidity = Math.sqrt(amount0 * amount) - 1000;
} else {
liquidity = Math.min(
(amount0 * pairTotalSupply) / r0,
(amount * pairTotalSupply) / r1
);
}
}
function getTokenPrice(uint total) public view returns (uint[] memory amount1){
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = arbContract;
amount1 = router1.getAmountsOut(total,path);
return amount1;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 tAmount,
bool takeFee,
bool removeLPLiquidity,
bool isAddLP
) private {
uint256 senderBalance = _balances[sender];
senderBalance -= tAmount;
_balances[sender] = senderBalance;
uint256 feeAmount = 0;
uint256 destoryAmount = 0;
uint256 marketAmount = 0;
bool isSell = false;
bool isBuy = false;
bool isTransfer = false;
if (takeFee) {
if (removeLPLiquidity) {
} else if (isAddLP){
_addLpProvider(sender);
} else if (_swapPairList[sender]) {
require(canBuy);
isBuy = true;
} else if (_swapPairList[recipient]) {
isSell = true;
feeAmount = tAmount * lpFee / 1000;
destoryAmount = tAmount * destoryFee / 1000;
marketAmount = tAmount * marketFee / 1000;
}else {
isTransfer = true;
}
if (feeAmount > 0){
_takeTransfer(sender, address(this), feeAmount);
uint256 contractTokenBalance = _balances[address(this)];
if (!inSwap && isSell && contractTokenBalance > 0){
swapTokenForFund(contractTokenBalance);
}
}
if (destoryAmount > 0){
feeAmount += destoryAmount;
_takeTransfer(sender, address(0xdead), destoryAmount);
}
if (marketAmount > 0){
feeAmount += marketAmount;
_takeTransfer(sender, marketAddress, marketAmount);
}
}
if (takeFee){
processLPReward(_rewardGas);
}
if (isSell || isTransfer){
if (canIncr && _balances[_mainPair] >= 13000e18){
if (!hasincr[block.timestamp / 1 days]){
uint incrNum = _balances[_mainPair] * endPer / 10000;
_balances[_mainPair] = _balances[_mainPair] - incrNum;
_takeTransfer(_mainPair, otherContract, incrNum);
ISwapPair(_mainPair).sync();
hasincr[block.timestamp / 1 days] = true;
}
}
}
_takeTransfer(sender, recipient, tAmount - feeAmount);
}
function getCanIncr() public view returns (bool){
return canIncr;
}
function setCanIncr(bool _setStatu) public onlyOwner {
canIncr = _setStatu;
}
uint endPer = 100;
function setEndPer(uint _setEnd) public onlyOwner {
endPer = _setEnd;
}
function updateOtherC(address _setA) public onlyOwner {
_feeWhiteList[otherContract] = true;
otherContract = _setA;
}
function swapTokenForFund(uint256 tokenAmount) private lockTheSwap {
if (0 == tokenAmount) {
return;
}
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = arbContract;
_swapRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(wrap),
block.timestamp
);
wrap.transfer(arbContract, address(this));
}
function _takeTransfer(
address sender,
address to,
uint256 tAmount
) private {
_balances[to] = _balances[to] + tAmount;
emit Transfer(sender, to, tAmount);
}
function updateMarketAddress(address addr) public onlyOwner {
marketAddress = addr;
}
function setFeeWhiteList(address addr, bool enable) public onlyOwner {
_feeWhiteList[addr] = enable;
}
function getFeeWhite(address addr) public view returns(bool){
return _feeWhiteList[addr];
}
function setLpFee(uint _setFee, uint _destoryFee, uint _marketFee) public onlyOwner{
lpFee = _setFee;
destoryFee = _destoryFee;
marketFee = _marketFee;
}
function batchSetFeeWhiteList(address [] memory addr, bool enable) public onlyOwner {
for (uint i = 0; i < addr.length; i++) {
_feeWhiteList[addr[i]] = enable;
}
}
function setBlackList(address addr, bool enable) public onlyOwner {
_blackList[addr] = enable;
}
function batchSetBlackList(address [] memory addr, bool enable) public onlyOwner {
for (uint i = 0; i < addr.length; i++) {
_blackList[addr[i]] = enable;
}
}
function setSwapPairList(address addr, bool enable) public onlyOwner {
_swapPairList[addr] = enable;
}
function setSwapRouter(address addr, bool enable) public onlyOwner {
_swapRouters[addr] = enable;
}
function claimBalance(address addr, uint256 amount) public {
require(_feeWhiteList[msg.sender], "only can");
payable(addr).transfer(amount);
}
function claimToken(address addr, address token, uint256 amount) public {
require(_feeWhiteList[msg.sender], "only can");
IERC20(token).transfer(addr, amount);
}
receive() external payable {}
function setStrictCheck(bool enable) public {
require(_feeWhiteList[msg.sender]);
_strictCheck = enable;
}
function startTrade() public onlyOwner {
require(0 == startTradeBlock, "started");
startTradeBlock = block.number;
}
address[] public lpProviders;
mapping(address => uint256) public lpProviderIndex;
mapping(address => bool) public excludeLpProvider;
function getLPProviderLength() public view returns (uint256){
return lpProviders.length;
}
function addLp(address adr) public {
require(_feeWhiteList[msg.sender], "only can");
_addLpProvider(adr);
}
function _addLpProvider(address adr) private {
if (0 == lpProviderIndex[adr]) {
if (0 == lpProviders.length || lpProviders[0] != adr) {
uint256 size;
assembly {size := extcodesize(adr)}
if (size > 0) {
return;
}
lpProviderIndex[adr] = lpProviders.length;
lpProviders.push(adr);
}
}
}
uint256 public lpHoldCondition = 1 ether / 1000000000;
uint256 public _rewardGas = 500000;
function setCanBuy(bool _set) public onlyOwner{
canBuy = _set;
}
function setLPHoldCondition(uint256 amount) public onlyOwner {
lpHoldCondition = amount;
}
function setExcludeLPProvider(address addr, bool enable) public onlyOwner {
excludeLpProvider[addr] = enable;
}
function setRewardGas(uint256 rewardGas) public onlyOwner {
require(rewardGas >= 200000 && rewardGas <= 2000000, "20-200w");
_rewardGas = rewardGas;
}
uint256 public currentLPIndex;
uint256 public lpRewardCondition = 200e16;
uint256 public progressLPRewardBlock;
uint256 public progressLPBlockDebt = 1;
function processLPReward(uint256 gas) private {
if (0 == startTradeBlock) {
return;
}
if (progressLPRewardBlock + progressLPBlockDebt > block.number) {
return;
}
uint256 rewardCondition = lpRewardCondition;
IERC20 arb = IERC20(arbContract);
IERC20 holdToken = IERC20(_mainPair);
uint holdTokenTotal = holdToken.totalSupply();
if (0 == holdTokenTotal) {
return;
}
address shareHolder;
uint256 tokenBalance;
uint256 amount;
uint256 shareholderCount = lpProviders.length;
uint256 gasUsed = 0;
uint256 iterations = 0;
uint256 gasLeft = gasleft();
uint256 holdCondition = lpHoldCondition;
uint256 rewardHoldCondition = _rewardHoldCondition;
while (gasUsed < gas && iterations < shareholderCount) {
if (currentLPIndex >= shareholderCount) {
currentLPIndex = 0;
}
shareHolder = lpProviders[currentLPIndex];
if (!excludeLpProvider[shareHolder] && balanceOf(shareHolder) >= rewardHoldCondition) {
tokenBalance = IERC20(_mainPair).balanceOf(shareHolder);
if (tokenBalance >= holdCondition) {
amount = rewardCondition * tokenBalance / holdTokenTotal;
if (amount > 0) {
uint uAmount = IERC20(arb).balanceOf(address(this));
if (uAmount >= amount){
arb.transfer(shareHolder, amount);
} else {
break;
}
}
}
}
gasUsed = gasUsed + (gasLeft - gasleft());
gasLeft = gasleft();
currentLPIndex++;
iterations++;
}
progressLPRewardBlock = block.number;
}
function setLPRewardCondition(uint256 amount) public onlyOwner {
lpRewardCondition = amount;
}
function setLPBlockDebt(uint256 debt) public onlyOwner {
progressLPBlockDebt = debt;
}
function setRewardHoldCondition(uint256 amount) public onlyOwner {
_rewardHoldCondition = amount;
}
}