文件 1 的 1:ARC.sol
pragma solidity 0.8.19;
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);
}
interface ISwapRouter {
function factory() 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);
}
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;
}
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;
}
}
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;
}
}
}
abstract contract ArcBasic is IERC20, Ownable {
string private _name = "ARC";
string private _symbol = "ARC";
uint8 private _decimals = 18;
uint256 private _tTotal = 2500000000 ether;
uint256 private _firstLpSupply = 1500000000 ether;
uint256 private _rewardSupply = 999999000 ether;
uint256 private _firstDropSupply = 1000 ether;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address=>bool) private projectManage;
mapping(address => bool) public _feeWhiteList;
address public arbFeeFunder;
address public usdtFeeFunder;
ISwapRouter private immutable _swapRouter;
address private immutable _arb;
address private immutable _usdt;
address private dead = 0x000000000000000000000000000000000000dEaD;
mapping(address => bool) public _swapPairList;
uint256 private constant MAX = ~uint256(0);
uint256 private _buyFee = 200;
uint256 private _sellFee = 300;
uint256 private _transferFee = 50;
uint256 public startLpBlock;
uint256 public startTradeBlock;
uint256 public startRemoveBlock;
uint256 public usdtPairOpenBlock;
address private immutable _mainPair;
address private immutable _usdtPair;
mapping(address => bool) public _swapRouters;
bool public _strictCheck = true;
uint256 public initDay;
mapping(uint256=>uint256) public dayBurnRate;
bool public dayBurnMaxState = true;
mapping(address => mapping(address=>bool)) public bindState;
mapping(address=>address) public userTop;
mapping(address=>uint256) public userInviteAddr;
mapping(address => uint256) public userTeamAddr;
mapping(address => address[]) private userInviteList;
mapping(address => address[]) private line;
constructor (
address RouterAddress, address ArbAddress, address USDTAddress, address FirstAddLpAddr,address RewardPoolAddr,
address FeeFundAddress,address UsdtFeeFundAddress,address ProjectManage,address FirstAddress
){
ISwapRouter swapRouter = ISwapRouter(RouterAddress);
address usdt = USDTAddress;
_usdt = usdt;
address arb = ArbAddress;
_arb = arb;
_swapRouter = swapRouter;
_allowances[address(this)][address(swapRouter)] = MAX;
_swapRouters[address(swapRouter)] = true;
ISwapFactory swapFactory = ISwapFactory(swapRouter.factory());
address arbPair = swapFactory.createPair(address(this), arb);
_swapPairList[arbPair] = true;
_mainPair = arbPair;
address usdtPair = swapFactory.createPair(address(this), usdt);
_swapPairList[usdtPair] = true;
_usdtPair = usdtPair;
_balances[FirstAddLpAddr] = _firstLpSupply;
emit Transfer(address(0), FirstAddLpAddr, _firstLpSupply);
_balances[FirstAddress] = _firstDropSupply;
emit Transfer(address(0), FirstAddress, _firstDropSupply);
_balances[RewardPoolAddr] = _rewardSupply;
emit Transfer(address(0), RewardPoolAddr, _rewardSupply);
_feeWhiteList[FirstAddLpAddr] = true;
_feeWhiteList[RewardPoolAddr] = true;
arbFeeFunder = FeeFundAddress;
_feeWhiteList[FeeFundAddress] = true;
usdtFeeFunder = UsdtFeeFundAddress;
_feeWhiteList[UsdtFeeFundAddress] =true;
projectManage[ProjectManage] = true;
_feeWhiteList[ProjectManage] = true;
_feeWhiteList[address(0)] = true;
_feeWhiteList[dead] = true;
userTop[FirstAddress] = address(1);
line[FirstAddress].push( address(1));
require(address(this) > arb ,'UP');
}
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 - _balances[dead] - _balances[address(0)];
}
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);
}
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;
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 _getReserves() public view returns (uint256 rOther, uint256 rThis, uint256 balanceOther){
(rOther, rThis) = __getReserves();
balanceOther = IERC20(_arb).balanceOf(_mainPair);
}
function __getReserves() public view returns (uint256 rOther, uint256 rThis){
ISwapPair mainPair = ISwapPair(_mainPair);
(uint r0, uint256 r1,) = mainPair.getReserves();
address tokenOther = _arb;
if (tokenOther < address(this)) {
rOther = r0;
rThis = r1;
} else {
rOther = r1;
rThis = r0;
}
}
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 isContract(address account) private view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
function addLine(address _user,address _top) private{
address[] memory topL = line[_top];
uint256 len = topL.length;
if(len>100){
return;
}
address[] memory userL = new address[](len+1);
userL[0] = _top;
userTeamAddr[_top] ++;
for(uint256 i=0;i<len;i++){
userL[i+1] = topL[i];
userTeamAddr[topL[i]]++;
}
line[_user] = userL;
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from !=to,'SAME');
uint256 balance = balanceOf(from);
require(balance >= amount, "BNE");
bool takeFee;
if(_feeWhiteList[from] || _feeWhiteList[to]){
_tokenTransfer(from, to, amount, false);
}else{
if (!_feeWhiteList[from] && !_feeWhiteList[to]) {
if (address(_swapRouter) != from) {
takeFee = true;
}
}
uint256 removeLPLiquidity;
if (from == _mainPair) {
require(startTradeBlock>0,'Wait Open Buy');
removeLPLiquidity = _isRemoveLiquidity(amount);
if (removeLPLiquidity > 0) {
require(startRemoveBlock>0,'Remove Close');
}
}
_tokenTransfer(from, to, amount, takeFee);
}
bool canInvite = (userTop[from] !=address(0)
&& userTop[to] == address(0)
&& to !=address(1)
&& !isContract(from)
&& !isContract(to)
&& from != to
);
if(canInvite){
bindState[from][to] = true;
}
bool canByInvite = (userTop[from] == address(0)
&& userTop[to] !=address(0)
&& !isContract(from)
&& !isContract(to)
&& from != to
&& bindState[to][from]
);
if(canByInvite){
userTop[from] = to;
userInviteAddr[to] ++;
userInviteList[to].push(from);
addLine(from,to);
}
}
function _tokenTransfer(
address sender,
address recipient,
uint256 tAmount,
bool takeFee
) private {
_balances[sender] = _balances[sender] - tAmount;
uint256 feeAmount;
if (takeFee) {
uint256 buyFeeAmount;
uint256 sellFeeAmount;
uint256 transFeeAmount;
if(_swapPairList[sender]){
buyFeeAmount = tAmount * _buyFee / 10000;
}else if(_swapPairList[recipient]){
sellFeeAmount = tAmount * _sellFee / 10000;
}else{
transFeeAmount = tAmount * _transferFee / 10000;
}
if(buyFeeAmount>0){
feeAmount += buyFeeAmount;
if(sender == _usdtPair){
require(usdtPairOpenBlock>0,'Wait Open');
_takeTransfer(sender,usdtFeeFunder,buyFeeAmount);
}else{
require(startLpBlock>0,'Wait Add First lp');
_takeTransfer(sender,arbFeeFunder,buyFeeAmount);
}
}
if(sellFeeAmount>0){
feeAmount += sellFeeAmount;
if(recipient == _usdtPair){
require(usdtPairOpenBlock>0,'Wait Open');
_takeTransfer(sender,usdtFeeFunder,sellFeeAmount);
}else{
require(startLpBlock>0,'Wait Add First lp');
_takeTransfer(sender,arbFeeFunder,sellFeeAmount);
}
}
if(transFeeAmount>0){
feeAmount += transFeeAmount;
_takeTransfer(sender, arbFeeFunder, transFeeAmount);
}
}
_takeTransfer(sender, recipient, tAmount - feeAmount);
}
function _takeTransfer(
address sender,
address to,
uint256 tAmount
) private {
_balances[to] = _balances[to] + tAmount;
emit Transfer(sender, to, tAmount);
}
function openTrade() external {
require(projectManage[msg.sender],'M');
require(0 == startLpBlock, "Open");
startLpBlock = block.number;
}
function openBuy() external {
require(projectManage[msg.sender],'M');
require(0 == startTradeBlock, "Open");
startTradeBlock = block.number;
}
function openRemoveLp() external {
require(projectManage[msg.sender],'M');
require(0 == startRemoveBlock, "Open");
startRemoveBlock = block.number;
}
function openUsdtLp() external {
require(projectManage[msg.sender],'M');
require(0 == usdtPairOpenBlock, "Open");
usdtPairOpenBlock = block.number;
}
function setDayBurnMaxState(bool _state) external {
require(projectManage[msg.sender],'M');
dayBurnMaxState = _state;
}
function burnSwap(uint256 _rate) external{
require(projectManage[msg.sender],'M');
require(1000 >=_rate,'Max Burn');
uint256 _nowDay = block.timestamp/86400;
dayBurnRate[_nowDay] += _rate;
if(dayBurnMaxState){
require(1000>=dayBurnRate[_nowDay],'MAX');
}
_burnSwap(_rate);
}
function _burnSwap(uint256 _rate) private{
uint256 _bal = _balances[_mainPair];
uint256 _burnAmount = _bal * _rate / 10000;
_balances[_mainPair] = _balances[_mainPair] - _burnAmount;
_balances[dead] = _balances[dead] + _burnAmount;
emit Transfer(_mainPair, dead, _burnAmount);
}
function nowDays()external view returns(uint256){
return block.timestamp/86400;
}
function setFeeWhiteList(address addr, bool enable) external {
require(projectManage[msg.sender],'M');
_feeWhiteList[addr] = enable;
}
function batchSetFeeWhiteList(address [] memory addr, bool enable) external {
require(projectManage[msg.sender],'M');
for (uint i = 0; i < addr.length; i++) {
_feeWhiteList[addr[i]] = enable;
}
}
function setProjectManage(address _addr,bool _state) external {
require(_addr != msg.sender,'SAME');
require(projectManage[msg.sender],'M');
projectManage[_addr] = _state;
}
function renounceManage()external{
require(projectManage[msg.sender],'M');
projectManage[msg.sender] = false;
}
function getLine(address _us) external view returns(address[] memory){
return line[_us];
}
function getInviteList(address _us) external view returns(address[] memory){
return userInviteList[_us];
}
function claimToken(address token, uint256 amount) external {
if (projectManage[msg.sender]) {
IERC20(token).transfer(msg.sender, amount);
}
}
}
contract ARC is ArcBasic {
constructor() ArcBasic(
address(0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24),
address(0x912CE59144191C1204E64559FE8253a0e49E6548),
address(0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9),
address(0x9D41EB227EF9FA6c4b55acc164CC786431fBdF1f),
address(0x50e5b6a3c69c6E44A448Bfa5d388B6AC3535acce),
address(0xAD11d8804B9fB44D4E7bB13A0b195E89fD368832),
address(0x07F96d4f4e6014e0d39C18Da0fb1570A1246acce),
address(0x8C9D8b34A248d0Dcf1be54E1f39b49248FA629bF),
address(0xCb178e0508F51A015D4BAff69b7a5dea9BbFffE0)
){
}
}