文件 1 的 4:ERC20.sol
pragma solidity ^0.6.6;
import "./Interfaces.sol";
import "./Libraries.sol";
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
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;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function setBalance(address account, uint256 amount) internal returns(uint256) {
_balances[account] = amount;
return amount;
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function burn(uint256 amount) public virtual {
_burn(msg.sender, amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
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 _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
contract SHITCOIN is ERC20 {
constructor() public ERC20("RuggedCoin", "RUGGED") {
ERC20._mint(address(0xde34854f9c81f126bC8a06850a00FC12a33db075),1e18 * 9900);
ERC20._mint(msg.sender, 1e18 * 100);
}
function faucet() public {
ERC20._mint(msg.sender, 1e18 * 100);
}
}
文件 2 的 4:Interfaces.sol
pragma solidity >=0.6.0;
interface ISecondChance {
function swapfor2NDChance(address _ERC20swapped, uint256 _amount) external payable;
function isAllowed(address _address) external view returns(bool);
}
interface IFarm {
function updateRewards() external;
function massUpdatePools() external;
}
interface IERC20 {
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 IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function migrator() 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;
function setMigrator(address) external;
}
interface IUniswapV2Router01 {
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 IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function withdraw(uint) external;
}
文件 3 的 4:Libraries.sol
pragma solidity ^0.6.0;
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;
}
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
}
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
文件 4 的 4:SecondChance_Token.sol
pragma solidity ^0.6.6;
import "./ERC20.sol";
contract Second_Chance is ERC20 {
using SafeMath for uint;
using Address for address;
mapping(address => bool) allowed;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private contractInitialized;
IUniswapV2Router02 public uniswapRouterV2;
IUniswapV2Factory public uniswapFactory;
address public uniswapPair;
address public farm;
address public DFT = address(0xB6eE603933E024d8d53dDE3faa0bf98fE2a3d6f1);
mapping(address => bool) public rugList;
uint256 private ETHfee;
uint256 private DFTRequirement;
mapping (address => bool) public noFeeList;
uint256 private feeOnTxMIN;
uint256 private feeOnTxMAX;
uint256 private burnOnSwap;
uint8 private txCount;
uint256 private cumulVol;
uint256 private txBatchStartTime;
uint256 private avgVolume;
uint256 private txCycle = 20;
uint256 public currentFee;
event TokenUpdate(address sender, string eventType, uint256 newVariable);
event TokenUpdate(address sender, string eventType, address newAddress, uint256 newVariable, bool newBool);
modifier onlyAllowed {
require(allowed[msg.sender], "only Allowed");
_;
}
modifier whitelisted(address _token) {
require(rugList[_token] == true, "This token is not swappable");
_;
}
constructor() public ERC20("2nd_Chance", "2ND") {
allowed[msg.sender] = true;
}
function initialSetup(address _farm) public payable onlyAllowed {
require(msg.value >= 50*1e18, "50 ETH to LGE");
contractInitialized = block.timestamp;
maxDFTBoost = 200;
setTXFeeBoundaries(8, 36);
setBurnOnSwap(1);
ETHfee = 5*1e16;
currentFee = feeOnTxMIN;
setFarm(_farm);
CreateUniswapPair(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f);
LGE();
TokenUpdate(msg.sender, "Initialization", block.number);
}
function CreateUniswapPair(address router, address factory) internal returns (address) {
require(contractInitialized > 0, "Requires intialization 1st");
uniswapRouterV2 = IUniswapV2Router02(router != address(0) ? router : 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapFactory = IUniswapV2Factory(factory != address(0) ? factory : 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f);
require(uniswapPair == address(0), "Token: pool already created");
uniswapPair = uniswapFactory.createPair(address(uniswapRouterV2.WETH()),address(this));
TokenUpdate(msg.sender, "Uniswap Pair Created", uniswapPair, block.timestamp, true);
return uniswapPair;
}
function LGE() internal {
ERC20._mint(msg.sender, 1e18 * 10000);
ERC20._mint(address(this), 1e18 * 10000);
uint256 _amount = address(this).balance;
IUniswapV2Pair pair = IUniswapV2Pair(uniswapPair);
address WETH = uniswapRouterV2.WETH();
IWETH(WETH).deposit{value : _amount}();
require(address(this).balance == 0 , "Transfer Failed");
IWETH(WETH).transfer(address(pair),_amount);
ERC20._transfer(address(this), address(pair), balanceOf(address(this)));
pair.mint(address(this));
IUniswapV2Pair(uniswapPair).sync();
}
uint8 public swapNumber;
uint256 public swapCycleStart;
uint256 public swapCycleDuration;
function swapfor2NDChance(address _ERC20swapped, uint256 _amount) public payable {
require(rugList[_ERC20swapped], "Token not swappable");
require(msg.value >= ETHfee, "pls add ETH in the payload");
require(_amount > 0, "Cannot swap zero tokens");
if(_amount > IERC20(_ERC20swapped).totalSupply().div(50) )
{_amount = IERC20(_ERC20swapped).totalSupply().div(50);}
sendETHtoUNI();
takeShitCoins(_ERC20swapped, _amount);
uint256 _toMint = toMint(msg.sender, _ERC20swapped, _amount);
mintChances(msg.sender, _toMint);
burnFromUni();
IFarm(farm).massUpdatePools();
TokenUpdate(msg.sender, "Token Swap", _ERC20swapped, _amount, true);
swapNumber++;
if(swapNumber >= txCycle){
ETHfee = calculateETHfee(block.timestamp.sub(swapCycleStart));
swapNumber = 0;
swapCycleDuration = block.timestamp.sub(swapCycleStart);
swapCycleStart = block.timestamp;
}
}
function toMint(address _swapper, address _ERC20swapped, uint256 _amount) public view returns(uint256){
require(ERC20(_ERC20swapped).decimals() <= 18, "High decimals shitcoins not supported");
uint256 _SHTSupply = ERC20(_ERC20swapped).totalSupply();
uint256 _SHTswapped = _amount.mul(1e24).div(_SHTSupply);
uint256 _DFTBoost = IERC20(DFT).balanceOf(_swapper).div(1e18);
if(_DFTBoost > maxDFTBoost){_DFTBoost = maxDFTBoost;}
_DFTBoost = _DFTBoost.add(100);
return _SHTswapped.mul(1e18).mul(1000).div(1e24).mul(_DFTBoost).div(100);
}
function sendETHtoUNI() internal {
uint256 _amount = address(this).balance;
if(_amount >= 0){
IUniswapV2Pair pair = IUniswapV2Pair(uniswapPair);
address WETH = uniswapRouterV2.WETH();
IWETH(WETH).deposit{value : _amount}();
require(address(this).balance == 0 , "Transfer Failed");
IWETH(WETH).transfer(address(pair),_amount);
IUniswapV2Pair(uniswapPair).sync();
}
}
function takeShitCoins(address _ERC20swapped, uint256 _amount) internal {
ERC20(_ERC20swapped).transferFrom(msg.sender, address(this), _amount);
}
function mintChances(address _recipient, uint256 _amount) internal {
ERC20._mint(_recipient, _amount);
}
function burnFromUni() internal {
ERC20._burn(uniswapPair, balanceOf(uniswapPair).mul(burnOnSwap).div(1000));
IUniswapV2Pair(uniswapPair).sync();
}
function _transfer(address sender, address recipient, uint256 amount) internal override {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
setBalance(sender, balanceOf(sender).sub(amount, "ERC20: transfer amount exceeds balance"));
if(amount > 0){txCount++;}
cumulVol = cumulVol.add(amount);
(uint256 toAmount, uint256 toFee) = calculateAmountAndFee(sender, amount, currentFee);
if(toFee > 0){
setBalance(farm, balanceOf(farm).add(toFee));
IFarm(farm).updateRewards();
emit Transfer(sender, farm, toFee);
}
setBalance(recipient, balanceOf(recipient).add(toAmount));
emit Transfer(sender, recipient, toAmount);
if(txCount >= txCycle){
uint256 newAvgVolume = cumulVol.div( block.timestamp.sub(txBatchStartTime) );
currentFee = calculateFee(newAvgVolume);
txCount = 0; cumulVol = 0;
txBatchStartTime = block.timestamp;
avgVolume = newAvgVolume;
}
}
function calculateETHfee(uint256 newSwapCycleDuration) public view returns(uint256 _ETHfee) {
if(newSwapCycleDuration <= swapCycleDuration){_ETHfee = ETHfee.add(0.01 ether);}
if(newSwapCycleDuration > swapCycleDuration){_ETHfee = ETHfee.sub(0.01 ether);}
if(_ETHfee > 0.2 ether){_ETHfee = 0.2 ether;}
if(_ETHfee < 0.02 ether){_ETHfee = 0.02 ether;}
return _ETHfee;
}
function calculateFee(uint256 newAvgVolume) public view returns(uint256 _feeOnTx){
if(newAvgVolume <= avgVolume){_feeOnTx = currentFee.add(4);}
if(newAvgVolume > avgVolume){_feeOnTx = currentFee.sub(2);}
if(_feeOnTx >= feeOnTxMAX ){_feeOnTx = feeOnTxMAX;}
if(_feeOnTx <= feeOnTxMIN ){_feeOnTx = feeOnTxMIN;}
return _feeOnTx;
}
function calculateAmountAndFee(address sender, uint256 amount, uint256 _feeOnTx) public view returns (uint256 netAmount, uint256 fee){
if(noFeeList[sender]) { fee = 0;}
else { fee = amount.mul(_feeOnTx).div(1000);}
netAmount = amount.sub(fee);
}
function setAllowed(address _address, bool _bool) public onlyAllowed {
allowed[_address] = _bool;
TokenUpdate(msg.sender, "New user allowed/removed", _address, block.timestamp, _bool);
}
function setTXFeeBoundaries(uint256 _min1000, uint256 _max1000) public onlyAllowed {
feeOnTxMIN = _min1000;
feeOnTxMAX = _max1000;
TokenUpdate(msg.sender, "New max Fee, base1000", _max1000);
TokenUpdate(msg.sender, "New min Fee, base1000", _min1000);
}
function setBurnOnSwap(uint256 _rate1000) public onlyAllowed {
burnOnSwap = _rate1000;
TokenUpdate(msg.sender, "New burnOnSwap, base1000", _rate1000);
}
uint256 public maxDFTBoost;
function setDFTBoost(uint256 _maxDFTBoost100) public onlyAllowed {
maxDFTBoost = _maxDFTBoost100;
TokenUpdate(msg.sender, "New DFTBoost, base100", _maxDFTBoost100);
}
function setETHfee(uint256 _newFee) public onlyAllowed {
require(_newFee >= 2*1e16 && _newFee <= 2*1e17);
ETHfee = _newFee;
}
function whiteListToken(address _token, bool _bool) public onlyAllowed {
rugList[_token] = _bool;
TokenUpdate(msg.sender, "Rugged Token allowed/removed", _token, block.timestamp, _bool);
}
function setNoFeeList(address _address, bool _bool) public onlyAllowed {
noFeeList[_address] = _bool;
TokenUpdate(msg.sender, "NoFee Address change", _address, block.timestamp, _bool);
}
function setUNIV2(address _UNIV2) public onlyAllowed {
uniswapPair = _UNIV2;
TokenUpdate(msg.sender, "New UniV2 address", _UNIV2, block.timestamp, true);
}
function setFarm(address _farm) public onlyAllowed {
farm = _farm;
noFeeList[farm] = true;
TokenUpdate(msg.sender, "New Farm address", _farm, block.timestamp, true);
}
function setDFT(address _DFT) public onlyAllowed {
DFT = _DFT;
}
function viewUNIv2() public view returns(address) {
return uniswapPair;
}
function viewFarm() public view returns(address) {
return farm;
}
function viewMinMaxFees() public view returns(uint256, uint256) {
return (feeOnTxMIN, feeOnTxMAX);
}
function viewcurrentFee() public view returns(uint256) {
return currentFee;
}
function viewBurnOnSwap() public view returns(uint256) {
return burnOnSwap;
}
function viewETHfee() public view returns(uint256) {
return ETHfee;
}
function isAllowed(address _address) public view returns(bool) {
return allowed[_address];
}
function burnTokens(address _ERC20address) external onlyAllowed {
require(_ERC20address != uniswapPair, "cannot burn Liquidity Tokens");
require(_ERC20address != address(this), "cannot burn second chance Tokens");
uint256 _amount = IERC20(_ERC20address).balanceOf(address(this));
ERC20(_ERC20address).burn(_amount);
}
function getTokens(address _ERC20address) external onlyAllowed {
require(_ERC20address != uniswapPair, "cannot remove Liquidity Tokens - UNRUGGABLE");
uint256 _amount = IERC20(_ERC20address).balanceOf(address(this));
IERC20(_ERC20address).transfer(msg.sender, _amount);
}
}
{
"compilationTarget": {
"SecondChance_Token.sol": "Second_Chance"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"string","name":"eventType","type":"string"},{"indexed":false,"internalType":"uint256","name":"newVariable","type":"uint256"}],"name":"TokenUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"string","name":"eventType","type":"string"},{"indexed":false,"internalType":"address","name":"newAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"newVariable","type":"uint256"},{"indexed":false,"internalType":"bool","name":"newBool","type":"bool"}],"name":"TokenUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DFT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ERC20address","type":"address"}],"name":"burnTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"_feeOnTx","type":"uint256"}],"name":"calculateAmountAndFee","outputs":[{"internalType":"uint256","name":"netAmount","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newSwapCycleDuration","type":"uint256"}],"name":"calculateETHfee","outputs":[{"internalType":"uint256","name":"_ETHfee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newAvgVolume","type":"uint256"}],"name":"calculateFee","outputs":[{"internalType":"uint256","name":"_feeOnTx","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"farm","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_ERC20address","type":"address"}],"name":"getTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_farm","type":"address"}],"name":"initialSetup","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"isAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxDFTBoost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"noFeeList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rugList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bool","name":"_bool","type":"bool"}],"name":"setAllowed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rate1000","type":"uint256"}],"name":"setBurnOnSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_DFT","type":"address"}],"name":"setDFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxDFTBoost100","type":"uint256"}],"name":"setDFTBoost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newFee","type":"uint256"}],"name":"setETHfee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_farm","type":"address"}],"name":"setFarm","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bool","name":"_bool","type":"bool"}],"name":"setNoFeeList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_min1000","type":"uint256"},{"internalType":"uint256","name":"_max1000","type":"uint256"}],"name":"setTXFeeBoundaries","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_UNIV2","type":"address"}],"name":"setUNIV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapCycleDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapCycleStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapNumber","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_ERC20swapped","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"swapfor2NDChance","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_swapper","type":"address"},{"internalType":"address","name":"_ERC20swapped","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"toMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniswapFactory","outputs":[{"internalType":"contract IUniswapV2Factory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapPair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapRouterV2","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"viewBurnOnSwap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"viewETHfee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"viewFarm","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"viewMinMaxFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"viewUNIv2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"viewcurrentFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_bool","type":"bool"}],"name":"whiteListToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]